diff options
author | alexej996 <aleksej@spidermail.tk> | 2018-10-03 19:30:43 +0200 |
---|---|---|
committer | alexej996 <aleksej@spidermail.tk> | 2018-10-03 19:30:43 +0200 |
commit | 37b6afbe55efec62b0b970d9570c979f0faa1c5d (patch) | |
tree | a679c3e74318edb0c6d4412cb083beb1e8e4e0e4 | |
parent | 2e724a7caaa90cb85c9c9eb891d84373d78ea0fa (diff) |
port option error handling
-rwxr-xr-x | tmap | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -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: |