-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathverbi.py
19 lines (18 loc) · 823 Bytes
/
verbi.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import http.client
#from urllib.parse import urlparse
host = input("Inserisci host/IP del sistema target: ")
port = input("Inserisci la porta del sistema target (default:80): ")
path = input("Inserisci il percorso (default:'/'): ")
if(port==""): port = 80
if(path==""): path = '/'
try:
connection = http.client.HTTPConnection(host, port)
connection.request('OPTIONS', path)
response = connection.getresponse()
if(response.status >= 200 and response.status <= 299 and response.getheader("Allow") != None):
print("I metodi abilitati sono:", response.getheader("Allow"))
else:
print("usa un metodo alternativo per deteminare i verbi\n", response.status, "\n" ,response.getheaders())
connection.close()
except ConnectionError:
print("connessione fallita", ConnectionError.strerror)