
Pythonic AI crawler tarpit
Pyison is a tarpit for AI webcrawlers
Clone this project to a local folder
Change settings in the config/config.json file
random-seed to a random number!port number for the server to use(Optional but recommended) Update the HTML template, CSS, images, and robots.txt to your liking
(Optional) Edit the robots.txt if you want to change which bots are affected
Set up the server environment with any of the methods below
Put the server behind a Reverse Proxy
pip install nltkpython3 src/server.pyhttp://localhost:<your port number> in a browserIt is highly recommended that you use a reverse proxy to serve this content. It can reduce server load by caching pages and introducing ratelimits, as well as serve the content over https and protect from some basic webserver exploits.
User-Agent http header from NPM to the Pyison server without any special configuration. Use proxy_pass_header User-Agent; if needed.Select the following settings in the UI, or enter the equivalent settings in the configuration file:
tarpit.example.comhttplocalhost, or the name of the docker container if using a docker network80)Cache Assets and Block Common Exploits, but not Websockets SupportTo use Pyison in a sub-path, use the following location configuration
# Handles the root page ("example.com/tarpit")
location /tarpit {
proxy_pass http://localhost:80;
}
# Handles all sub-pages ("example.com/tarpit/a" and "example.com/tarpit/a/b")
location /tarpit/ {
proxy_pass http://localhost:80;
}
# Handles all urls with a 3-letter file extension ("example.com/tarpit/style.css" and "example.com/tarpit/images/picture.jpg")
# Note that the ~ denotes regex matching. The string immediately following it must be a valid regex statement.
location ~ .*\/tarpit\/.*\....$ {
proxy_pass http://localhost:80;
}
Here is a working setup using the UI:
/tarpit, has no custom configuration. It will behave like the first location block defined above./tarpit/, contains the second and third location blocks defined abovetarpit with the desired root path.
/tar/pit, note that the third location block uses regex, so any slashes must be escaped with a backslash
port (default 80)
random-seed (Please change this!)
document-root (default "/")
https://example.com/pyison/ or /pyison/fake-image-dir (default ["images"])
fake-css-dir (default ["css"])
spacing-characters (default ["_","-","%20"])
{HOME}
{TITLE}
/blog/about/once-upon-a-time -> Once Upon A Time{UPTITLE}
{MAIN}
{UP}
/blog/about/once-upon-a-time -> /blog/about
Here is a sample of how the site looks before any editing of the template:

services:
pyison:
image: "ghcr.io/jonaslong/pyison:main"
container_name: pyison
tty: true
ports:
- 80:80
docker compose up
-d flag to detach from the containerdocker run --tty --name pyison -p "127.0.0.1:80:80" --rm ghcr.io/jonaslong/pyison:main
--rm flag to persist the containerdocker build -t pyison:latest .docker run --tty --name pyison -p "127.0.0.1:80:80" --rm pyison:latest/tar/pitlocation ~ .*\/tar\/pit\/.*\....$document-root setting with the sub-path used by the proxy (see the Configuration section)unsafe-characters (default ["'","`"])
robots-txt (default "assets/robots.txt")
/robots.txthtml-templates (default ["assets/template.html"])
css-files (default ["assets/style.css"])
images
ico (default ["assets/logo.ico"])jpg (default ["assets/logo.jpg"])png (default["assets/logo.png"])remove-from-stop-words
{CSSLINK}
/styles) can be set in the config{WORD}
{NAME}
{SENTENCE}
{PIC}
/images) can be set in the config{LINK}
/dressage/electrochronometer/himself-she-eciliate{OVER}
/neighborliness/wont_unhonest, an {OVER} tag might be replaced with /neighborliness/hooliganism{NEWTITLE}
Nectarial Electrofusion Which Dephosphorization{LINK} or {OVER} tag, the title and url will be synced
<a href="https://github.com/jonaslong/pyison/blob/main/%7BOVER%7D">{NEWTITLE}</a> might be replaced with <a href="https://github.com/jonaslong/pyison/blob/main/swordmanship/yeller/over-will-oghuz">Over Will Oghuz</a>{NEWTITLE} tag will search backwards for the closest {LINK} or {OVER} tag to sync with.
{LINK} or {OVER} tag is immediately followed by its tag, if a is desired{NEWTITLE}{NEWTITLE}