diff options
author | Aleksej Jocic <aleksej@spidermail.tk> | 2019-01-12 02:50:53 +0100 |
---|---|---|
committer | Aleksej Jocic <aleksej@spidermail.tk> | 2019-01-12 02:50:53 +0100 |
commit | 2dbd3581e8c32b1b6865988ae66c525315ab6d00 (patch) | |
tree | f16d152adab9d0126afd14bf031a2de944c78c33 /tmap | |
parent | e9420b23c4a7820f93b8118c61685ac1ff6bac4c (diff) |
banner for private ip,code reorder
Diffstat (limited to 'tmap')
-rwxr-xr-x | tmap | 34 |
1 files changed, 21 insertions, 13 deletions
@@ -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() |