Skip to content

Instantly share code, notes, and snippets.

@marzn
Created October 27, 2017 11:44
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 marzn/ede883a7213a40fba7658a03a6b44017 to your computer and use it in GitHub Desktop.
Save marzn/ede883a7213a40fba7658a03a6b44017 to your computer and use it in GitHub Desktop.
Create filterlist for fail2ban / samba / ransomware
#!/bin/sh
wget https://fsrm.experiant.ca/api/v1/combined
sed 's/^.*"filters":\["//g; s/"\]}$//g; s/","/\n/g; s/ /\\ /g; s/\./\\./g; s/\#/\\#/g; s/\+/\\+/g; s/\-/\\-/g; s/\;/\\;/g; s/\~/\\~/g; s/\!/\\!/g; s/\$/\\$/g; s/\@/\\@/g; s/\[/\\[/g; s/\]/\\]/g; s/\*/\.*/g;' combined > samba.conf
sed -i 's/^\.\*//; s/^/ smbd.*\\:\\ IP=<HOST>\\|.*/; s/$/\$/;' samba.conf
CONTENT=`cat samba.conf`
echo -e "[Definition]\nfailregex =${CONTENT}\n\nignoreregex = \n" > samba.conf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment