Skip to content

Instantly share code, notes, and snippets.

@cyamax
Created June 26, 2018 13:32
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 cyamax/aa6d9b7937415a29332f393aaa4362d6 to your computer and use it in GitHub Desktop.
Save cyamax/aa6d9b7937415a29332f393aaa4362d6 to your computer and use it in GitHub Desktop.
指定したipがブラックリスト(SPAMHAUS)に載ったらメールを送る
#!/bin/bash
## ここのIPは逆に記入してください
### 例:192.168.1.10 → 10.1.168.192 とする
search_ip="ここにIPを逆順でいれる"
result=$(dig +short ${search_ip}.zen.spamhaus.org)
## デバッグ用
#result=$(dig ${search_ip}.zen.spamhaus.org)
if test "$result" != "";then
echo "ip is spam!"
echo "check spamhaus! https://www.spamhaus.org/lookup/ " | mail -s "IP is DEAD! " 宛先@アドレス
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment