Advertisement
i-Hmx

Get Hostname for specific servers range

Feb 20th, 2012
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.85 KB | None | 0 0
  1. #!/usr/bin/python
  2.  
  3. import sys
  4. import urllib2
  5. import re
  6. import string
  7.  
  8.  
  9. def banner():
  10.  
  11.     print '''
  12.             d8888  
  13.            d8P888  
  14.           d8P 888  
  15. 888  888  d8P  888  
  16. 888  888 d88   888  
  17. Y88  88P 8888888888
  18. Y8bd8P        888  
  19.   Y88P         888  Team   
  20.    
  21. [#] By Cyber-Crystal [#]
  22. [#] WwW.V4-Team.Com  [#]
  23.     '''
  24. if len(sys.argv) < 2:
  25.     banner()
  26.     print "\n"
  27.     print "Get ALl HostName For all datecenters"
  28.     print "well be use 192.168.1.1 End 192.168.1.254 ok !!\n"
  29.  
  30.     print "use %s IP_Target" % sys.argv[0]
  31.     sys.exit()
  32.  
  33. def server():
  34.     try:
  35.         ss = sys.argv[1]
  36.         sp = ss.split('.')
  37.         buf =  sp[0]+"."
  38.         buf += sp[1]+"."
  39.         buf += sp[2]
  40.         for i in range(1,254):
  41.             try:
  42.                 v4 = buf+"."+str(i)
  43.                 file = open("datacenter.txt", 'a')
  44.                 url = urllib2.urlopen("http://s92443018.onlinehome.us/cgi-bin/host.php?"+v4)
  45.                 date = url.read()
  46.                 find = re.findall("Hostname: (.*?)<br>",date)
  47.                 for host in range(len(find)):
  48.                     print find[host] + " Ip :: " +v4
  49.                     file.write(find[host]+" : ip : "+v4+"\n")
  50.             except IOError:
  51.                 pass
  52.     except IOError:
  53.         pass
  54.  
  55. server()
  56. print "\n\n"
  57. print "you Wint reverse Domans ALl server ? \n"
  58. a = raw_input(" yes / no : ")
  59.  
  60. def reverse():
  61.     try:
  62.         ss = sys.argv[1]
  63.         sp = ss.split('.')
  64.         buf =  sp[0]+"."
  65.         buf += sp[1]+"."
  66.         buf += sp[2]
  67.         for i in range(1,254):
  68.             try:
  69.                
  70.                 v4 = buf+"."+str(i)
  71.                 file = open(v4+".txt" , "a")
  72.                 #file = open(sys.argv[1], 'a')
  73.                 url = urllib2.urlopen("http://sameip.org/ip/"+v4)
  74.                 date = url.read()
  75.                 find = re.findall('target="_blank">(.+)</a>',date)
  76.                 cw = len(find)-3
  77.                 for o in range(cw):
  78.                     print  "Get siets for : "+v4
  79.                     coms = find[o]
  80.                     file.write(coms+"\n")
  81.  
  82.             except IOError:
  83.                 pass
  84.     except IOError:
  85.         pass
  86. if a == 'yes':     
  87.     reverse()
  88.    
  89. else :
  90.     print "v4-team.com"
  91.     print "Exit"
  92.     sys.exit()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement