Skip to content

Instantly share code, notes, and snippets.

@mhahl
Created May 15, 2016 07:54
Show Gist options
  • Save mhahl/34f4c4baeea9e9090debb6f6cebc3dfd to your computer and use it in GitHub Desktop.
Save mhahl/34f4c4baeea9e9090debb6f6cebc3dfd to your computer and use it in GitHub Desktop.
Hit a URL thought a number of different proxies using a list of user-agents
#!/bin/bash
# http://www.user-agents.org/allagents.xml
userAgents=`cat allagents.xml | grep -iB 5 '<Type>B</Type>' | grep -i '<String>' | cut -c 9- | sed 's/..........$//'`
function getRandomUA()
{
maxLines=`echo "$userAgents" | wc -l | tr -d ' '`
randomUserAgent=$(echo "$userAgents" | sed -n $[ ( $RANDOM % ( $[ $maxLines - 1 ] + 1 ) ) + 1 ]p)
echo $randomUserAgent
}
cat proxy.txt | while read line
do
ua=$(getRandomUA);
echo -x "$line" -A \"$ua\" http://URLGOESHERE.example.com
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment