SHARE
TWEET

IP Grabber

a guest Dec 23rd, 2015 46 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import random, subprocess, socket, thread
  2. from colorama import init, Fore
  3. init()
  4.  
  5. IPList = []
  6. newIP = []
  7.  
  8. f = open("Addresses.txt", "r")
  9. for i in f:
  10.     IPList.append(i)
  11. f.close()
  12.  
  13. def endall():
  14.     raw_input(Fore.WHITE + "Press any key to see the list of valid addresses, sire.")
  15.     f = open("Addresses.txt", "r")
  16.     n = 1
  17.     for i in f:
  18.         print Fore.GREEN + "IP ADDRESS #"+str(n)+"  "+i
  19.         n += 1
  20.     raw_input(Fore.WHITE + "Press any key to end program, sire.")
  21.     exit()
  22.    
  23. def Everything():
  24.     while(True):
  25.         rawIP = str(random.randint(0, 255))+"."+str(random.randint(0, 255))+"."+str(random.randint(0, 255))+"."+str(random.randint(0, 255))
  26.         while(rawIP in IPList):
  27.                 rawIP = str(random.randint(0, 255))+"."+str(random.randint(0, 255))+"."+str(random.randint(0, 255))+"."+str(random.randint(0, 255))
  28.         IPList.append(rawIP)
  29.         response = subprocess.call("ping -n 1 -f -l 0 -w 4 " + rawIP, stdout=subprocess.PIPE)
  30.         if response == 0:
  31.             print Fore.GREEN + "\nCONSOLE --- VALID IP ADDRESS: "+rawIP
  32.             f = open("Addresses.txt", "a")
  33.             f.write(rawIP+"\n")
  34.             f.close
  35.  
  36. try:
  37.     NTP = int(raw_input("How many addresses would you like to check per thread, sire?\n"))
  38.     numThreads = int(raw_input("How many threads, sire?\n"))
  39. except:
  40.     "Enter a valid number next time, sire."
  41.     raw_input()
  42.     exit(0)
  43.  
  44. for i in range(0, numThreads):
  45.     thread.start_new_thread(Everything, ())
  46.  
  47. Everything()
  48. endall()
RAW Paste Data
Top