-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
26 lines (20 loc) · 926 Bytes
/
main.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
# This entrypoint file to be used in development. Start by reading README.md
import port_scanner
from unittest import main
# Called with URL
ports = port_scanner.get_open_ports("www.freecodecamp.org", [75,85])
print("Open ports:", ports)
# Called with ip address
ports = port_scanner.get_open_ports("104.26.10.78", [8079, 8090])
print("Open ports:", ports)
# Verbose called with ip address and no host name returned -- single open port
ports = port_scanner.get_open_ports("104.26.10.78", [440, 450], True)
print(ports + '\n')
# Verbose called with ip address and valid host name returned -- single open port
ports = port_scanner.get_open_ports("137.74.187.104", [440, 450], True)
print(ports + '\n')
# Verbose called with host name -- multiple ports returned
ports = port_scanner.get_open_ports("scanme.nmap.org", [20, 80], True)
print(ports + '\n')
# Run unit tests automatically
main(module='test_module', exit=False)