Skip to content

Instantly share code, notes, and snippets.

@ricardomaia
Created March 9, 2024 01:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ricardomaia/b3aa2f844d6aa8d4b33154bfcc4dd113 to your computer and use it in GitHub Desktop.
Save ricardomaia/b3aa2f844d6aa8d4b33154bfcc4dd113 to your computer and use it in GitHub Desktop.
Creating a file with a list of proxies
#!/usr/bin/env bash
# Download proxies list
curl -k https://raw.githubusercontent.com/TheSpeedX/SOCKS-List/master/http.txt -o proxy_list.txt
sed -i -e 's/^/http:\/\//' proxy_list.t
#!/usr/bin/env bash
proxy_list="proxy_list.txt"
proxy_list_BR="proxy_list_brazil.txt"
if ! [ -f "$proxy_list" ]; then
echo "File $proxy_list not found. Please, execute the 'update_proxies.sh' script."
exit 1
fi
if ! command geoiplookup -h &> /dev/null
then
echo "geoiplookup could not be found. Install it with the command:"
echo "sudo apt install geoip-bin"
exit 1
fi
while IFS= read -r line; do
protocol=$(echo "$line" | awk -F '://' '{print $1}')
ip_port=$(echo "$line" | awk -F '://' '{print $2}')
ip=$(echo "$ip_port" | cut -d ':' -f 1)
port=$(echo "$ip_port" | cut -d ':' -f 2)
location=$(geoiplookup "$ip" | awk -F ', ' '{print $2}')
if [ "$location" == "Brazil" ]; then
echo "$protocol://$ip:$port" >> "$proxy_list_BR"
echo "Brazilian proxy found: $protocol://$ip:$port"
fi
done < "$proxy_list"
echo "All proxies saved into $proxy_list_BR file."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment