Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exclude ip ranges with addr/mask or classful notation #700

Open
wavexx opened this issue Mar 22, 2017 · 1 comment
Open

Exclude ip ranges with addr/mask or classful notation #700

wavexx opened this issue Mar 22, 2017 · 1 comment

Comments

@wavexx
Copy link
Contributor

wavexx commented Mar 22, 2017

Minor wish: it would be much more common to allow to exclude v4 ip ranges by using the addr/mask notation, or even A.B.*.* class notation.

@szepeviktor
Copy link
Contributor

szepeviktor commented Apr 22, 2017

You may use these

wget -qO- "https://www.cloudflare.com/ips-v4" \
 | xargs -n1 sipcalc | sed -n 's|^Network range\s\+- \(.\+\) - \(.\+\)$|\1-\2|p' \
 | xargs -n1 bash -c 'echo -n " --exclude-ip=$0"'

wget -qO- "https://my.pingdom.com/probes/ipv4" \
 | xargs -n1 bash -c 'echo -n " --exclude-ip=$0"'

wget -qO- "https://ip-ranges.amazonaws.com/ip-ranges.json" \
 | jq -r ".prefixes[].ip_prefix" \
 | xargs -n1 sipcalc | sed -n 's|^Network range\s\+- \(.\+\) - \(.\+\)$|\1-\2|p' \
 | xargs -n1 bash -c 'echo -n " --exclude-ip=$0"'

Complete code with caching
https://github.com/szepeviktor/debian-server-tools/blob/master/webserver/goaccess.sh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants