-
Notifications
You must be signed in to change notification settings - Fork 11
/
ip-scanner.py
62 lines (50 loc) · 1.69 KB
/
ip-scanner.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
import socket
from sys import modules
import time
import threading
from queue import Queue
# pip install modules
# Don't dare to copy my code, I'll eat your cookies
# else you build yourself or copy others
logo = '''
_ _ _ _ _ _ __ _____
| | | | | | | | | | / / / ___|
| |_| | | | | | | |/ / \ `--. ___ __ _ _ __ _ __ ___ _ __
| _ | | | | | | \ `--. \/ __/ _` | '_ \| '_ \ / _ \ '__|
| | | | |_| | |___| |\ \ /\__/ / (_| (_| | | | | | | | __/ |
\_| |_/\___/\_____|_| \_/ \____/ \___\__,_|_| |_|_| |_|\___|_|
coded by Sumalya Chatterjee
'''
print(logo)
print("wait, redhulk is building the code ...")
socket.setdefaulttimeout(0.25)
lock = threading.Lock()
ip_address = input('IP Address or Website URL : ')
host = socket.gethostbyname(ip_address)
print ('Scanning on IP Address: ', host)
def scan(port):
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
try:
con = sock.connect((host, port))
with lock:
print(port, 'is open')
con.close()
except:
pass
def execute():
while True:
worker = queue.get()
scan(worker)
queue.task_done()
queue = Queue()
start_time = time.time()
for x in range(100):
thread = threading.Thread(target = execute)
thread.daemon = True
thread.start()
for worker in range(1, 500):
queue.put(worker)
queue.join()
print('Time taken:', time.time() - start_time)
print ("Thank You for using my tool :>")
input("Enter To Continue")