Skip to content

Instantly share code, notes, and snippets.

@ryaan-anthony
Created November 19, 2015 21:25
Show Gist options
  • Save ryaan-anthony/381c26ac40e5aafc0cfa to your computer and use it in GitHub Desktop.
Save ryaan-anthony/381c26ac40e5aafc0cfa to your computer and use it in GitHub Desktop.
#!/bin/bash
if [ -z $1 ]
then
echo 'Sitemap must be provided as first argument.';exit 2
fi
# Helper function to read xml
read_dom () {
local IFS=\>
read -d \< ENTITY CONTENT
}
mkdir tmp
cd tmp
wget $1
cd ../
while read_dom; do
if [[ $ENTITY = "loc" ]]; then
echo $CONTENT
fi
done < tmp/sitemap.xml > sitemap.txt
rm -rf tmp
@ryaan-anthony
Copy link
Author

Run this:

./xmltotxt.sh http://domain.com/path/to/sitemap.xml

Now you can siege all the urls:

siege -c50 -d10 -i -f sitemap.txt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment