ip-malicious-db
is a Go service designed to load and manage malicious IPs and IP ranges by country. The service retrieves IP data from GitHub, specifically the FireHOL IP blocklists, and stores it in a Neo4j database as nodes with the fields id
(IP address) and country
(ISO 3166-1 alpha-2 country code).
- ποΈ Fetches and stores malicious IPs and IP ranges categorized by country.
- π Retrieves data from the FireHOL blocklist IPsets.
- π’οΈ Persists the data in a Neo4j database for advanced querying and integration.
- π¦ Provides a REST endpoint to load data into the database.
-
Clone the repository:
git clone https://github.com/your-username/ip-malicious-db.git cd ip-malicious-db
-
Set up Neo4j:
- Install Neo4j: Neo4j Installation Guide
- Start the Neo4j database:
neo4j start
- Configure the database credentials in your environment:
export NEO4J_URI="bolt://localhost:7687" export NEO4J_USER="neo4j" export NEO4J_PASSWORD="your_password"
-
Build the service:
go build -o ip-malicious-db ./cmd
-
Run the service:
./ip-malicious-db
The service exposes a REST endpoint to fetch and load malicious IPs into the database.
Fetches malicious IP data for all countries from GitHub and stores it in Neo4j.
curl -X POST http://localhost:8080/save-malicious-ip
- Nodes:
IP
nodes:- Fields:
id
: Represents the IP address or IP range (primary key).country
: Represents the ISO 3166-1 alpha-2 code of the country.
- Fields:
There are no relationships between the nodes.
MATCH (ip:IP)
RETURN ip.id
MATCH (ip:IP {country: "us"})
RETURN ip.id
- Fetch Data:
- Downloads IP blocklist data for each country from the FireHOL blocklist IPsets.
- Store in Neo4j:
- Creates
IP
nodes for each malicious IP or range, with the fields:id
: IP address.country
: Country code.
- Creates
- π Additional REST API endpoints for querying malicious IPs.
- π Analytics and visualization for malicious IP trends.
- π‘οΈ Integration with real-time threat detection tools.
Contributions are welcome! Please fork the repository, create a feature branch, and submit a pull request.
This project is licensed under the Apache License. See the LICENSE file for details.
Special thanks to the FireHOL project for providing the data that powers this service and to the Neo4j community for their database technology.