Skip to content

Automatically register the IP registered with AbuseIP to iptables.

License

Notifications You must be signed in to change notification settings

bsy0318/AbuseIP-AutoBan

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🚫 IP Ban Script

This script automates the process of managing IP addresses to block abusive IPs using iptables and ipset.

Python Rich

Overview

This Python script fetches a list of abusive IP addresses from AbuseIPDB and blocks them using iptables and ipset. It performs the following actions:

  • Checks for command-line arguments (reset or backup) to restore or backup iptables rules respectively.
  • Creates an ipset named blockip if it doesn't exist.
  • Adds blockip to the iptables chain INPUT to drop traffic from the listed IPs.
  • Fetches the latest IP list from the remote repository.
  • Updates the ipset with the fetched IP addresses.
  • Saves the ipset and restarts iptables.

Prerequisites

  • Python 3
  • Rich library for enhanced console output
  • Root or sudo privileges to execute iptables and ipset commands

Usage

To execute the script, run the Python file ban_bulk_ipset.py. Additionally, you can use the following command-line arguments:

  • reset: Restores the original iptables rules.
  • backup: Backs up the original iptables rules.

Note: Exercise caution while using the reset and backup options as they modify the firewall rules.

Installation

  1. Clone the repository:

    git clone https://github.com/borestad/blocklist-abuseipdb.git
  2. Install the required dependencies:

    pip install rich
  3. Execute the script:

    python ban_bulk_ipset.py

Contributions

Contributions and suggestions are welcome! Please fork the repository, make changes, and create a pull request.


Disclaimer: This script manages IP addresses and firewall rules. Use it responsibly and in compliance with your local laws and regulations.

About

Automatically register the IP registered with AbuseIP to iptables.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published