Skip to content

Commit 57a64f2

Browse files
authored
Host could not be past to thread
1 parent f398822 commit 57a64f2

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

ethical-hacking/port_scanner/fast_port_scanner.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
q = Queue()
1818
print_lock = Lock()
1919

20-
def port_scan(port):
20+
def port_scan(host, port):
2121
"""
2222
Scan a port on the global variable `host`
2323
"""
@@ -40,7 +40,7 @@ def scan_thread():
4040
# get the port number from the queue
4141
worker = q.get()
4242
# scan that port number
43-
port_scan(worker)
43+
port_scan(*worker)
4444
# tells the queue that the scanning for that port
4545
# is done
4646
q.task_done()
@@ -56,10 +56,10 @@ def main(host, ports):
5656
# start the daemon thread
5757
t.start()
5858

59-
for worker in ports:
59+
for port in ports:
6060
# for each port, put that port into the queue
6161
# to start scanning
62-
q.put(worker)
62+
q.put((host, port))
6363

6464
# wait the threads ( port scanners ) to finish
6565
q.join()
@@ -78,4 +78,4 @@ def main(host, ports):
7878

7979
ports = [ p for p in range(start_port, end_port)]
8080

81-
main(host, ports)
81+
main(host, ports)

0 commit comments

Comments
 (0)