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.

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