Last active
December 4, 2023 16:25
-
-
Save matdave/a65269ff79815c0505048245dafbdad8 to your computer and use it in GitHub Desktop.
Bulk Sucuri Whitelist
This file contains hidden or 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/bash | |
# This script will whitelist the IP address of the server in Sucuri's firewall. | |
# Variables | |
# The API key for the Sucuri API | |
API_KEY="" | |
# The API secret for the Sucuri API | |
API_SECRET="" | |
# The file containing a list of IP addresses to whitelist | |
IP_FILE="" | |
# Functions | |
whitelist_ip() { | |
# This function will whitelist the IP address in the Sucuri firewall. | |
# The IP address to whitelist is passed as the first argument. | |
# The API key is passed as the second argument. | |
# The API secret is passed as the third argument. | |
# The output of the API call is saved to the variable $OUTPUT. | |
# Check if the IP address is valid. | |
if [[ $1 =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$ ]]; then | |
echo "IP address $1 is valid." | |
else | |
echo "IP address $1 is not valid." | |
return | |
fi | |
# Make the API call to whitelist the IP address. | |
OUTPUT=$(curl 'https://waf.sucuri.net/api?v2' \ | |
--data 'k='$2 \ | |
--data 's='$3 \ | |
--data 'a=allowlist_ip' \ | |
--data 'ip='$1) | |
if [[ $OUTPUT == *"error"* ]]; then | |
echo "IP address $1 was not whitelisted successfully." | |
else | |
echo "IP address $1 was whitelisted successfully." | |
fi | |
} | |
# Main | |
# Loop through the IP addresses in the file and whitelist each one. | |
while read IP; do | |
whitelist_ip $IP $API_KEY $API_SECRET | |
done < $IP_FILE |
This file contains hidden or 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
185.229.145.22 | |
93.160.60.22 | |
80.62.246.50 | |
52.48.230.149 | |
52.57.25.76 | |
88.150.142.65 | |
35.157.236.87 | |
35.157.42.7 | |
35.156.240.123 | |
3.10.81.130 | |
52.55.30.145 | |
52.20.183.91 | |
52.60.34.56 | |
185.229.144.22 | |
185.229.144.10 | |
173.45.86.10 | |
173.45.86.74 | |
52.7.141.1 | |
52.4.143.42 | |
52.64.209.168 | |
52.47.166.84 | |
52.199.41.160 | |
52.62.119.24 | |
52.62.147.245 | |
54.233.93.223 | |
52.29.157.54 | |
52.29.165.98 | |
35.154.71.109 | |
52.78.201.227 | |
52.79.109.89 | |
52.49.22.75 | |
52.17.221.188 | |
52.192.200.212 | |
52.77.4.220 | |
52.76.24.207 | |
52.71.233.116 | |
52.70.218.116 | |
52.89.228.115 | |
52.33.171.213 | |
52.8.142.166 | |
52.8.3.121 | |
80.62.246.46 | |
93.160.60.51 | |
149.72.248.150 | |
168.245.125.127 | |
18.223.89.15 | |
3.209.121.100 | |
52.8.130.130 | |
54.193.30.204 | |
3.123.96.88 | |
52.63.157.211 | |
3.113.133.88 | |
18.230.72.87 | |
13.48.47.239 | |
35.182.100.126 | |
18.162.92.10 | |
35.204.24.17 | |
52.58.124.116 | |
185.229.144.61 | |
13.58.165.213 | |
18.116.191.222 | |
18.116.197.208 | |
18.189.206.159 | |
18.190.68.80 | |
18.216.137.252 | |
18.223.191.8 | |
3.13.121.241 | |
3.133.38.181 | |
3.135.49.180 | |
3.136.111.218 | |
3.138.54.100 | |
18.219.35.44 | |
18.157.140.51 | |
18.159.218.224 | |
18.196.205.2 | |
18.198.120.55 | |
3.124.26.114 | |
3.125.99.135 | |
3.64.159.177 | |
3.66.247.32 | |
3.68.122.244 | |
52.57.167.198 | |
35.158.180.204 | |
18.192.147.131 | |
52.58.146.230 | |
185.229.145.22 |
This file contains hidden or 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
38.88.216.186 | |
50.22.17.90 | |
108.168.148.197 | |
169.46.32.104 | |
169.46.90.172 | |
169.48.138.198 | |
169.48.138.199 | |
169.48.219.69 | |
169.63.22.16 | |
169.63.31.196 | |
169.63.31.204 | |
173.192.95.101 | |
173.193.169.60 | |
184.173.85.139 | |
192.155.201.172 | |
169.46.90.162 | |
169.48.138.202 | |
169.63.22.13 | |
169.63.31.198 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment