From 37b6afbe55efec62b0b970d9570c979f0faa1c5d Mon Sep 17 00:00:00 2001 From: alexej996 Date: Wed, 3 Oct 2018 19:30:43 +0200 Subject: port option error handling --- tmap | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'tmap') 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: -- cgit v1.2.3