mirror of
https://github.com/JG-ServerSP/abuseIPDB-monitor.git
synced 2026-04-26 09:35:50 +03:00
No description
This update introduces a logging mechanism to record the date and time of the last IP block and individual IP check. The logs are saved in the file specified by the LOG_FILE variable (default: /root/last_check.log). This addition helps track the script's monitoring activity over time. |
||
|---|---|---|
| monitor_ips_abuseipdb.py | ||
| README.md | ||
| requirements.txt | ||
AbuseIPDB Monitor Script
This script monitors specified IP blocks for abuse reports using the AbuseIPDB API and sends notifications via Pushover when an IP is listed with a new or higher score.
Prerequisites
- Python 3.7 or later
- Dependencies:
requestsipaddress
- API Keys:
- AbuseIPDB API Key
- Pushover User Key
- Pushover App Token
Installation
-
Clone the Repository:
git clone https://github.com/juniorrrrr/abuseipdb-monitor.git cd abuseipdb-monitor -
Set up a Python Virtual Environment:
python3 -m venv venv source venv/bin/activate -
Install Dependencies:
pip install -r requirements.txt -
Configure the Script:
- Open the script file
monitor_ips_abuseipdb.py. - Replace the placeholders with your actual API keys:
ABUSEIPDB_API_KEY = "your_abuseipdb_api_key" PUSHOVER_USER_KEY = "your_pushover_user_key" PUSHOVER_API_TOKEN = "your_pushover_app_token"
- Open the script file
-
Specify IP Blocks to Monitor:
- Update the
BLOCKSvariable in the script with the IP ranges you want to monitor:BLOCKS = [ "192.168.0.0/24", "10.0.0.0/24" ]
- Update the
Running the Script
-
Activate the Virtual Environment:
source venv/bin/activate -
Run the Script:
python monitor_ips_abuseipdb.py
Automating with Cron (Optional)
-
Edit Cron Jobs:
crontab -e -
Add the Following Entry:
0 13 * * * /path/to/venv/bin/python /path/to/monitor_ips_abuseipdb.py >> /path/to/monitor.log 2>&1- This example runs the script daily at 1 PM.
Logs
Logs will be saved in the specified log file (e.g., monitor.log) if configured in the cron job.
Notes
- Ensure the
notified_ips.jsonfile is writable by the script. This file stores previously notified IPs to avoid duplicate notifications. - Be mindful of AbuseIPDB API rate limits when monitoring large blocks of IPs.