/ip_country_extraction

# IP Range Extractor for MikroTik and JSON Outputs for Other Firewalls or other usage base on ripe database

Primary LanguageRouterOS Script

IP Range Extractor for MikroTik and JSON Outputs

License Python Version

Table of Contents

Introduction

The IP Range Extractor is a Python-based tool designed to download, parse, and extract IP address ranges from RIPE's alloclist.txt file for a specified country. It generates MikroTik .rsc configuration files suitable for firewall address lists and a corresponding JSON file for further processing or integrations.

Features

  • Single .rsc File: Generates a unified MikroTik .rsc file containing both IPv4 and IPv6 address lists under their respective sections.
  • JSON Output: Produces a JSON file with all extracted IP entries, including details like allocation date and organization.
  • Command-Line Interface: Accepts country codes as named arguments (e.g., --country=ir).
  • Docker Support: Provides a Dockerfile for containerizing the application, ensuring consistent environments.
  • Comprehensive Logging: Maintains detailed logs of the extraction and file generation processes for debugging and auditing.

Prerequisites

  • Python 3.6+
  • pip
  • Docker (optional, for containerization)

Installation

Clone the Repository

git clone https://github.com/vaheed/ip_country_extraction.git
cd ip_country_extraction

Build the Docker

docker build -t ip_country_extraction .

Run the Docker

docker run --rm -v $(pwd)/output:/app/output ip_country_extraction --country=ir