#!/bin/bash # $Id: setuas.sh 1/18/2012 # email: zitstif[@]gmail.com # website: http://zitstif.no-ip.org/ # name: Kyle Young # This program is for switching the user agent string on the cloner.py # module of the Social Engineering Toolkit(SET). SET is available at: # http://www.secmaniac.com/ function help() { echo "[---Social Engineering Toolkit UserAgent Switcher---]"; echo -e "\t./setuas.sh [location to cloner.py]"; echo "Example:"; echo -e "\t./setuas.sh /pentest/exploits/set/src/webattack/web_clone/cloner.py" exit 254; } if [ $# -lt 1 ]; then help; fi if echo ${1} | egrep "(\-h|\-H|--help)" &> /dev/null; then help; fi if [ ! -e ${1} ]; then echo "The file you specified does not appear to exist"; exit 1; else if echo ${1} | fgrep 'cloner.py' &> /dev/null; then if egrep "Macintosh\; U\; Intel Mac OS X 10.6\; en-US\; rv:1.9.2\) Gecko\/20100115" ${1} &> /dev/null; then FILE=${1} else echo "The user agent string appears to be different already.. are you sure this is the original file?"; echo "To restore the original file, replace cloner.py with cloner.py.bk (cp cloner.py.bk cloner.py)"; exit 1; fi else echo "This does not appear to be the cloner.py file.."; exit 1; fi fi echo "[---Social Engineering Toolkit UserAgent Switcher---]"; echo "Backing up original file..." echo "To restore the original file, replace cloner.py with cloner.py.bk"; echo "You may have to be root for this program to work.." cp ${FILE} $(echo ${FILE} | sed 's/cloner.py/cloner.py.bk/g'); echo "Paste/Enter in the user agent string you would like to use:"; echo "WARNING: MAKE SURE IT IS IN THE PROPPER FORMAT"; echo "Example: Mozilla/5.0 (Ubuntu; X11; Linux i686; rv:8.0) Gecko/20100101 Firefox/8.0"; read USERAGENT; echo "Reparsing the UserAgent string.." NewUSERAGENT="$(printf "${USERAGENT}" | sed 's/\//\\\//g')" echo "Replacing original UserAgent String in cloner.py..." NEWFILE="$(echo ${FILE} | sed 's/cloner.py/cloner.py.tmp/g')" sed "s/Mozilla\/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2) Gecko\/20100115 Firefox\/3.6/${NewUSERAGENT}/g" ${FILE} > ${NEWFILE}; mv ${NEWFILE} ${FILE}; echo "The UserAgent String of the Social Engineering toolkit should be:" echo "${USERAGENT}"; echo "Successfully exiting.." exit 0;