summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksej Jocic <aleksej@spidermail.tk>2019-01-12 02:50:53 +0100
committerAleksej Jocic <aleksej@spidermail.tk>2019-01-12 02:50:53 +0100
commit2dbd3581e8c32b1b6865988ae66c525315ab6d00 (patch)
treef16d152adab9d0126afd14bf031a2de944c78c33
parente9420b23c4a7820f93b8118c61685ac1ff6bac4c (diff)
banner for private ip,code reorder
-rwxr-xr-xtmap34
1 files changed, 21 insertions, 13 deletions
diff --git a/tmap b/tmap
index e5476ee..936de74 100755
--- a/tmap
+++ b/tmap
@@ -9,6 +9,13 @@ import threading
## Receive first 80 bytes from port, return string of received data
def getBanner(host, port, wait, notor):
+ ## Don't use Tor if private address
+ try:
+ if ip_address(host).is_private:
+ notor = True
+ except:
+ pass
+
## If notor is set to True, it doesn't use the socks proxy
if notor:
sckt = socket(AF_INET, SOCK_STREAM)
@@ -211,20 +218,21 @@ def main():
for h in HOSTS:
r = hostScan(h, PORTS, WAIT_TIME, CLEARNET, JOBS)
for i in r.keys():
- if len(r[i]) != 0:
- f.write('Tmap scan report for {}\n'.format(i))
- if BANNER == False:
- f.write('PORT\tSTATE\n')
- for j in r[i]:
+ if len(r[i]) == 0:
+ continue
+ f.write('Tmap scan report for {}\n'.format(i))
+ if BANNER == False:
+ f.write('PORT\tSTATE\n')
+ for j in r[i]:
+ f.write('{}\topen\n'.format(j))
+ if BANNER:
+ f.write('PORT\tSTATE\tBANNER\n')
+ for j in r[i]:
+ banner = getBanner(i,j,WAIT_TIME, CLEARNET)
+ if banner == "banner_error":
f.write('{}\topen\n'.format(j))
- if BANNER:
- f.write('PORT\tSTATE\tBANNER\n')
- for j in r[i]:
- banner = getBanner(i,j,WAIT_TIME, CLEARNET)
- if banner == "banner_error":
- f.write('{}\topen\n'.format(j))
- else:
- f.write('{}\topen\t{}\n'.format(j,banner))
+ else:
+ f.write('{}\topen\t{}\n'.format(j,banner))
## Record time of program stopping and display the time running to the user
endTime = time.time()