-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscn-port.py
More file actions
executable file
·57 lines (46 loc) · 1.6 KB
/
scn-port.py
File metadata and controls
executable file
·57 lines (46 loc) · 1.6 KB
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
# -*- coding:utf -8 -*-
from termcolor import colored
import socket
def fanc1():
color_a = colored("[+]", 'green')
print("~"*50)
host = input(color_a + "Host --> ")
port = int(input(color_a + "Port --> "))
print("~"*50)
scan = socket.socket()
color_b = colored("[!]", 'red')
color_c = colored("[!]", 'yellow')
try:
scan.connect((host, port))
except socket.error:
print(color_b + "Port -- ", port, " -- [CLOSED]")
else:
print(color_c + "Port -- ", port, " -- [OPEN]")
def fanc2():
color_a = colored("[+] ", 'green')
color_b = colored("[+] ", 'red')
color_c = colored("[+] ", 'yellow')
host = input(color_a + "Host --> ")
print("\n")
port = [20, 21, 22, 23, 42, 43, 53, 67, 69, 80, 139, 443, 445, 1433, 3306, 8080, 8081]
for i in port:
try:
scan = socket.socket()
scan.settimeout(0.5)
scan.connect((host, i))
except socket.error:
print(color_b + "Port -- ", i, " -- [CLOSED]")
else:
print(color_c + "Port -- ", i, " -- [OPEN]")
# меню (прога будет спрашивать у нас, сканировать список популярных портов, или только наш список)
print("~"*50)
print("\t[1] --- сканировать отдельный порт")
print("\t[2] --- сканировать список")
print("~"*50, "\n")
text_a = input("[scan]--> ")
if text_a == "1":
fanc1()
elif text_a == "2":
fanc2()
else:
print(colored("Параметр введен не правильно!", 'red'))