-
Notifications
You must be signed in to change notification settings - Fork 2
/
find-site.py
27 lines (21 loc) · 1.03 KB
/
find-site.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#//This script is from my Medium Publication https://medium.com/@ekiser_48014/python-penetration-testing-discovering-obfuscated-web-applications-c759a865534b
# //Used to find a website not running on common ports using the requests module
#import the necessary packages
import requests
#Prompt for input the IP address and port range
ip = input("Please enter the IP address of the website: ")
start_port = int(input("Please enter the starting port of the website: "))
end_port = int(input("Please enter the ending port of the website: "))
#loop through the port range
for port in range(start_port, end_port + 1):
#construct the URL
url = f"http://{ip}:{port}"
#send the request and check the response
try:
r = requests.get(url, timeout=3)
#if the response is successful, print a success message
if r.status_code == 200:
print(f"The website is up and running on port {port}!")
#if an error is encountered, print an error message
except requests.exceptions.RequestException:
pass