Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Compare html served by different servers. This script will first get the page from the source ip and extract a list of links on this output. then it will compare the output of each link for both servers.
ip1='FILL-SOURCE-IP'; ip2='FILL-DEST-IP'; host='FILL-HOSTNAME'; curl http://$host | grep -o '<a.*href=.*>' | grep "http://$host" | sed -e 's/<a .*href=['"'"'"]//' -e 's/["'"'"'].*$//' -e '/^$/ d' > links.txt; for link in `cat links.txt`; do path=`echo -n $link | cut -d "/" -f 4-`; curl --header "Host: $host" "http://$ip1/$path" > ip1.html; curl --header "Host: $host" "http://$ip2/$path" > ip2.html; echo; echo "Diff http://$ip1/$path"; echo; diff ip1.html ip2.html; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment