Moved to using HEAD to save code

This commit is contained in:
daniel goldberg 2016-08-25 16:32:16 +03:00
parent dd8738a4f1
commit 57525b6450
1 changed files with 2 additions and 2 deletions

View File

@ -17,7 +17,7 @@ class HTTPFinger(HostFinger):
def get_host_fingerprint(self, host): def get_host_fingerprint(self, host):
assert isinstance(host, VictimHost) assert isinstance(host, VictimHost)
from requests import get from requests import head
from requests.exceptions import Timeout, ConnectionError from requests.exceptions import Timeout, ConnectionError
from contextlib import closing from contextlib import closing
@ -29,7 +29,7 @@ class HTTPFinger(HostFinger):
# try http, we don't optimise for 443 # try http, we don't optimise for 443
for url in (https, http): # start with https and downgrade for url in (https, http): # start with https and downgrade
try: try:
with closing(get(url, verify=False, timeout=1, stream=True)) as req: with closing(head(url, verify=False, timeout=1)) as req:
server = req.headers.get('Server') server = req.headers.get('Server')
ssl = True if 'https://' in url else False ssl = True if 'https://' in url else False
host.services['tcp-' + port[1]] = (server,ssl) host.services['tcp-' + port[1]] = (server,ssl)