kayo77

AntyHazard4Bind v2

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