Jump to content
pyth0n3

Simple vnc scanner in python

Recommended Posts

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 time

map = 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 = f
for 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 by pyth0n3
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...