Last active
May 24, 2018 13:00
-
-
Save Arano-kai/dff397ecaa8d25c500536272cc4ae418 to your computer and use it in GitHub Desktop.
Get ESET servers list
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/sh | |
# Gather and print to stdout ESET servers | |
# from `*.txt' at https://support.eset.com/kb332/ | |
# Output of this script intent to use with `dstdomain` directive of squid proxy | |
#Grab all `.txt' links. | |
#sed jobs: | |
# - exclude all but value of `href' attr | |
# - remove non-`.txt' links | |
# - encode spaces | |
url_list=$( | |
curl -s -f -L -o - -- "https://support.eset.com/kb332/" \ | |
| sed -E \ | |
-e 's%^.+href="([^"]+)".+$%https://support.eset.com\1%' \ | |
-e '/\.txt$/!d' \ | |
-e 's/ /%20/g' \ | |
) | |
#Print content at each link | |
#sed jobs: | |
# - convert DOS->UNIX | |
# - add source for each chunk | |
# - comment out lines, that is not domain nor IP | |
# - add NL at end of chunk | |
for url in ${url_list}; do | |
curl -s -f -L -o - -- "${url}" \ | |
| sed -E \ | |
-e 's/\r$//' \ | |
-e "1s~^~#From ${url}:\n~" \ | |
-e '/.*\..*\./!s/^[^#].*$/#&/' \ | |
-e '$a\' | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment