From 6bd1ec22519551cf6f901db066e95de9f1a597d9 Mon Sep 17 00:00:00 2001 From: Stevan Date: Sun, 9 Jun 2019 14:52:11 -0400 Subject: REFACTORING: Added parseArgs function. Fixed a typo in readme. --- README.md | 2 +- tmap | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index bc3a507..2bd1d58 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ It was modifed to work over **Tor** for anonymous and hidden service scanning. ### Dependencies Tmap is a python script that requries the **socks** module and a running Tor deamon on localhost. -Tmap is built to support **pyhton3**. +Tmap is built to support **python3**. ### Usage: `./tmap [-h] -H HOSTS [-p PORTS] [-t TIMEOUT] [--clearnet] [--torport TORPORT]` diff --git a/tmap b/tmap index 98a4c07..0d9da66 100755 --- a/tmap +++ b/tmap @@ -148,12 +148,7 @@ def hostScan(host, ports, wait, notor, jobs): return ret -def main(): - ## Record time of program starting in seconds - startTime = time.time() - - ## Define and parse the arguments - parser = argparse.ArgumentParser(description="Simple stateful port scanner that works over Tor") +def parseArgs(parser): parser.add_argument("--version", dest="version", help="print version information and exit", action="store_true") parser.add_argument("HOSTS", help="IP address or domain to scan", default="empty_host", nargs="?") parser.add_argument("-H", "--hosts", metavar="HOSTS", dest="tgtHost", help="IP address or domain to scan", default="empty_host_option") @@ -164,8 +159,13 @@ def main(): parser.add_argument("--torport", metavar="TORPORT", dest="torPort", type=int, help="port on which Tor is listening on", default="9050") parser.add_argument("-j", "--jobs", metavar="JOBS", dest="jobs", type=int, help="maximum number of open connections at the same time", default="10") parser.add_argument("--output", metavar="OUTFILE", dest="outFile", help="write scan results to output file", default="empty_outfile") + return parser.parse_args() - args = parser.parse_args() + +def main(): + ## Record time of program starting in seconds + startTime = time.time() + args = parseArgs(argparse.ArgumentParser(description="Simple stateful port scanner that works over Tor")) ## Version argument if args.version: -- cgit v1.2.3