MCPcopy Index your code
hub / github.com/geekcomputers/Python / connScan

Function connScan

portscanner.py:18–32  ·  view source on GitHub ↗
(tgtHost, tgtPort)

Source from the content-addressed store, hash-verified

16
17
18def 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
35def portScan(tgtHost, tgtPorts): # Start of the function

Callers

nothing calls this directly

Calls 1

closeMethod · 0.45

Tested by

no test coverage detected