Generates a host list of first-party trackers for ad-blocking.
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.

57 lines
2.9 KiB

2 years ago
2 years ago
  1. #!/usr/bin/env bash
  2. function log() {
  3. echo -e "\033[33m$@\033[0m"
  4. }
  5. log "Exporting lists…"
  6. ./export.py --first-party --output dist/firstparty-trackers.txt
  7. ./export.py --first-party --end-chain --output dist/firstparty-only-trackers.txt
  8. ./export.py --output dist/multiparty-trackers.txt
  9. ./export.py --end-chain --output dist/multiparty-only-trackers.txt
  10. log "Generating hosts lists…"
  11. function generate_hosts {
  12. basename="$1"
  13. description="$2"
  14. description2="$3"
  15. (
  16. echo "# First-party trackers host list"
  17. echo "# $description"
  18. echo "# $description2"
  19. echo "#"
  20. echo "# About first-party trackers: https://git.frogeye.fr/geoffrey/eulaurarien#whats-a-first-party-tracker"
  21. echo "# Source code: https://git.frogeye.fr/geoffrey/eulaurarien"
  22. echo "#"
  23. echo "# In case of false positives/negatives, or any other question,"
  24. echo "# contact me the way you like: https://geoffrey.frogeye.fr"
  25. echo "#"
  26. echo "# Latest version:"
  27. echo "# - First-party trackers : https://hostfiles.frogeye.fr/firstparty-trackers-hosts.txt"
  28. echo "# - … excluding redirected: https://hostfiles.frogeye.fr/firstparty-only-trackers-hosts.txt"
  29. echo "# - First and third party : https://hostfiles.frogeye.fr/multiparty-trackers-hosts.txt"
  30. echo "# - … excluding redirected: https://hostfiles.frogeye.fr/multiparty-only-trackers-hosts.txt"
  31. echo '# (you can remove `-hosts` to get the raw list)'
  32. echo "#"
  33. echo "# Generation date: $(date -Isec)"
  34. echo "# Generation software: eulaurarien $(git describe --tags)"
  35. echo "# Number of source websites: TODO"
  36. echo "# Number of source subdomains: TODO"
  37. echo "#"
  38. echo "# Number of known first-party trackers: TODO"
  39. echo "# Number of first-party subdomains: $(wc -l dist/firstparty-trackers.txt | cut -d' ' -f1)"
  40. echo "# … excluding redirected: $(wc -l dist/firstparty-only-trackers.txt | cut -d' ' -f1)"
  41. echo "#"
  42. echo "# Number of known multi-party trackers: TODO"
  43. echo "# Number of multi-party subdomains: $(wc -l dist/multiparty-trackers.txt | cut -d' ' -f1)"
  44. echo "# … excluding redirected: $(wc -l dist/multiparty-only-trackers.txt | cut -d' ' -f1)"
  45. echo
  46. sed 's|^|0.0.0.0 |' "dist/$basename.txt"
  47. ) > "dist/$basename-hosts.txt"
  48. }
  49. generate_hosts "firstparty-trackers" "Generated from a curated list of first-party trackers" ""
  50. generate_hosts "firstparty-only-trackers" "Generated from a curated list of first-party trackers" "Only contain the first chain of redirection."
  51. generate_hosts "multiparty-trackers" "Generated from known third-party trackers." "Also contains trackers used as third-party."
  52. generate_hosts "multiparty-only-trackers" "Generated from known third-party trackers." "Do not contain trackers used in third-party. Use in combination with third-party lists."