kayo77

AntyHazard4Bind

Jun 23rd, 2017
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.07 KB | None | 0 0
  1. #!/bin/bash
  2. curl -k --silent -H "Accept: application/xml" -H "Content-Type: application/xml" -X GET https://hazard.mf.gov.pl/api/Register | \
  3.     grep "AdresDomeny" | awk -F "<AdresDomeny>" '{print "zone \""$2}' | \
  4.     awk -F"</AdresDomeny>" '{print $1"\" {type master; file \"/etc/bind/hazard.hosts\";};" }' > /tmp/hazard.zones
  5. named-checkzone /tmp/hazard.zones /etc/bind/hazard.hosts
  6. if [ $? -eq 0 ]
  7. then
  8.     cp -u --preserve=mode,ownership /tmp/hazard.zones /etc/bind/hazard.zones
  9.     rndc reload
  10.     rm /tmp/hazard.zones
  11. else
  12.     echo "ERROR hazard!"
  13. fi
  14. curl -sS http://malware-domains.com/files/spywaredomains.zones.zip > spywaredomains.zones.zip && unzip -o spywaredomains.zones.zip -d /tmp && rm spywaredomains.zones.zip
  15. cat /tmp/spywaredomains.zones | grep master > /tmp/spywaredomains2.zones
  16. named-checkzone /tmp/spywaredomains2.zones /etc/bind/blockeddomain.hosts
  17. if [ $? -eq 0 ]
  18. then
  19.     cp -u --preserve=mode,ownership /tmp/spywaredomains2.zones /etc/bind/spywaredomains.zones
  20.     rndc reload
  21.     rm /tmp/spywaredomains.zones
  22. else
  23.     echo "ERROR spywarezone!"
  24. fi
Advertisement
Add Comment
Please, Sign In to add comment