Rework scanner to scan by constant sized chunks

This commit is contained in:
Oleksii Shevchuk 2017-03-09 10:50:45 +02:00
parent 04937b3b74
commit a8ea7a4824
1 changed files with 2 additions and 2 deletions

View File

@ -11,12 +11,12 @@ import logging
def create_socket(host, port): def create_socket(host, port):
sock = socket.socket() sock = socket.socket()
sock.setblocking(0) sock.setblocking(0)
try: try:
print 'Try: {}:{}'.format(host, int(port))
r = sock.connect_ex((host, int(port))) r = sock.connect_ex((host, int(port)))
except Exception, e: except Exception, e:
print "Exception: {}/{}".format(e, type(e))
return None, None return None, None
return sock, r return sock, r
def scan(hosts, ports, abort=None, timeout=10, portion=32, on_complete=None, on_open_port=None): def scan(hosts, ports, abort=None, timeout=10, portion=32, on_complete=None, on_open_port=None):