pyth0n3 Posted June 20, 2010 Report Posted June 20, 2010 (edited) Use nmap to scan ip ranges , for vnc servers , and save the scan to a log file #!/usr/bin/python#Author: pyth0n3 #Blog: http://pyth0n3.blogspot.com/#Date: 20.06.2010#Use nmap to scan ip ranges for open vnc server then save the results to log file #Need python-nmap library #Download module : wget http://xael.org/norman/python/python-nmap/python-nmap-0.1.4.tar.gz #Install : tar xvzf python-nmap-0.1.4.tar.gz && cd python-nmap-0.1.4 && sudo python setup.py install#Must specify the range , by default is '192.168.1.0/24'#The log file must be created in the local directory, by default is 'log'import nmap import timemap = nmap.PortScanner()print '.............Start scanning ................'time.sleep(5)print '.....................this may take a while ..............'time.sleep(10)print '....................................still scanning be patient..............'map.scan(hosts='192.168.1.0/24', arguments='-sV -sS -R -PS5900')map.all_hosts()f = open('log','w')log = ffor host in map.all_hosts(): print >> log, ('================================================') print >> log, ('Host : %s (%s)' % (host, map[host].hostname())) print >> log, ('State : %s' % map[host].state()) print >> log, ('================================================')for proto in map[host].all_protocols(): print >> log, ('#################') print >> log, ('Protocol : %s' % proto) lport = map[host][proto].keys() lport.sort() for port in lport: print >> log, ('port : %s\tstate : %s' % (port, map[host][proto][port]['state']))f.close() print '=====================================================>the scan was finished ,go and check the log file<==========================================='#END Edited June 20, 2010 by pyth0n3 Quote