OP 22 September, 2023 - 05:45 PM
PROXY SCRAPER
Hello everyone ! I came back to cracking and to give back to the community I decided to make my own shell script for whoever has an API for proxies and wants to utilize it , you can view the source code over here and copy paste it , make sure to put the correct extension "file.sh" at the end .
This code sends an http request to the api , checks if theres any errors , prints data and saves each type of proxy into .txt files
Don't forget to type in your terminal : chmod +x script.sh
SOURCE CODE :
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Make sure to Like subscribe and click on the notification bell ;)
This code sends an http request to the api , checks if theres any errors , prints data and saves each type of proxy into .txt files
Don't forget to type in your terminal : chmod +x script.sh
SOURCE CODE :
Code:
#!/bin/bash
while true; do
# Put proxy api Here [/size][/color]
[color=#000000][size=large] PROXY_DATA=$(curl -s "http://apiurl.com")
# Check if the curl command encountered an error
if [ $? -ne 0 ]; then
echo "Failed to fetch proxy data."
sleep 10
continue
fi
# Print the entire JSON response for debugging
echo "Received JSON response: $PROXY_DATA"
# Extract proxy type and value using jq
PROXY_TYPE=$(echo "$PROXY_DATA" | jq -r '.protocol')
PROXY_VALUE=$(echo "$PROXY_DATA" | jq -r '.proxy')
# Check if proxy type or value is null
if [ "$PROXY_TYPE" = "null" ] || [ "$PROXY_VALUE" = "null" ]; then
echo "Failed to parse proxy data."
sleep 10
continue
fi
# Determine the output file based on proxy type
case "$PROXY_TYPE" in
"http")
OUTPUT_FILE="http.txt"
;;
"socks4")
OUTPUT_FILE="socks4.txt"
;;
"socks5")
OUTPUT_FILE="socks5.txt"
;;
*)
echo "Unknown proxy type: $PROXY_TYPE"
sleep 10
continue
;;
esac
# Save the proxy value to the appropriate file
echo "$PROXY_VALUE" >> "$OUTPUT_FILE"
# Display proxy details
echo "Proxy Data:"
echo "Type: $PROXY_TYPE"
echo "Value: $PROXY_VALUE"
# Sleep for a while before fetching the next proxy (adjust the sleep duration as needed)
sleep 10
done[/size][/color][/color][/size]
Make sure to Like subscribe and click on the notification bell ;)