Advertisement
K-Metal

Chargen Ampliication filter

May 9th, 2015
694
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.88 KB | None | 0 0
  1. #by K-Metal
  2. # a small change from my ssdp filter
  3.  
  4. import socket, sys, os, random
  5. s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
  6. alp = ["a","b","c","d","e","f"]
  7.  
  8. if len(sys.argv) < 2:
  9.     print "Usage: <input> <output> <size>"
  10.     sys.exit()
  11.  
  12. file1 = sys.argv[1]
  13. file2 = sys.argv[2]
  14. size = int(sys.argv[3])
  15.  
  16. with open(file1) as f:
  17.     list = f.read().splitlines()
  18. s.settimeout(0.05)
  19. newfile = open(file2, "w")
  20. c = 0
  21.  
  22. while c < len(list):
  23.     choice = random.randint(0,5)
  24.     a = str(list[c])
  25.     s.sendto(alp[choice], (a.split(' ', 1)[0], 19))
  26.     try:
  27.         conn, addr = s.recvfrom(65535)
  28.         amp = int(len(conn)) / 43
  29.         if int(len(conn)) >= size:
  30.             print str(addr[0])+" "+str(len(conn))+" [x"+str(amp)+"]"
  31.             newfile.write(str(addr[0])+" "+str(len(conn))+"\n")
  32.     except socket.timeout and socket.error:
  33.         i = 0
  34.     c = c + 1
  35. newfile.close()
  36. os.system("chmod 0777 %s" % file2)
  37. print "Finished"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement