The following code is for security research and authorized testing only.
python
import requests
import re
# Target URL (Replace with actual vulnerable endpoint)
target_url = "http://target-ip/hcl-dpc-endpoint"
# Regex pattern to match private IP addresses
ip_pattern = r"\b(10\.\d{1,3}\.\d{1,3}\.\d{1,3}|172\.(1[6-9]|2\d|3[0-1])\.\d{1,3}\.\d{1,3}|192\.168\.\d{1,3}\.\d{1,3})\b"
def check_ip_disclosure(url):
try:
# Send a request to the target
response = requests.get(url, timeout=10)
# Check response headers and body
content = str(response.headers) + response.text
# Search for internal IPs
found_ips = re.findall(ip_pattern, content)
if found_ips:
print(f"[+] Potential Internal IP Disclosure found at: {url}")
print(f"[+] Detected IPs: {set(found_ips)}")
else:
print(f"[-] No Internal IPs detected.")
except requests.RequestException as e:
print(f"[!] Error connecting to target: {e}")
if __name__ == "__main__":
check_ip_disclosure(target_url)