Skip to content

Instantly share code, notes, and snippets.

@bl4de
Created May 31, 2016 22:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bl4de/f62b0ede49d372abb5ef49093a4e6c8d to your computer and use it in GitHub Desktop.
Save bl4de/f62b0ede49d372abb5ef49093a4e6c8d to your computer and use it in GitHub Desktop.
XSSaminer by @BruteLogic - tool for finding XSS in PHP source code
#!/bin/bash
# 1) save it as xssaminer
# 2) allow execution: chmod +x xssaminer
# 3) run it & check usage: ./xssaminer
if [ -z $1 ]
then
echo -e "Usage:\n$0 FILE\n$0 -r FOLDER"
exit
else
f=$1
fi
sources=(GET POST REQUEST "SERVER\['PHP" "SERVER\['PATH_" "SERVER\['REQUEST_U")
sinks=(echo die print printf print_r var_dump)
xssam(){
for i in ${sources[@]}
do
a=$(grep -in "\$_${i}" $f | grep -o "\$.*=" | sed "s/[ ]\?=//g" | sort -u)
for j in ${sinks[@]}
do
grep --color -in "${j}.*\$_${i}" $f
for k in $a
do
grep --color -in "${j}.*$k" $f
done
done
done
}
if [ $f != "-r" ]
then
xssam
else
for i in $(find $2 -type f -name "*.php")
do
echo "File: $i"
f=$i
xssam
done
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment