summaryrefslogtreecommitdiff
path: root/tmap
diff options
context:
space:
mode:
Diffstat (limited to 'tmap')
-rwxr-xr-x[-rw-r--r--]tmap18
1 files changed, 15 insertions, 3 deletions
diff --git a/tmap b/tmap
index 1bfa07e..81771ff 100644..100755
--- a/tmap
+++ b/tmap
@@ -28,14 +28,26 @@ def portScan(host, ports, wait, notor):
def main():
## Define and parse the arguments
parser = argparse.ArgumentParser(description="Simple port scanner that works over Tor")
- parser.add_argument("-H", "--hosts", metavar="HOSTS", dest="tgtHost", help="IP or domain to scan", required=True)
- parser.add_argument("-p", "--ports", metavar="PORTS", dest="tgtPort", help="ports to scan", default="80")
+ parser.add_argument("HOSTS", help="IP or domain to scan", default="empty_host", nargs="?")
+ parser.add_argument("-H", "--hosts", metavar="HOSTS", dest="tgtHost", help="IP or domain to scan", default="empty_host_option")
+ parser.add_argument("-p", "--ports", metavar="PORTS", dest="tgtPort", help="ports to scan", default="21,22,23,25,53,80,443,8080,8333,9050,9150")
parser.add_argument("-t", "--timeout", metavar="TIMEOUT", dest="sockTimeout", type=int, help="seconds to wait before connection timeout for each port", default=3)
parser.add_argument("--clearnet", dest="clearnet", help="don't use Tor for scanning", action="store_true")
parser.add_argument("--torport", metavar="TORPORT", dest="torPort", type=int, help="port for Tor proxy", default="9050")
args = parser.parse_args()
+ ## Combine HOST and --hosts values
+ if args.HOSTS == "empty_host":
+ if args.tgtHost == "empty_host_option":
+ parser.print_help()
+ print "\nHost must be specified"
+ exit()
+ else:
+ args.HOSTS = args.tgtHost
+ else:
+ if args.tgtHost != "empty_host_option":
+ args.HOSTS = args.HOSTS + "," + args.tgtHost
## Set Tor as default Tor proxy for the scanner
socks.setdefaultproxy(socks.PROXY_TYPE_SOCKS5, "127.0.0.1", args.torPort)
@@ -50,7 +62,7 @@ def main():
PORTS = range(PORTS[0],PORTS[1])
## Load other variables
- HOSTS = args.tgtHost.split(",")
+ HOSTS = args.HOSTS.split(",")
WAIT_TIME = args.sockTimeout
CLEARNET = False