Tarpitd.py is a daemon that implements various response patterns to emulate common internet services, designed to disrupt client activities by slowing them down or causing crashes.
This lightweight, single-file Python program is built for low resource consumption. Its primary goal is to deter malicious or misbehaving clients by intentionally decelerating their interactions.
Note: Tarpitd.py requires Python 3.11 or higher!
To get started, simply download the script and run it:
wget --output-document tarpitd.py \
https://github.com/ImBearChild/tarpitd.py/raw/main/src/tarpitd.py
python ./tarpitd.py -s ssh_trans_hold:0.0.0.0:2222The above command starts an ssh tarpit on your host, listening on port 2222. Try connecting to it with your ssh client, and watch it get stuck.
You don't have to run pip install or clone any repositories—just download the tarpitd.py script and place it wherever you prefer.
To use it as an executable, move the script to a directory listed in your $PATH (commonly /usr/local/bin or ~/.local/bin) and mark it as executable:
chmod +x tarpitd.pyIf you’d rather install it via pip, you can do so with:
python -m pip install git+https://github.com/ImBearChild/tarpitd.py.git@mainFor detailed usage information, please refer to our online document and manual pages (tarpitd.py.1, tarpitd.conf.5)
If you have downloaded the script, you can also view the built-in manual by executing:
python tarpitd.py --manualAlternatively, open the script in any text editor to view the embedded manual text directly.
Tarpitd.py is designed for easy modification—simply edit the single script file. Contributions are welcome.
To run the tests, execute:
python -m unittest discover -vb -s ./srcTo update the embedded docs after making changes:
python misc/insert_doc.pyFor better experience, you can use hatch:
hatch run tarpitd.py # Run in development environment
hatch test # Run pytest instead of plain unittest
hatch run docs:serve # Serve mkdocs