■ ■ ■ ■ ■ ■
Fuzzing Script/port_scanner.py
| 1 | + | from socket import * |
| 2 | + | import time |
| 3 | + | startTime = time.time() |
| 4 | + | |
| 5 | + | if __name__ == '__main__': |
| 6 | + | target = input('Enter the host to be scanned: ') |
| 7 | + | t_IP = gethostbyname(target) |
| 8 | + | print ('Starting scan on host: ', t_IP) |
| 9 | + | |
| 10 | + | for i in range(0, 65535): |
| 11 | + | s = socket(AF_INET, SOCK_STREAM) |
| 12 | + | |
| 13 | + | conn = s.connect_ex((t_IP, i)) |
| 14 | + | if(conn == 0) : |
| 15 | + | print ('Port %d: OPEN' % (i,)) |
| 16 | + | s.close() |
| 17 | + | print('Time taken:', time.time() - startTime) |
| 18 | + | |