Skip to content

Instantly share code, notes, and snippets.

@marios88
Created January 9, 2023 10:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marios88/2a7d5c211e8f09b89abfad1e5bce7b6c to your computer and use it in GitHub Desktop.
Save marios88/2a7d5c211e8f09b89abfad1e5bce7b6c to your computer and use it in GitHub Desktop.
Scan docker logs and ban ip v4 based on resolved RDNS
docker logs --tail 1000 docker-ahttpd-1 | grep 'sitemap-pt' | awk '{print $1}' | uniq | xargs -i sh -c 'echo -n "{} _ " && dig -x {} +short' | grep -i 'banRDNSHERE\|server\|seznam' | awk '{print $1}' | xargs -i iptables -I INPUT -s {} -j DROP
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment