summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorstevan <stevannestorovic@hotmail.com>2018-09-30 14:04:45 +0200
committerstevan <stevannestorovic@hotmail.com>2018-09-30 14:04:45 +0200
commitb5ca4466e559ca1722a1a1c9543194b7d2df2ea6 (patch)
treede9dfa77c018f3c3262c2d2f0c91a2c86a7b6988
parent34945fe2281bfd9b8e9ba8fb6f3cc045374ee379 (diff)
Added open ports counter, also added gitignore
-rwxr-xr-xtmap11
1 files changed, 8 insertions, 3 deletions
diff --git a/tmap b/tmap
index 8603623..ff093d7 100755
--- a/tmap
+++ b/tmap
@@ -17,14 +17,18 @@ def connScan(host, port, wait, notor):
sckt.connect((host, port))
print("[+] port {} on {} is open".format(port, host))
sckt.close()
+ return True
except:
pass
## This function goes throgh all ports and calls connScan for each one
def portScan(host, ports, wait, notor):
+ openPorts = 0
for p in ports:
- connScan(host, p, wait, notor)
+ if connScan(host, p, wait, notor):
+ openPorts += 1
+ print("{} open ports on {}.".format(openPorts, host))
def main():
startTime = time.time()
@@ -56,9 +60,9 @@ def main():
## Load specified ports into PORTS list
if "-" not in args.tgtPort:
- PORTS = map(int, args.tgtPort.split(","))
+ PORTS = list(map(int, args.tgtPort.split(",")))
else:
- PORTS = map(int, args.tgtPort.split("-"))
+ PORTS = list(map(int, args.tgtPort.split("-")))
if len(PORTS) != 2:
parser.print_help()
exit()
@@ -76,6 +80,7 @@ def main():
## Scan each host in HOSTS list
for h in HOSTS:
portScan(h, PORTS, WAIT_TIME, CLEARNET)
+
endTime = time.time()
totalTime = endTime - startTime
print("Scan done in {} seconds".format(round(totalTime, 2)))