You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Below is a simple script to quickly populate WatchYourPorts.
⚠️ If an entry exists in wyp, with scan results, it will be overwritten without warning.
#!/usr/bin/env python3importosimportrequeststry:
fromdotenvimportload_dotenv# Load configuration from .env fileload_dotenv()
exceptImportError:
print("Note: 'python-dotenv' is not installed. Installing it allows the application to load ""environment variables from a .env file, which is helpful for configuration management.")
WYL_URL=os.getenv("WYL_URL", "http://localhost:8840")
WYP_URL=os.getenv("WYP_URL", "http://localhost:8853")
defadd_address(name, ip):
url=f"{WYP_URL}/addr_add/"headers= {
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7',
'Accept-Language': 'en,en-GB;q=0.9,en-LU;q=0.8,fr-FR;q=0.7,fr;q=0.6,en-US;q=0.5',
'Cache-Control': 'max-age=0',
'Connection': 'keep-alive',
'Content-Type': 'application/x-www-form-urlencoded',
'DNT': '1',
'Origin': WYP_URL,
'Referer': WYP_URL,
'Upgrade-Insecure-Requests': '1',
'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36'
}
data= {
'name': name,
'ip': ip
}
response=requests.post(url, headers=headers, data=data, timeout=5)
ifresponse.status_code==200:
print(f"Successfully added address: {name} with IP: {ip}")
else:
print(f"Failed to add address: {response.status_code}, {response.text}")
# URL to fetch data fromurl=WYL_URL+"/api/all"# Send a GET request to the URL with a timeout of 5 secondsresponse=requests.get(url, timeout=5)
# print(response.json())# Parse the JSON responsedata=response.json()
# Iterate over each element in the JSON data and print the Name and IPforitemindata:
name=item.get("Name").rstrip('.')
iflen(name) ==0:
name="No Name defined"# noqaip=item.get("IP")
add_address(name, ip)
The text was updated successfully, but these errors were encountered:
Below is a simple script to quickly populate WatchYourPorts.
The text was updated successfully, but these errors were encountered: