| 1 | #!/bin/bash |
| 2 | # spam-lookup.sh: Look up abuse contact to report a spammer. |
| 3 | # Thanks, Michael Zick. |
| 4 | |
| 5 | # Check for command-line arg. |
| 6 | ARGCOUNT=1 |
| 7 | E_WRONGARGS=85 |
| 8 | if [ $# -ne "$ARGCOUNT" ] |
| 9 | then |
| 10 | echo "Usage: `basename $0` domain-name" |
| 11 | exit $E_WRONGARGS |
| 12 | fi |
| 13 | |
| 14 | |
| 15 | dig +short $1.contacts.abuse.net -c in -t txt |
| 16 | # Also try: |
| 17 | # dig +nssearch $1 |
| 18 | # Tries to find "authoritative name servers" and display SOA records. |
| 19 | |
| 20 | # The following also works: |
| 21 | # whois -h whois.abuse.net $1 |
| 22 | # ^^ ^^^^^^^^^^^^^^^ Specify host. |
| 23 | # Can even lookup multiple spammers with this, i.e." |
| 24 | # whois -h whois.abuse.net $spamdomain1 $spamdomain2 . . . |
| 25 | |
| 26 | |
| 27 | # Exercise: |
| 28 | # -------- |
| 29 | # Expand the functionality of this script |
| 30 | #+ so that it automatically e-mails a notification |
| 31 | #+ to the responsible ISP's contact address(es). |
| 32 | # Hint: use the "mail" command. |
| 33 | |
| 34 | exit $? |
| 35 | |
| 36 | # spam-lookup.sh chinatietong.com |
| 37 | # A known spam domain. |
| 38 | |
| 39 | # "[email protected]" |
| 40 | # "[email protected]" |
| 41 | # "[email protected]" |
| 42 | |
| 43 | |
| 44 | # For a more elaborate version of this script, |
| 45 | #+ see the SpamViz home page, http://www.spamviz.net/index.html. |