Skip to content

Instantly share code, notes, and snippets.

@KrE80r
Last active June 17, 2023 12:57
Show Gist options
  • Save KrE80r/bfbb989dd52938f45ec14df60a03abf1 to your computer and use it in GitHub Desktop.
Save KrE80r/bfbb989dd52938f45ec14df60a03abf1 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Function to download proxies using curl
download_proxies() {
url=$1
output_file=$2
curl -s "$url" -o "$output_file"
}
# Function to add a prefix to proxy files
add_proxy_prefix() {
prefix=$1
file=$2
awk -v p="$prefix" 'BEGIN {proxy_pattern = "([0-9]{1,3}\\.){3}[0-9]{1,3}:[0-9]+"} {if ($0 ~ proxy_pattern) print p"://"$0}' "$file" > "${file}.tmp" && mv "${file}.tmp" "$file"
}
# Function to combine proxy files into a single file
combine_proxies() {
combined_file=$1
shift
proxy_files=("$@")
for file in "${proxy_files[@]}"; do
if [ "$file" != "$combined_file" ] && [ -f "$file" ]; then
cat "$file" >> "$combined_file"
fi
done
}
# Function to run mubeng to eliminate dead proxies
run_mubeng() {
input_file=$1
output_file=$2
for ((i=1; i<=5; i++)); do
mubeng -c -f "$input_file" -t 5s -g 400 -v -o "$temp_live"
mv "$temp_live" "$output_file"
done
}
# Function to clean up temporary files
cleanup() {
files=("$@")
for file in "${files[@]}"; do
rm "$file"
done
}
# Set the output file names
http_file="http_proxies.txt"
socks4_file="socks4_proxies.txt"
socks5_file="socks5_proxies.txt"
https_file="https_proxies.txt"
live_file="live_proxies.txt"
temp_live="temp_live.txt"
# Array to store temporary file names
temp_files=()
# Download HTTP proxies in parallel
http_urls=(
"https://raw.githubusercontent.com/B4RC0DE-TM/proxy-list/main/HTTP.txt"
"https://raw.githubusercontent.com/saschazesiger/Free-Proxies/master/proxies/http.txt"
"https://raw.githubusercontent.com/HyperBeats/proxy-list/main/http.txt"
"https://raw.githubusercontent.com/mmpx12/proxy-list/master/http.txt"
"https://api.proxyscrape.com/?request=displayproxies&proxytype=http"
"https://api.openproxylist.xyz/http.txt"
"http://alexa.lr2b.com/proxylist.txt"
"https://multiproxy.org/txt_all/proxy.txt"
"https://proxyspace.pro/http.txt"
"https://raw.githubusercontent.com/monosans/proxy-list/main/proxies/http.txt"
"https://raw.githubusercontent.com/monosans/proxy-list/main/proxies_anonymous/http.txt"
"https://raw.githubusercontent.com/TheSpeedX/SOCKS-List/master/http.txt"
"https://raw.githubusercontent.com/shiftytr/proxy-list/master/proxy.txt"
"https://raw.githubusercontent.com/TheSpeedX/PROXY-List/master/http.txt"
"https://raw.githubusercontent.com/ShiftyTR/Proxy-List/master/http.txt"
"https://raw.githubusercontent.com/jetkai/proxy-list/main/online-proxies/txt/proxies-http.txt"
"https://raw.githubusercontent.com/clarketm/proxy-list/master/proxy-list-raw.txt"
"https://raw.githubusercontent.com/sunny9577/proxy-scraper/master/proxies.txt"
"https://raw.githubusercontent.com/roosterkid/openproxylist/main/HTTPS_RAW.txt"
"https://raw.githubusercontent.com/opsxcq/proxy-list/master/list.txt"
"https://raw.githubusercontent.com/proxy4parsing/proxy-list/main/http.txt"
"http://rootjazz.com/proxies/proxies.txt"
"http://spys.me/proxy.txt"
"https://proxyspace.pro/http.txt"
"https://www.proxy-list.download/api/v1/get?type=http"
"https://raw.githubusercontent.com/rdavydov/proxy-list/main/proxies/http.txt"
"https://raw.githubusercontent.com/rdavydov/proxy-list/main/proxies_anonymous/http.txt"
"https://raw.githubusercontent.com/zevtyardt/proxy-list/main/http.txt"
"https://sunny9577.github.io/proxy-scraper/proxies.txt"
"https://raw.githubusercontent.com/MuRongPIG/Proxy-Master/main/http.txt"
"https://raw.githubusercontent.com/Zaeem20/FREE_PROXIES_LIST/master/http.txt"
"https://raw.githubusercontent.com/prxchk/proxy-list/main/http.txt"
"https://raw.githubusercontent.com/ALIILAPRO/Proxy/main/http.txt"
# Add more HTTP proxy URLs here
)
for url in "${http_urls[@]}"; do
temp_file=$(mktemp)
temp_files+=("$temp_file")
download_proxies "$url" "$temp_file" &
done
wait
# Combine downloaded HTTP proxies into a single file
combine_proxies "$http_file" "${temp_files[@]}"
# Add prefix to HTTP proxies
add_proxy_prefix "http" "$http_file"
# Download SOCKS4 proxies in parallel
socks4_urls=(
"https://api.proxyscrape.com/v2/?request=displayproxies&protocol=socks4"
"https://api.proxyscrape.com/?request=displayproxies&proxytype=socks4&country=all"
"https://api.openproxylist.xyz/socks4.txt"
"https://proxyspace.pro/socks4.txt"
"https://raw.githubusercontent.com/monosans/proxy-list/main/proxies/socks4.txt"
"https://raw.githubusercontent.com/monosans/proxy-list/main/proxies_anonymous/socks4.txt"
"https://raw.githubusercontent.com/jetkai/proxy-list/main/online-proxies/txt/proxies-socks4.txt"
"https://raw.githubusercontent.com/ShiftyTR/Proxy-List/master/socks4.txt"
"https://raw.githubusercontent.com/TheSpeedX/PROXY-List/master/socks4.txt"
"https://raw.githubusercontent.com/roosterkid/openproxylist/main/SOCKS4_RAW.txt"
"https://proxyspace.pro/socks4.txt"
"https://www.proxy-list.download/api/v1/get?type=socks4"
"https://raw.githubusercontent.com/HyperBeats/proxy-list/main/socks4.txt"
"https://raw.githubusercontent.com/mmpx12/proxy-list/master/socks4.txt"
"https://raw.githubusercontent.com/saschazesiger/Free-Proxies/master/proxies/socks4.txt"
"https://raw.githubusercontent.com/B4RC0DE-TM/proxy-list/main/SOCKS4.txt"
"https://raw.githubusercontent.com/rdavydov/proxy-list/main/proxies/socks4.txt"
"https://raw.githubusercontent.com/rdavydov/proxy-list/main/proxies_anonymous/socks4.txt"
"https://raw.githubusercontent.com/zevtyardt/proxy-list/main/socks4.txt"
"https://raw.githubusercontent.com/MuRongPIG/Proxy-Master/main/socks4.txt"
"https://raw.githubusercontent.com/Zaeem20/FREE_PROXIES_LIST/master/socks4.txt"
"https://raw.githubusercontent.com/prxchk/proxy-list/main/socks4.txt"
"https://raw.githubusercontent.com/ALIILAPRO/Proxy/main/socks4.txt"
# Add more SOCKS4 proxy URLs here
)
for url in "${socks4_urls[@]}"; do
temp_file=$(mktemp)
temp_files+=("$temp_file")
download_proxies "$url" "$temp_file" &
done
wait
# Combine downloaded SOCKS4 proxies into a single file
combine_proxies "$socks4_file" "${temp_files[@]}"
# Add prefix to SOCKS4 proxies
add_proxy_prefix "socks4" "$socks4_file"
# Download SOCKS5 proxies in parallel
socks5_urls=(
"https://raw.githubusercontent.com/B4RC0DE-TM/proxy-list/main/SOCKS5.txt"
"https://raw.githubusercontent.com/saschazesiger/Free-Proxies/master/proxies/socks5.txt"
"https://raw.githubusercontent.com/mmpx12/proxy-list/master/socks5.txt"
"https://raw.githubusercontent.com/HyperBeats/proxy-list/main/socks5.txt"
"https://api.openproxylist.xyz/socks5.txt"
"https://api.proxyscrape.com/?request=displayproxies&proxytype=socks5"
"https://api.proxyscrape.com/v2/?request=displayproxies&protocol=socks5"
"https://proxyspace.pro/socks5.txt"
"https://raw.githubusercontent.com/manuGMG/proxy-365/main/SOCKS5.txt"
"https://raw.githubusercontent.com/monosans/proxy-list/main/proxies/socks5.txt"
"https://raw.githubusercontent.com/monosans/proxy-list/main/proxies_anonymous/socks5.txt"
"https://raw.githubusercontent.com/ShiftyTR/Proxy-List/master/socks5.txt"
"https://raw.githubusercontent.com/jetkai/proxy-list/main/online-proxies/txt/proxies-socks5.txt"
"https://raw.githubusercontent.com/roosterkid/openproxylist/main/SOCKS5_RAW.txt"
"https://raw.githubusercontent.com/TheSpeedX/PROXY-List/master/socks5.txt"
"https://raw.githubusercontent.com/hookzof/socks5_list/master/proxy.txt"
"https://raw.githubusercontent.com/rdavydov/proxy-list/main/proxies/socks5.txt"
"https://raw.githubusercontent.com/rdavydov/proxy-list/main/proxies_anonymous/socks5.txt"
"https://raw.githubusercontent.com/zevtyardt/proxy-list/main/socks5.txt"
"https://raw.githubusercontent.com/MuRongPIG/Proxy-Master/main/socks5.txt"
"https://raw.githubusercontent.com/Zaeem20/FREE_PROXIES_LIST/master/socks5.txt"
"https://raw.githubusercontent.com/prxchk/proxy-list/main/socks5.txt"
"https://raw.githubusercontent.com/ALIILAPRO/Proxy/main/socks5.txt"
)
for url in "${socks5_urls[@]}"; do
temp_file=$(mktemp)
temp_files+=("$temp_file")
download_proxies "$url" "$temp_file" &
done
wait
# Combine downloaded SOCKS5 proxies into a single file
combine_proxies "$socks5_file" "${temp_files[@]}"
# Add prefix to SOCKS5 proxies
add_proxy_prefix "socks5" "$socks5_file"
# Download HTTPS proxies in parallel
https_urls=(
"http://sslproxies.org"
"https://raw.githubusercontent.com/jetkai/proxy-list/main/online-proxies/txt/proxies-https.txt"
"https://raw.githubusercontent.com/Zaeem20/FREE_PROXIES_LIST/master/https.txt"
"https://raw.githubusercontent.com/HyperBeats/proxy-list/main/https.txt"
"https://proxyspace.pro/https.txt"
# Add more HTTPS proxy URLs here
)
for url in "${https_urls[@]}"; do
temp_file=$(mktemp)
temp_files+=("$temp_file")
download_proxies "$url" "$temp_file" &
done
wait
# Combine downloaded HTTPS proxies into a single file
combine_proxies "$https_file" "${temp_files[@]}"
# Add prefix to HTTPS proxies
add_proxy_prefix "https" "$https_file"
# Combine all proxy files into a single file
combined_file="all_proxies.txt"
combine_proxies "$combined_file" "$http_file" "$socks4_file" "$socks5_file" "$https_file"
# # Run mubeng to eliminate dead proxies
run_mubeng "$combined_file" "$live_file"
# Clean up temporary files
cleanup "${temp_files[@]}"
cleanup "$http_file" "$socks4_file" "$socks5_file" "$https_file" "$combined_file"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment