| 16 | |
| 17 | |
| 18 | def connScan(tgtHost, tgtPort): # Start of the function |
| 19 | try: |
| 20 | connSkt = socket(AF_INET, SOCK_STREAM) # Open a socket |
| 21 | connSkt.connect((tgtHost, tgtPort)) |
| 22 | connSkt.send("") |
| 23 | results = connSkt.recv(100) |
| 24 | screenLock.acquire() # Acquire the lock |
| 25 | print("[+] %d/tcp open" % tgtPort) |
| 26 | print("[+] " + str(results)) |
| 27 | except: |
| 28 | screenLock.acquire() |
| 29 | print("[-] %d/tcp closed " % tgtPort) |
| 30 | finally: |
| 31 | screenLock.release() |
| 32 | connSkt.close() |
| 33 | |
| 34 | |
| 35 | def portScan(tgtHost, tgtPorts): # Start of the function |