summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoralexej996 <aleksej@spidermail.tk>2018-11-06 02:30:55 +0100
committeralexej996 <aleksej@spidermail.tk>2018-11-06 02:30:55 +0100
commitbee3edcdc19879166abdede4d969e0ed5d66046c (patch)
tree36e49b16c6903ab96141a1ed5b0a669068bbfbda
parent1a753bc8cd12fdb79ba0dc72aa7a3b6674f778dd (diff)
more detailed error description and check that ports arent bigger then 65535
-rwxr-xr-xtmap5
1 files changed, 5 insertions, 0 deletions
diff --git a/tmap b/tmap
index a800887..e067912 100755
--- a/tmap
+++ b/tmap
@@ -29,6 +29,8 @@ def connScan(host, port, wait, notor):
def portScan(host, ports, wait, notor):
openports = list()
for p in ports:
+ if p > 65535:
+ pass
if connScan(host, p, wait, notor):
openports.append(p)
return openports
@@ -114,6 +116,7 @@ def main():
PORTS.append(p)
except:
parser.print_help()
+ print("Ports must be integers")
exit()
## If p is a range, add a range of ports to the list of ports to scan
else:
@@ -121,10 +124,12 @@ def main():
p = list(map(int, p.split("-")))
except:
parser.print_help()
+ print("Ports in a range must be integers")
exit()
## Range needs to be defined as exactly two integers separated by "-"
if len(p) != 2 or p[0] > p[1]:
parser.print_help()
+ print("Port range improperly defined")
exit()
else:
p = list(range(p[0],p[1]+1))