Skip to content

Instantly share code, notes, and snippets.

@heywoodlh
Created November 6, 2017 22:34
Show Gist options
  • Save heywoodlh/6796589b9fd0a16bc4e057f8d3620818 to your computer and use it in GitHub Desktop.
Save heywoodlh/6796589b9fd0a16bc4e057f8d3620818 to your computer and use it in GitHub Desktop.
Scripts used to grab links from a website and compare to see if they are on Amazon Web Services
#!/usr/bin/env bash
if [ "$1" == '' ]
then
echo "usage: $0 domain.com"
exit 1
fi
DOMAIN="$1"
DEPS='prips'
MYURLS="$(./linkfinder.py $DOMAIN | grep -E 'https://|http://' | sed -e 's|^[^/]*//||' -e 's|/.*$||')"
for dep in "$DEPS"
do
if ! which "$dep"
then
echo "please install $dep"
exit 1
fi
done
IP_RANGES="$(cat aws-ranges.txt)"
for range in $IP_RANGES
do
TMPRANGE="$(prips $range)"
echo "$TMPRANGE" >> iplist.txt
done
for url in "$MYURLS"
do
IP="$(dig +short $url)"
if grep "$IP" iplist.txt
then
echo "$url is hosted on AWS" >> results.txt
fi
done
echo "Results are listed in results.txt"
rm iplist.txt
13.32.0.0/15
13.52.0.0/16
13.54.0.0/15
13.56.0.0/16
13.57.0.0/16
13.58.0.0/15
13.112.0.0/14
13.124.0.0/16
13.125.0.0/16
13.126.0.0/15
13.209.0.0/16
13.210.0.0/15
13.228.0.0/15
13.230.0.0/15
13.232.0.0/14
13.236.0.0/14
13.250.0.0/15
18.144.0.0/15
18.194.0.0/15
18.196.0.0/15
18.200.0.0/16
18.216.0.0/14
18.220.0.0/14
18.231.0.0/16
18.253.0.0/16
23.20.0.0/14
27.0.0.0/22
34.192.0.0/12
34.208.0.0/12
34.224.0.0/12
34.240.0.0/13
34.248.0.0/13
35.153.0.0/16
35.154.0.0/16
35.155.0.0/16
35.156.0.0/14
35.160.0.0/13
35.168.0.0/13
35.176.0.0/15
35.178.0.0/15
35.180.0.0/15
35.182.0.0/15
43.250.192.0/24
43.250.193.0/24
46.51.128.0/18
46.51.192.0/20
46.51.216.0/21
46.51.224.0/19
46.137.0.0/17
46.137.128.0/18
46.137.192.0/19
46.137.224.0/19
50.16.0.0/15
50.18.0.0/16
50.19.0.0/16
50.112.0.0/16
52.0.0.0/15
52.2.0.0/15
52.4.0.0/14
52.8.0.0/16
52.9.0.0/16
52.10.0.0/15
52.12.0.0/15
52.14.0.0/16
52.15.0.0/16
52.16.0.0/15
52.18.0.0/15
52.20.0.0/14
52.24.0.0/14
52.28.0.0/16
52.29.0.0/16
52.30.0.0/15
52.32.0.0/14
52.36.0.0/14
52.40.0.0/14
52.44.0.0/15
52.46.0.0/18
52.46.64.0/20
52.46.80.0/21
52.46.88.0/22
52.46.92.0/22
52.46.96.0/20
52.46.112.0/21
52.46.120.0/22
52.46.124.0/22
52.46.128.0/19
52.46.164.0/23
52.47.0.0/16
52.48.0.0/14
52.52.0.0/15
52.54.0.0/15
52.56.0.0/16
52.57.0.0/16
52.58.0.0/15
52.60.0.0/16
52.61.0.0/16
52.62.0.0/15
52.64.0.0/17
52.64.128.0/17
52.65.0.0/16
52.66.0.0/16
52.67.0.0/16
52.68.0.0/15
52.70.0.0/15
52.72.0.0/15
52.74.0.0/16
52.75.0.0/16
52.76.0.0/17
52.76.128.0/17
52.77.0.0/16
52.78.0.0/16
52.79.0.0/16
52.80.0.0/16
52.81.0.0/16
52.82.187.0/24
52.82.188.0/22
52.82.192.0/18
52.83.0.0/16
52.84.0.0/15
52.86.0.0/15
52.88.0.0/15
52.90.0.0/15
52.92.0.0/20
52.92.16.0/20
52.92.32.0/22
52.92.39.0/24
52.92.40.0/21
52.92.48.0/22
52.92.52.0/22
52.92.56.0/22
52.92.60.0/22
52.92.64.0/22
52.92.68.0/22
52.92.72.0/22
52.92.76.0/22
52.92.80.0/22
52.92.84.0/22
52.92.88.0/22
52.92.248.0/22
52.92.252.0/22
52.93.0.0/24
52.93.1.0/24
52.93.2.0/24
52.93.3.0/24
52.93.4.0/24
52.93.5.0/24
52.93.8.0/22
52.93.16.0/24
52.94.0.0/22
52.94.4.0/24
52.94.5.0/24
52.94.6.0/24
52.94.7.0/24
52.94.8.0/24
52.94.9.0/24
52.94.10.0/24
52.94.11.0/24
52.94.12.0/24
52.94.13.0/24
52.94.14.0/24
52.94.15.0/24
52.94.16.0/24
52.94.17.0/24
52.94.20.0/24
52.94.22.0/24
52.94.24.0/23
52.94.26.0/23
52.94.28.0/23
52.94.30.0/23
52.94.32.0/20
52.94.48.0/20
52.94.64.0/22
52.94.68.0/24
52.94.69.0/24
52.94.72.0/22
52.94.76.0/22
52.94.80.0/20
52.94.96.0/20
52.94.112.0/22
52.94.116.0/22
52.94.120.0/22
52.94.124.0/22
52.94.192.0/22
52.94.196.0/24
52.94.197.0/24
52.94.198.0/28
52.94.198.16/28
52.94.198.32/28
52.94.198.48/28
52.94.198.64/28
52.94.198.80/28
52.94.198.96/28
52.94.198.112/28
52.94.198.128/28
52.94.198.144/28
52.94.199.0/24
52.94.200.0/24
52.94.204.0/23
52.94.206.0/23
52.94.208.0/21
52.94.216.0/21
52.94.224.0/20
52.94.240.0/22
52.94.244.0/22
52.94.248.0/28
52.94.248.16/28
52.94.248.32/28
52.94.248.48/28
52.94.248.64/28
52.94.248.80/28
52.94.248.96/28
52.94.248.112/28
52.94.248.128/28
52.94.248.144/28
52.94.248.160/28
52.94.248.176/28
52.94.248.192/28
52.94.248.208/28
52.94.248.224/28
52.94.249.0/28
52.94.249.16/28
52.94.249.32/28
52.94.249.64/28
52.94.249.80/28
52.94.252.0/23
52.94.254.0/23
52.95.0.0/20
52.95.16.0/21
52.95.24.0/22
52.95.28.0/24
52.95.30.0/23
52.95.34.0/24
52.95.35.0/24
52.95.36.0/22
52.95.40.0/24
52.95.48.0/22
52.95.56.0/22
52.95.60.0/24
52.95.61.0/24
52.95.62.0/24
52.95.63.0/24
52.95.64.0/20
52.95.80.0/20
52.95.96.0/22
52.95.100.0/22
52.95.104.0/22
52.95.108.0/23
52.95.110.0/24
52.95.111.0/24
52.95.112.0/20
52.95.128.0/21
52.95.136.0/23
52.95.138.0/24
52.95.142.0/23
52.95.144.0/24
52.95.145.0/24
52.95.146.0/23
52.95.148.0/23
52.95.150.0/24
52.95.154.0/23
52.95.156.0/24
52.95.163.0/24
52.95.164.0/23
52.95.166.0/23
52.95.168.0/24
52.95.192.0/20
52.95.212.0/22
52.95.240.0/24
52.95.241.0/24
52.95.242.0/24
52.95.243.0/24
52.95.244.0/24
52.95.245.0/24
52.95.246.0/24
52.95.247.0/24
52.95.248.0/24
52.95.249.0/24
52.95.250.0/24
52.95.251.0/24
52.95.252.0/24
52.95.253.0/24
52.95.254.0/24
52.95.255.0/28
52.95.255.16/28
52.95.255.32/28
52.95.255.48/28
52.95.255.64/28
52.95.255.80/28
52.95.255.96/28
52.95.255.112/28
52.95.255.128/28
52.95.255.144/28
52.119.160.0/20
52.119.176.0/21
52.119.184.0/22
52.119.188.0/22
52.119.192.0/22
52.119.196.0/22
52.119.205.0/24
52.119.206.0/23
52.119.208.0/23
52.119.210.0/23
52.119.212.0/23
52.119.214.0/23
52.119.216.0/21
52.119.224.0/21
52.119.232.0/21
52.119.240.0/21
52.192.0.0/15
52.196.0.0/14
52.200.0.0/13
52.208.0.0/13
52.216.0.0/15
52.218.0.0/17
52.218.128.0/17
52.219.0.0/20
52.219.16.0/22
52.219.20.0/22
52.219.24.0/21
52.219.32.0/21
52.219.40.0/22
52.219.44.0/22
52.219.56.0/22
52.219.60.0/23
52.219.62.0/23
52.219.64.0/22
52.219.68.0/22
52.219.72.0/22
52.219.76.0/22
52.219.80.0/20
52.220.0.0/15
52.222.0.0/17
52.222.128.0/17
54.64.0.0/15
54.66.0.0/16
54.67.0.0/16
54.68.0.0/14
54.72.0.0/15
54.74.0.0/15
54.76.0.0/15
54.78.0.0/16
54.79.0.0/16
54.80.0.0/13
54.88.0.0/14
54.92.0.0/17
54.92.128.0/17
54.93.0.0/16
54.94.0.0/16
54.95.0.0/16
54.144.0.0/14
54.148.0.0/15
54.150.0.0/16
54.151.0.0/17
54.151.128.0/17
54.152.0.0/16
54.153.0.0/17
54.153.128.0/17
54.154.0.0/16
54.155.0.0/16
54.156.0.0/14
54.160.0.0/13
54.168.0.0/16
54.169.0.0/16
54.170.0.0/15
54.172.0.0/15
54.174.0.0/15
54.176.0.0/15
54.178.0.0/16
54.179.0.0/16
54.182.0.0/16
54.183.0.0/16
54.184.0.0/13
54.192.0.0/16
54.193.0.0/16
54.194.0.0/15
54.196.0.0/15
54.198.0.0/16
54.199.0.0/16
54.200.0.0/15
54.202.0.0/15
54.204.0.0/15
54.206.0.0/16
54.207.0.0/16
54.208.0.0/15
54.210.0.0/15
54.212.0.0/15
54.214.0.0/16
54.215.0.0/16
54.216.0.0/15
54.218.0.0/16
54.219.0.0/16
54.220.0.0/16
54.221.0.0/16
54.222.0.0/19
54.222.48.0/22
54.222.57.0/24
54.222.58.0/28
54.222.128.0/17
54.223.0.0/16
54.224.0.0/15
54.226.0.0/15
54.228.0.0/16
54.229.0.0/16
54.230.0.0/16
54.231.0.0/17
54.231.128.0/19
54.231.160.0/19
54.231.192.0/20
54.231.224.0/21
54.231.232.0/21
54.231.240.0/22
54.231.244.0/22
54.231.248.0/22
54.231.252.0/24
54.231.253.0/24
54.232.0.0/16
54.233.0.0/18
54.233.64.0/18
54.233.128.0/17
54.234.0.0/15
54.236.0.0/15
54.238.0.0/16
54.239.0.0/28
54.239.0.16/28
54.239.0.32/28
54.239.0.48/28
54.239.0.64/28
54.239.0.80/28
54.239.0.96/28
54.239.0.112/28
54.239.0.128/28
54.239.0.144/28
54.239.0.160/28
54.239.0.176/28
54.239.0.192/28
54.239.0.208/28
54.239.0.224/28
54.239.0.240/28
54.239.1.0/28
54.239.1.16/28
54.239.2.0/23
54.239.4.0/22
54.239.8.0/21
54.239.16.0/20
54.239.32.0/21
54.239.48.0/22
54.239.52.0/23
54.239.54.0/23
54.239.56.0/21
54.239.96.0/24
54.239.98.0/24
54.239.99.0/24
54.239.100.0/23
54.239.104.0/23
54.239.108.0/22
54.239.116.0/22
54.239.120.0/21
54.239.128.0/18
54.239.192.0/19
54.240.128.0/18
54.240.192.0/22
54.240.196.0/24
54.240.197.0/24
54.240.198.0/24
54.240.199.0/24
54.240.200.0/24
54.240.202.0/24
54.240.203.0/24
54.240.204.0/22
54.240.208.0/22
54.240.212.0/22
54.240.216.0/22
54.240.220.0/22
54.240.225.0/24
54.240.226.0/24
54.240.227.0/24
54.240.228.0/23
54.240.230.0/23
54.240.232.0/22
54.240.244.0/22
54.240.248.0/21
54.241.0.0/16
54.242.0.0/15
54.244.0.0/16
54.245.0.0/16
54.246.0.0/16
54.247.0.0/16
54.248.0.0/15
54.250.0.0/16
54.251.0.0/16
54.252.0.0/16
54.253.0.0/16
54.254.0.0/16
54.255.0.0/16
67.202.0.0/18
72.21.192.0/19
72.44.32.0/19
75.101.128.0/17
79.125.0.0/17
87.238.80.0/21
96.127.0.0/17
103.4.8.0/22
103.4.12.0/22
103.8.172.0/22
103.246.148.0/23
103.246.150.0/23
107.20.0.0/14
122.248.192.0/18
172.96.97.0/24
172.96.98.0/24
174.129.0.0/16
175.41.128.0/18
175.41.192.0/18
176.32.64.0/19
176.32.96.0/21
176.32.104.0/21
176.32.112.0/21
176.32.120.0/22
176.32.125.0/25
176.34.0.0/19
176.34.32.0/19
176.34.64.0/18
176.34.128.0/17
177.71.128.0/17
177.72.240.0/21
178.236.0.0/20
184.72.0.0/18
184.72.64.0/18
184.72.128.0/17
184.73.0.0/16
184.169.128.0/17
185.48.120.0/22
185.143.16.0/24
203.83.220.0/22
204.236.128.0/18
204.236.192.0/18
204.246.160.0/22
204.246.164.0/22
204.246.168.0/22
204.246.174.0/23
204.246.176.0/20
205.251.192.0/19
205.251.224.0/22
205.251.228.0/22
205.251.232.0/22
205.251.236.0/22
205.251.240.0/22
205.251.244.0/23
205.251.247.0/24
205.251.248.0/24
205.251.249.0/24
205.251.250.0/23
205.251.252.0/23
205.251.254.0/24
207.171.160.0/20
207.171.176.0/20
216.137.32.0/19
216.182.224.0/20
54.183.255.128/26
54.228.16.0/26
54.232.40.64/26
54.241.32.64/26
54.243.31.192/26
54.244.52.192/26
54.245.168.0/26
54.248.220.0/26
54.250.253.192/26
54.251.31.128/26
54.252.79.128/26
54.252.254.192/26
54.255.254.192/26
107.23.255.0/26
176.34.159.192/26
177.71.207.128/26
52.82.188.0/22
52.92.0.0/20
52.92.16.0/20
52.92.32.0/22
52.92.39.0/24
52.92.40.0/21
52.92.48.0/22
52.92.52.0/22
52.92.56.0/22
52.92.60.0/22
52.92.64.0/22
52.92.68.0/22
52.92.72.0/22
52.92.76.0/22
52.92.80.0/22
52.92.84.0/22
52.92.88.0/22
52.92.248.0/22
52.92.252.0/22
52.95.128.0/21
52.95.136.0/23
52.95.138.0/24
52.95.142.0/23
52.95.144.0/24
52.95.145.0/24
52.95.146.0/23
52.95.148.0/23
52.95.150.0/24
52.95.154.0/23
52.95.156.0/24
52.95.163.0/24
52.95.164.0/23
52.95.166.0/23
52.95.168.0/24
52.216.0.0/15
52.218.0.0/17
52.218.128.0/17
52.219.0.0/20
52.219.16.0/22
52.219.20.0/22
52.219.24.0/21
52.219.32.0/21
52.219.40.0/22
52.219.44.0/22
52.219.56.0/22
52.219.60.0/23
52.219.62.0/23
52.219.64.0/22
52.219.68.0/22
52.219.72.0/22
52.219.76.0/22
52.219.80.0/20
54.222.20.0/22
54.222.48.0/22
54.231.0.0/17
54.231.128.0/19
54.231.160.0/19
54.231.192.0/20
54.231.224.0/21
54.231.232.0/21
54.231.240.0/22
54.231.248.0/22
54.231.252.0/24
54.231.253.0/24
13.52.0.0/16
13.54.0.0/15
13.56.0.0/16
13.57.0.0/16
13.58.0.0/15
13.112.0.0/14
13.124.0.0/16
13.125.0.0/16
13.126.0.0/15
13.209.0.0/16
13.210.0.0/15
13.228.0.0/15
13.230.0.0/15
13.232.0.0/14
13.236.0.0/14
13.250.0.0/15
18.144.0.0/15
18.194.0.0/15
18.196.0.0/15
18.200.0.0/16
18.216.0.0/14
18.220.0.0/14
18.231.0.0/16
18.253.0.0/16
23.20.0.0/14
34.192.0.0/12
34.208.0.0/12
34.224.0.0/12
34.240.0.0/13
34.248.0.0/13
35.153.0.0/16
35.154.0.0/16
35.155.0.0/16
35.156.0.0/14
35.160.0.0/13
35.168.0.0/13
35.176.0.0/15
35.178.0.0/15
35.180.0.0/15
35.182.0.0/15
46.51.128.0/18
46.51.192.0/20
46.51.216.0/21
46.51.224.0/19
46.137.0.0/17
46.137.128.0/18
46.137.192.0/19
46.137.224.0/19
50.16.0.0/15
50.18.0.0/16
50.19.0.0/16
50.112.0.0/16
52.0.0.0/15
52.2.0.0/15
52.4.0.0/14
52.8.0.0/16
52.9.0.0/16
52.10.0.0/15
52.12.0.0/15
52.14.0.0/16
52.15.0.0/16
52.16.0.0/15
52.18.0.0/15
52.20.0.0/14
52.24.0.0/14
52.28.0.0/16
52.29.0.0/16
52.30.0.0/15
52.32.0.0/14
52.36.0.0/14
52.40.0.0/14
52.44.0.0/15
52.47.0.0/16
52.48.0.0/14
52.52.0.0/15
52.54.0.0/15
52.56.0.0/16
52.57.0.0/16
52.58.0.0/15
52.60.0.0/16
52.61.0.0/16
52.62.0.0/15
52.64.0.0/17
52.64.128.0/17
52.65.0.0/16
52.66.0.0/16
52.67.0.0/16
52.68.0.0/15
52.70.0.0/15
52.72.0.0/15
52.74.0.0/16
52.75.0.0/16
52.76.0.0/17
52.76.128.0/17
52.77.0.0/16
52.78.0.0/16
52.79.0.0/16
52.80.0.0/16
52.81.0.0/16
52.83.0.0/16
52.86.0.0/15
52.88.0.0/15
52.90.0.0/15
52.94.116.0/22
52.95.240.0/24
52.95.241.0/24
52.95.242.0/24
52.95.243.0/24
52.95.244.0/24
52.95.245.0/24
52.95.246.0/24
52.95.247.0/24
52.95.248.0/24
52.95.249.0/24
52.95.250.0/24
52.95.251.0/24
52.95.252.0/24
52.95.253.0/24
52.95.254.0/24
52.95.255.0/28
52.95.255.16/28
52.95.255.32/28
52.95.255.48/28
52.95.255.64/28
52.95.255.80/28
52.95.255.96/28
52.95.255.112/28
52.95.255.128/28
52.95.255.144/28
52.119.205.0/24
52.192.0.0/15
52.196.0.0/14
52.200.0.0/13
52.208.0.0/13
52.220.0.0/15
52.222.0.0/17
54.64.0.0/15
54.66.0.0/16
54.67.0.0/16
54.68.0.0/14
54.72.0.0/15
54.74.0.0/15
54.76.0.0/15
54.78.0.0/16
54.79.0.0/16
54.80.0.0/13
54.88.0.0/14
54.92.0.0/17
54.92.128.0/17
54.93.0.0/16
54.94.0.0/16
54.95.0.0/16
54.144.0.0/14
54.148.0.0/15
54.150.0.0/16
54.151.0.0/17
54.151.128.0/17
54.152.0.0/16
54.153.0.0/17
54.153.128.0/17
54.154.0.0/16
54.155.0.0/16
54.156.0.0/14
54.160.0.0/13
54.168.0.0/16
54.169.0.0/16
54.170.0.0/15
54.172.0.0/15
54.174.0.0/15
54.176.0.0/15
54.178.0.0/16
54.179.0.0/16
54.183.0.0/16
54.184.0.0/13
54.193.0.0/16
54.194.0.0/15
54.196.0.0/15
54.198.0.0/16
54.199.0.0/16
54.200.0.0/15
54.202.0.0/15
54.204.0.0/15
54.206.0.0/16
54.207.0.0/16
54.208.0.0/15
54.210.0.0/15
54.212.0.0/15
54.214.0.0/16
54.215.0.0/16
54.216.0.0/15
54.218.0.0/16
54.219.0.0/16
54.220.0.0/16
54.221.0.0/16
54.222.128.0/17
54.223.0.0/16
54.224.0.0/15
54.226.0.0/15
54.228.0.0/16
54.229.0.0/16
54.232.0.0/16
54.233.0.0/18
54.233.64.0/18
54.233.128.0/17
54.234.0.0/15
54.236.0.0/15
54.238.0.0/16
54.241.0.0/16
54.242.0.0/15
54.244.0.0/16
54.245.0.0/16
54.246.0.0/16
54.247.0.0/16
54.248.0.0/15
54.250.0.0/16
54.251.0.0/16
54.252.0.0/16
54.253.0.0/16
54.254.0.0/16
54.255.0.0/16
67.202.0.0/18
72.44.32.0/19
75.101.128.0/17
79.125.0.0/17
96.127.0.0/17
103.4.8.0/22
103.4.12.0/22
107.20.0.0/14
122.248.192.0/18
174.129.0.0/16
175.41.128.0/18
175.41.192.0/18
176.32.64.0/19
176.34.0.0/19
176.34.32.0/19
176.34.64.0/18
176.34.128.0/17
177.71.128.0/17
184.72.0.0/18
184.72.64.0/18
184.72.128.0/17
184.73.0.0/16
184.169.128.0/17
185.48.120.0/22
204.236.128.0/18
204.236.192.0/18
216.182.224.0/20
52.95.110.0/24
205.251.192.0/21
13.32.0.0/15
13.54.63.128/26
13.59.250.0/26
13.113.203.0/24
13.124.199.0/24
13.228.69.0/24
34.195.252.0/24
34.226.14.0/24
34.232.163.208/29
35.158.136.0/24
35.162.63.192/26
35.167.191.128/26
52.15.127.128/26
52.46.0.0/18
52.52.191.128/26
52.56.127.0/25
52.57.254.0/24
52.66.194.128/26
52.78.247.128/26
52.84.0.0/15
52.199.127.192/26
52.212.248.0/26
52.220.191.0/26
52.222.128.0/17
54.182.0.0/16
54.192.0.0/16
54.230.0.0/16
54.233.255.128/26
54.239.128.0/18
54.239.192.0/19
54.240.128.0/18
204.246.164.0/22
204.246.168.0/22
204.246.174.0/23
204.246.176.0/20
205.251.192.0/19
205.251.249.0/24
205.251.250.0/23
205.251.252.0/23
205.251.254.0/24
216.137.32.0/19
13.55.255.216/29
13.56.32.200/29
13.112.191.184/29
34.228.4.208/28
34.250.63.248/29
35.157.127.248/29
35.176.92.32/29
35.182.14.48/29
52.15.247.208/29
52.43.76.88/29
52.221.221.128/29
#!/usr/bin/env python3
import httplib2
import sys
from bs4 import BeautifulSoup, SoupStrainer
try:
website = sys.argv[1]
http = httplib2.Http()
status, response = http.request(website)
for link in BeautifulSoup(response, "html.parser", parse_only=SoupStrainer('a')):
if link.has_attr('href'):
print(link['href'])
except IndexError:
print('syntax: ' + sys.argv[0] + ' http://google.com')
beautifulsoup4==4.6.0
bs4==0.0.1
httplib2==0.10.3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment