From 894e2025427a0639267ff327f6743d6fb7db3b57 Mon Sep 17 00:00:00 2001 From: ultimateplayer1999 Date: Thu, 26 Jun 2025 11:15:04 +0200 Subject: [PATCH] README update --- README.md | 44 +++++++++++++++++++++++++++++++++----------- 1 file changed, 33 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 3f6ae2f..519a593 100644 --- a/README.md +++ b/README.md @@ -3,43 +3,65 @@ This adds all Crowdsec blocked IPs to the local Bitninja blocklist. Requirements This needs some dependencies, these are mongoDB and dotenv. This can be installed with: --- MongoDB: -`go get go.mongodb.org/mongo-driver/mongo` +``` +go get go.mongodb.org/mongo-driver/mongo +``` --- Dotenv: -`go get github.com/joho/godotenv` +``` +go get github.com/joho/godotenv +``` To get it working, copy example.env to .env and change the values when needed. Otherwise it uses the default. To run it, you can use `go run main list` to receive all active bans. To build a local executable, you can use -`go build -o bitninja-manager main.go` +``` +go build -o bitninja-manager main.go +``` to build it as bitninja-manager The available commands are: Receive all currently banned IPs (logged): -`go run main.go list` +``` +go run main.go list +``` Get stats: -`go run main.go stats` +``` +go run main.go stats +``` Manually cleanup expired bans (soft delete): -`go run main.go cleanup` +``` +go run main.go cleanup +``` Remove old records from DB (thirty days): -`go run main.go purge 30` +``` +go run main.go purge 30 +``` For more days to keep, you can change 30 to like 60: -`go run main.go purge 60` +``` +go run main.go purge 60 +``` Manually ban/Add a IP: -`go run main.go add 192.168.1.100 24h "Brute force attack" '{"severity":"high","source":"fail2ban"}'` +``` +go run main.go add 192.168.1.100 24h "Brute force attack" '{"severity":"high","source":"fail2ban"}' +``` Perma ban IP: -`go run main.go add 192.168.1.102 permanent "Serious threat" '{"threat_level":"critical"}'` +``` +go run main.go add 192.168.1.102 permanent "Serious threat" '{"threat_level":"critical"}' +``` Manually unban a IP: -`go run main.go del 192.168.1.100` +``` +go run main.go del 192.168.1.100 +``` IP is ofcourse a dummy and go run main.go can be replaced with the binary like: `./bitninja-manager` for the local directory