Report IPs to AbuseIPDB directly from the shell
I created this script with the only purpose of submitting an IP address to the AbuseIPDB database directly from the shell but in a "guided" way with a pseudo-graphical interface (provided by Dialog).
It makes a POST request to the AbuseIPDB REPORT Endpoint. As simple as that. You can find the API documentation here.
-
An AbuseIPDB API key, it's free. If you have an account already, you can create your API key from your dashboard.
-
The graphical interface is provided by Dialog, so you will need to install it to make this script work.
- Make sure Dialog is available on your system by running:
dialog --version
If not, you can install it by following the instructions in the next chapter
- Download ipdbrep.sh from the main branch to your local machine:
wget https://raw.githubusercontent.com/EarlyOwl/ipdbrep.sh/main/ipdbrep.sh
- Make it executable:
chmod +x ipdbrep.sh
- Run the script with:
./ipdbrep.sh
or, if you want every request output to be saved on a txt file and not only displayed on the screen:
./ipdbrep.sh save
That's it. Note that you will be prompted for your API key each time you execute the script. If you want to avoid this behavior, you can save your API key in a file named api.txt in the script's working directory.
If you want to test the script, as per documentation, you can simply report 127.0.0.1. The output should be similar to this:
{
"data": {
"ipAddress": "127.0.0.1",
"abuseConfidenceScore": 0
}
}
If Dialog is not present on your machine, you can run those commands based on your current OS / distro to install it:
sudo apt-get update
sudo apt-get install dialog
sudo yum install dialog
Install it via HomeBrew by running:
brew install dialog
Yes and yes.
You can find them here.
I'm eager to learn, open an issue or a pull request to suggest an improvement / fix.