Advertisement
iljimae

scan port

Dec 10th, 2014
250
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.65 KB | None | 0 0
  1. import urllib2
  2. import re
  3.  
  4. #Edit by iljimae (meber of VHS)
  5.  
  6.  
  7. target = raw_input("\n\tSite : ")
  8.  
  9. if target.startswith("http://"):
  10.     target = target.replace("http://", "")
  11.     print "\n\tI fixed link ", target
  12.     print ""
  13. elif target.startswith("https://"):
  14.     target = target.replace("https://", "")
  15.     print "\n\tI fixed link ", target
  16.     print ""
  17. else:
  18.     pass
  19.  
  20. app = []
  21. app.append(target)
  22. uagent= {'User-Agent':'Mozilla/5.0 (Windows NT 6.3; WOW64; rv:33.0) Gecko/20100101 Firefox/33.0'}
  23.  
  24. for site in set(app):
  25.     if site.startswith("http://"):
  26.         site = site.replace("http://", "")
  27.         print "\n\tI fixed link ", site
  28.     elif site.startswith("https://"):
  29.         site = site.replace("https://", "")
  30.         print "\n\tI fixed link ", site
  31.     else:
  32.         site = site
  33.    
  34.     urlqeqe = "http://viewdns.info/portscan/?host=%s" % (site)
  35.     request = urllib2.Request(urlqeqe, headers=uagent)
  36.     fd = urllib2.urlopen(request)
  37.     data = fd.read()
  38.  
  39.     comp = re.compile('"/images/\S+" height="20"')
  40.     baglantilar = comp.findall(data)  
  41.  
  42.     PORT = ["","",21,22,23,25,80,110,139,143,443,445,1433,1521,3306,3389]
  43.     Service = ["","","FTP","SSH","Telnet","SMTP","HTTP","POP3","NETBIOS","IMAP","HTTPS","SMB","MSSQL","ORACLE","MySQL","Remote Desktop(RDP)"]
  44.     a = [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]
  45.     ax = -1
  46.     print "\nTarget %s \n" % (site)
  47.     for i in baglantilar:
  48.         i = i.replace('"/images/', "").replace('" height="20"', "")
  49.         ax = ax +1  #Finally -_ -
  50.         if  1 < ax < 16:
  51.             if i == "ok.GIF":
  52.                 i = "OPEN"
  53.             elif i == "error.GIF":
  54.                 i = "CLOSE"
  55.             print "PORT %d %s Service %s" %(PORT[a[ax]],i,str(Service[a[ax]]))
  56. #VHS scan port!
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement