-
Notifications
You must be signed in to change notification settings - Fork 1
/
speedy
72 lines (63 loc) · 1.84 KB
/
speedy
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
69
70
71
72
#!/usr/bin/env python3
import socket
import threading
from tqdm import tqdm
import os
check=[]
confirmed=[]
threads=[]
speed_mode=[1,3,5,15,17,51,85,255,257,771,1285,3855,4369,13107,21845,65535]
def createFunc(i):
if i==0:
def func(x):
y=1
for i in tqdm(range(int(65535/x))):
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
if s.connect_ex((ip, y)) == 0:check.append(str(y));os.system("clear");print("#Ports Detected:");[print(b) for b in check]
y+=1
else:
def func(x):
for a in range(int(i*(65535/x)+1),int((i+1)*(65535/x))):
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
if s.connect_ex((ip, a+1)) == 0:check.append(str(a+1));os.system("clear");print("#Ports Detected:");[print(b) for b in check]
return func
scan = [createFunc(i) for i in range(85)]
def checkport(ip,port):
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
return s.connect_ex((ip, int(port))) == 0
choice=input(
'''choose as option:
1 - check all ports
2 - manual check
>'''
)
ip=input(
'''
target ip
>''')
print()
if choice=='1':
speed = input("speed (1~16) (default=7): ")
if speed == "":speed=7
for x in range(int(speed)):
threads.append(threading.Thread(target=scan[x](speed_mode[int(speed)-1])))
os.system("clear")
print("#Ports Detected:")
for thread in threads:thread.start()
for thread in threads:thread.join()
if check!=[]:
[print(b) for b in check]
print("#Checking for false positives...")
for port in check:
if checkport(ip,int(port)):confirmed.append(port)
if confirmed!=[]:print("Ports",','.join(confirmed),"are open!")
else:print("No Open Port Found!")
else:print("No Open Port Found!")
elif choice=='2':
port=input(
'''
check port
>''')
if checkport(ip,port):print("Port",port,"is open")
else:print("Port",port,"is not open")
else:print("Unknown input. Please try again.")