File tree Expand file tree Collapse file tree 2 files changed +86
-65
lines changed Expand file tree Collapse file tree 2 files changed +86
-65
lines changed Original file line number Diff line number Diff line change 1+ #!/usr/bin/env python
2+
3+ from concurrent .futures import ThreadPoolExecutor as executor
4+ import socket
5+ import time
6+ import sys
7+
8+ blue = "\033 [94m"
9+ red = "\033 [91m"
10+ end = "\033 [0m"
11+
12+ start = time .time ()
13+
14+ print (blue + """
15+ ____ _ ____
16+ | _ \ ___ _ __| |_/ ___| ___ __ _ _ __
17+ | |_) / _ \| '__| __\___ \ / __/ _` | '_ \
18+ | __/ (_) | | | |_ ___) | (_| (_| | | | |
19+ |_| \___/|_| \__|____/ \___\__,_|_| |_|
20+ By: @bing0o
21+ """ + end )
22+
23+
24+ def printer (shit ):
25+ sys .stdout .write (shit + " \r " )
26+ sys .stdout .flush ()
27+ return True
28+
29+
30+ def scan (ip ,port ,l ):
31+ printer ("Testing Port: " + str (port ))
32+ s = socket .socket (socket .AF_INET , socket .SOCK_STREAM )
33+ space = 10 - l
34+ space = " " * space
35+ if s .connect_ex ((ip ,port )):
36+ return None
37+ else :
38+ try :
39+ service = socket .getservbyport (port )
40+ print (str (port ) + "/TCP" + space + service )
41+ except socket .error :
42+ print (str (port ) + "/TCP" + space + "Unknown" )
43+
44+ except KeyboardInterrupt :
45+ print ("[-] Exiting!" )
46+ exit (1 )
47+
48+ return True
49+
50+ parser = ("""
51+ #Usage:
52+
53+ python scan.py <Target Ip/Host> <Threads, (default: 10)>
54+ """ )
55+
56+ try :
57+ target = sys .argv [1 ]
58+ except :
59+ print (parser )
60+ exit (1 )
61+
62+ try :
63+ thread = sys .argv [2 ]
64+ except :
65+ thread = 10
66+
67+ print (red + "[+] Target: " + end + target )
68+ print (red + "[+] Threads: " + end + str (thread ))
69+ print (red + "[+] Start The Scan\n " + end )
70+ print ("PORT SERVICE" )
71+ print ("---- -------" )
72+ ports = range (65535 )
73+ try :
74+ with executor (max_workers = int (thread )) as exe :
75+ [exe .submit (scan , target , port , len (str (port ))) for port in ports ]
76+ except KeyboardInterrupt :
77+ print ("[-] Exiting!" )
78+ exit (1 )
79+
80+
81+ took = time .time () - start
82+ took = took / 60
83+ took = round (took , 2 )
84+
85+ print (" \r " )
86+ print (blue + "[+] Took: " + end + str (took )+ " " )
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments