ZeroHour
Lobsters · securitypublished ()ingested blog.mbirth.uk via edent1

Bulk AbuseIPDB reporting using command-line tools

infoToolsimportance 12
AI summary · glm-5.3-flash

A blogger shows how to bulk-report distributed botnet IPs scraping a self-hosted Gitea instance to AbuseIPDB using bash, awk, and jq.

The author's self-hosted Gitea instance was scraped by distributed bots using random IPs worldwide and randomized, often nonexistent User-Agent strings, generating heavy request load for days. The write-up demonstrates filtering Traefik access logs (CLF and JSON) with grep, awk, and jq to extract offending IPs, tagging them with AbuseIPDB category 19 (Bad Web Bot), deduplicating them, and building a CSV for the Bulk Reporter tool. Reports can then be submitted through the AbuseIPDB bulk-report API, respecting the 5,000-report daily limit.

  • Distributed bots with random IPs and fake User-Agents scraped every URL and sort variant for days.
  • Bash, grep, awk, and jq pipeline filters Traefik logs for HTTP 302 responses with sort= parameters.
  • AbuseIPDB category 19 (Bad Web Bot) is applied before deduplicated bulk submission via API.
  • A JSON log variant uses jq to select entries and cap reports at the daily 5,000 limit.
Full article529 words · extracted from blog.mbirth.uk · click to collapse

Some botnet is scraping my local Gitea instance by requesting every single URL possible. Even the same table is queried in every variation possible: sorted ascending, sorted descending, sorted by second column ascending, sorted by second column descending, and so on. This creates unnecessary load on the server and traffic on the line.

Almost every single request is coming from a random IP address from all over the world. Also, they’re all using randomised User-Agent strings – many of which don’t even exist. A few years ago, this would have been classed as a DDoS attack.

A user on Hacker News pointed me to https://www.abuseipdb.com/ – a website similar to spamcop.net, but where you can report IP addresses instead of email addresses.

With a little command-line magic, I was able to create a CSV file for their Bulk Reporter tool:

echo "IP,Categories,ReportDate,Comment" > /tmp/abuseipdb.csv
cat access.log \
| grep " 302 " | grep "sort=" \
| awk '{print $1",\
\"19\",\
\""substr($4, 2), substr($5, 0, length($5)-1)"\",\
\"Distributed parallel HTTP scraping from random IPs with random user-agents\""}' \
| sort -t, -k1,1 -u >> /tmp/abuseipdb.csvCode language: Bash (bash)

This filters my Traefik access.log for lines with a HTTP 302 redirect (which I’ve setup temporarily – however, the bots are still requesting URLs that aren’t there for 3 days now) and sort= in the URL – which is the parameter for the mentioned sort variations.

Once filtered, awk prints the first field (IP address), followed by "19" which is AbuseIPDB’s code for Bad Web Bot. It then cuts 2 characters off the fourth field followed by the fifth field with the last character cut off. Traefik logs time stamps in the form [30/Aug/2026:20:00:00 +0000] and awk sees this with a leading space, so this makes sure the square brackets are gone.

(Also, I’ve tested that the time string is properly parsed by strtotime().)

Finally it’s putting out the comment/reason for the report.

This is then run through sort with a comma as separator and field 1 (and only field 1) as the key to be made unique, i.e. duplicate IP addresses will be omitted.

The final result is then output into the file /tmp/abuseipdb.csv – ready to be uploaded to the site. Or pushed via their API:

curl https://api.abuseipdb.com/api/v2/bulk-report -F csv=@/tmp/abuseipdb.csv -H "Key: API_KEY"Code language: JavaScript (javascript)

JSON instead of CLF

I’ve recently switched my Traefik to JSON logs so I have more details like requested hostname and HTTP headers. To prepare this for submission, the tool jq comes in handy:

echo "IP,Categories,ReportDate,Comment" > /tmp/abuseipdb.csv
jq -r 'select(.DownstreamStatus == 302)
        | select((.RequestPath | contains("sort=")) or (.RequestPath | contains("blame")))
        | [.ClientHost, "19", .time, "Distributed parallel HTTP scraping from random IPs with random user-agents"]
        | @csv' access.log \
    | tail -n 5000 \
    | sort -t, -k1,1 -u >> /tmp/abuseipdb.csvCode language: Bash (bash)

This selects log entries with HTTP 302 and either sort= or blame in their requested URL. It then only takes the latest 5000 requests (my daily report limit at AbuseIPDB), makes sure the IPs are unique and writes the CSV file.

Text extracted automatically; images, tables and formatting may be missing. Original: https://blog.mbirth.uk/2026/08/30/bulk-abuseipdb-reporting-using-command-line-tools.html