summaryrefslogtreecommitdiff
path: root/tmap
diff options
context:
space:
mode:
Diffstat (limited to 'tmap')
-rwxr-xr-xtmap34
1 files changed, 21 insertions, 13 deletions
diff --git a/tmap b/tmap
index 2ef3f71..25ec6e3 100755
--- a/tmap
+++ b/tmap
@@ -42,7 +42,7 @@ def main():
parser.add_argument("--version", dest="version", help="print version info and exit", action="store_true")
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("-p", "--ports", metavar="PORTS", dest="tgtPort", help="ports to scan", default="20-25,53,80-85,443-445,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=2)
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")
@@ -72,19 +72,27 @@ def main():
socks.setdefaultproxy(socks.PROXY_TYPE_SOCKS5, "127.0.0.1", args.torPort)
## Load specified ports into PORTS list
- if "-" not in args.tgtPort:
- 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 or PORTS[0]>PORTS[1]:
- parser.print_help()
- exit()
+ PORTS = list()
+ for p in args.tgtPort.split(","):
+ if "-" not in p:
+ try:
+ p = int(p)
+ PORTS.append(p)
+ except:
+ parser.print_help()
+ exit()
else:
- PORTS = range(PORTS[0],PORTS[1]+1)
+ try:
+ p = list(map(int, p.split("-")))
+ except:
+ parser.print_help()
+ exit()
+ if len(p) != 2 or p[0]>p[1]:
+ parser.print_help()
+ exit()
+ else:
+ p = list(range(p[0],p[1]+1))
+ PORTS += p
## Load other variables
HOSTS = args.HOSTS.split(",")