forked from dievus/threader3000
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy paththreader3000.py
68 lines (52 loc) · 1.23 KB
/
threader3000.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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/usr/bin/python3
import socket
import time
import threading
from queue import Queue
from datetime import datetime
import os.path
socket.setdefaulttimeout(0.55)
print_lock = threading.Lock()
#Welcome
print("-" * 50)
print("Python Port Scanner 3000")
print("A project by The Mayor/Dievus")
print("-" * 50)
if os.path.exists("target"):
target = open("target").readline().rstrip()
else:
target = input("Enter your target IP address or URL here: ")
t_IP = socket.gethostbyname(target)
#Banner
print("-" * 50)
print("Scanning target "+t_IP)
print("Time started: "+str(datetime.now()))
print("-" * 50)
t1 = datetime.now()
def portscan(port):
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
try:
conx = s.connect((t_IP, port))
with print_lock:
print("Port {} is open".format(port))
conx.close()
except:
pass
def threader():
while True:
worker = q.get()
portscan(worker)
q.task_done()
q = Queue()
startTime = time.time()
for x in range(200):
t = threading.Thread(target = threader)
t.daemon = True
t.start()
for worker in range(1, 65535):
q.put(worker)
q.join()
t2 = datetime.now()
total = t2 - t1
print("Port scan completed in "+str(total))
print("-" * 50)