Skip to content

jvidal-sysadmin/bash-scripts

Repository files navigation

bash-scripts

My bash scripts collection I use daily.

amazon_get_prefixes.sh

Basicly, get amazon prefixes what you need parsing REGION and SERVICE using JQ inspired by this article.

Simple example:

root@aux:~/jvidal-bash-scripts# ./amazon_get_prefixes.sh us-west-2 ROUTE53
"54.244.52.192/26"
"54.245.168.0/26"

Batch example:

root@aux:~/jvidal-bash-scripts$ ./amazon_get_prefixes.sh us-west-2 ROUTE53 | while read LINE; do iptables -I INPUT -s "$LINE" -j DROP && echo "IP $LINE will be dropped now!"; done
IP 54.244.52.192/26 will be dropped now!
IP 54.245.168.0/26 will be dropped now!

root@aux:~/jvidal-bash-scripts$ iptables -L -v -n | grep 54.244.52.192
    0     0 DROP       all  --  *      *       54.244.52.192/26     0.0.0.0/0

About

My bash scripts collection I use daily.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages