You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

47 lines
1.8 KiB

10 years ago
10 years ago
10 years ago
  1. #!/bin/bash
  2. #
  3. # This script assumes a linux environment
  4. TEMPFILE=/tmp/umatrix-asset
  5. echo "*** µMatrix: updating remote assets..."
  6. THIRDPARTY_REMOTEURLS=(
  7. 'http://mirror1.malwaredomains.com/files/immortal_domains.txt'
  8. 'http://mirror1.malwaredomains.com/files/justdomains'
  9. 'http://pgl.yoyo.org/adservers/serverlist.php?hostformat=hosts&showintro=1&startdate%5Bday%5D=&startdate%5Bmonth%5D=&startdate%5Byear%5D=&mimetype=plaintext'
  10. 'http://www.malwaredomainlist.com/hostslist/hosts.txt'
  11. 'http://hosts-file.net/.%5Cad_servers.txt'
  12. 'http://someonewhocares.org/hosts/hosts'
  13. 'http://winhelp2002.mvps.org/hosts.txt'
  14. 'http://publicsuffix.org/list/effective_tld_names.dat'
  15. )
  16. THIRDPARTY_LOCALURLS=(
  17. 'assets/thirdparties/mirror1.malwaredomains.com/files/immortal_domains.txt'
  18. 'assets/thirdparties/mirror1.malwaredomains.com/files/justdomains'
  19. 'assets/thirdparties/pgl.yoyo.org/as/serverlist'
  20. 'assets/thirdparties/www.malwaredomainlist.com/hostslist/hosts.txt'
  21. 'assets/thirdparties/hosts-file.net/ad-servers'
  22. 'assets/thirdparties/someonewhocares.org/hosts/hosts'
  23. 'assets/thirdparties/winhelp2002.mvps.org/hosts.txt'
  24. 'assets/thirdparties/publicsuffix.org/list/effective_tld_names.dat'
  25. )
  26. ENTRY_INDEX=0
  27. for THIRDPARTY_REMOTEURL in ${THIRDPARTY_REMOTEURLS[@]}; do
  28. THIRDPARTY_LOCALURL=${THIRDPARTY_LOCALURLS[ENTRY_INDEX]}
  29. echo "*** Downloading" $THIRDPARTY_REMOTEURL
  30. if wget -q -T 30 -O $TEMPFILE -- $THIRDPARTY_REMOTEURL; then
  31. if [ -s $TEMPFILE ]; then
  32. if ! cmp -s $TEMPFILE $THIRDPARTY_LOCALURL; then
  33. echo " New version found: $THIRDPARTY_LOCALURL"
  34. if [ "$1" != "dry" ]; then
  35. mv $TEMPFILE $THIRDPARTY_LOCALURL
  36. fi
  37. fi
  38. fi
  39. fi
  40. let ENTRY_INDEX+=1
  41. done