summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoralexej996 <aleksej@spidermail.tk>2018-10-03 19:30:43 +0200
committeralexej996 <aleksej@spidermail.tk>2018-10-03 19:30:43 +0200
commit37b6afbe55efec62b0b970d9570c979f0faa1c5d (patch)
treea679c3e74318edb0c6d4412cb083beb1e8e4e0e4
parent2e724a7caaa90cb85c9c9eb891d84373d78ea0fa (diff)
port option error handling
-rwxr-xr-xtmap8
1 files changed, 6 insertions, 2 deletions
diff --git a/tmap b/tmap
index 36eeb72..e54c447 100755
--- a/tmap
+++ b/tmap
@@ -63,10 +63,14 @@ def main():
## Load specified ports into PORTS list
if "-" not in args.tgtPort:
- PORTS = list(map(int, args.tgtPort.split(",")))
+ try:
+ PORTS = list(map(int, args.tgtPort.split(",")))
+ except:
+ parser.print_help()
+ exit()
else:
PORTS = list(map(int, args.tgtPort.split("-")))
- if len(PORTS) != 2:
+ if len(PORTS) != 2 or PORTS[0]>PORTS[1]:
parser.print_help()
exit()
else: