A simple pastebin monitor using the scraping API (and now updated for the new scraping URL)
Simple Pastebin Monitor is a simple Python script that replicates and and extends Pastebin alerts. It makes use of the Pastebin Scraping API as described here. You'll need a Pastebin PRO account to get access to the Scraping API.
The script takes three parameters, you need to specify all or none:
- The name and location of the file containing the keywords to check (default is ./keywords.txt)
- The directory to save the pastes into (default is .)
- Whether to check for the pastebin message that your IP is not authorized or not (default is false)
The script will check Pastebin for pastes every minute and compare their text against the supplied keywords. When there is a match the text of the paste is saved to the output directory (in a directory with the name of the matched keyword). This is an improvement over the built in Pastebin alerts which only saves a link which means you miss removed pastes if you don't click the link before they are taken down.
Running the script can be done in a screen / tmux or by using the built docker image. The machine where you run needs to be have its IP whitelisted in your Pastebin account. Pre-requisites are really just Python 3, Requests, a Pastebin PRO account and an internet connection.
There are various To Dos are described in issues on GitHub but these are probably a way off.
I wrote about about this code on my blog
A Containerized version can be found on Docker Hub
The container needs two vols mounting for output and input (containing a keywords.txt of things to search for). There is a sample of the keywords.txt on GitHub but it is a simple CR separated list.
A simple docker run command looks like:
docker run -d --name simple-pastebin-monitor -v /path/to/dir-containing-keywords.txt:/input -v /path/to/store-pastes:/output mikewilks/simple-pastebin-monitor
This is an automated build from a GitHub repo