FastAPI middleware that purposely delays incoming connections on unused routes
Project description
FastAPI Tarpit
FastAPI middleware that purposely delays incoming connections on unused routes.
Definition of a tarpit from Wikipedia:
A tarpit is a service on a computer system (usually a server) that purposely delays incoming connections. The technique was developed as a defense against a computer worm, and the idea is that network abuses such as spamming or broad scanning are less effective, and therefore less attractive, if they take too long. The concept is analogous with a tar pit, in which animals can get bogged down and slowly sink under the surface, like in a swamp.
Installation
Install the package using pip:
pip install fastapi-tarpit
Usage
from fastapi import FastAPI
from fastapi_tarpit import HTTPTarpitMiddleware
app = FastAPI()
app.add_middleware(HTTPTarpitMiddleware)
@app.get("/foo")
async def foobar():
return {"foo": "bar"}
The code above triggers the tarpit on any other routes than /foo, and
routes related to docs.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fastapi_tarpit-1.0.1.tar.gz.
File metadata
- Download URL: fastapi_tarpit-1.0.1.tar.gz
- Upload date:
- Size: 4.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
69acc62b5964d091cd5570caa4f5d4feb68dac6e57ada4c3585cf46c40121fd7
|
|
| MD5 |
30fb45d56c9970d1c69eda9cfad0155d
|
|
| BLAKE2b-256 |
8720ea2114ff9e6f927549b975a592193b409496ddaf62cf16b88c6d390cfbcc
|
File details
Details for the file fastapi_tarpit-1.0.1-py3-none-any.whl.
File metadata
- Download URL: fastapi_tarpit-1.0.1-py3-none-any.whl
- Upload date:
- Size: 4.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f0a012c13226972982e0aa04a488a51835ff7880a0687544d1d4c7f54315bc27
|
|
| MD5 |
10c8d9c7a2acf567cc1282ce41b163bb
|
|
| BLAKE2b-256 |
fd1f0938f3e6840a9bad15d839af0cc1b16b48e6ce911adf01b7ae3a8827e6d8
|