Untitled
unknown
plain_text
a year ago
1.0 kB
3
Indexable
Never
from os import popen from time import sleep ### request nmap , hostmane def run_os(cmd): a = map(str, popen( cmd ).readlines() ) return a def ip(): m = run_os('hostname -I') m = m[0].replace(' \n','') return m def win_txt(cmd='win'): t = run_os( cmd ) txt = '' mip = ip() for i in t: tip = i.split('for ')[-1].replace('\n','').split('.')[-1] if '.lan' in i: i = i.split('.lan (')[-1].replace(')\n','')+' <:#\n' elif mip in i: i = i.split('for ')[-1].replace('\n','')+' <-@\n' else: if tip == '1': i =i.split('for ')[-1].replace('\n','')+' <:#\n' else: i =i.split('for ')[-1].replace('\n','')+' <:=\n' txt += i return txt def mainloop(slp=60): q = 0 while q == 0: cmd = "nmap -F 192.168.1.* | grep 'map scan'" p = win_txt(cmd) cmd = "nmap -F 192.168.0.* | grep 'map scan'" p += win_txt(cmd) print p, print 'total:',len(p.split('\n')),'/',len(p.split('\n'))-2 if slp != None: sleep( slp ) mainloop(20)