Skip to content

Instantly share code, notes, and snippets.

@hateshape
Created March 28, 2020 21:40
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hateshape/0f6da68b5fdfa0fe2c9b08639fecd07c to your computer and use it in GitHub Desktop.
Save hateshape/0f6da68b5fdfa0fe2c9b08639fecd07c to your computer and use it in GitHub Desktop.
#!/bin/bash
# Run ffuf with whatever command line flags before running this, but then this will make it pretty after
# ./ffufs.sh <previous ffuf results>
# ./ffufs.sh bla.csv
# Pretty Colors
RESET='\033[00m'
RED='\033[01;31m'
GREEN='\033[01;32m'
BLUE='\033[01;34m'
MAGENTA='\033[01;35m'
WHITE='\033[01;37m'
# Removes the CSV Headers
sed -i '1d' $1
EXTRACTJUSTDOMAIN=$(head -1 $1 | cut -d, -f2 | cut -d\/ -f3)
EXTRACTPROTODOMAIN=$(head -1 $1 | cut -d, -f2 | cut -d\/ -f1-3)
# Sort'em Before Making Thems Pretty
sort -t\, -k 5,5n -k 6,6n $1 > $1-final-res.txt.tmp.sorted
# Making Thems Pretty
for x in `cat $1-final-res.txt.tmp.sorted`; do
THISWEBPATH=$(echo $x | cut -d, -f1)
THISSTATUS=$(echo $x | cut -d, -f5)
THISSIZE=$(echo $x | cut -d, -f6)
if [ `echo $THISSTATUS | grep "^2"` ]; then echo -e $EXTRACTPROTODOMAIN"/"$THISWEBPATH" [Status: "${GREEN}$THISSTATUS${RESET}", Size: "$THISSIZE"]" >> $1-final-res.txt.tmp; fi
if [ `echo $THISSTATUS | grep "^3"` ]; then echo -e $EXTRACTPROTODOMAIN"/"$THISWEBPATH" [Status: "${BLUE}$THISSTATUS${RESET}", Size: "$THISSIZE"]" >> $1-final-res.txt.tmp; fi
if [ `echo $THISSTATUS | grep "^4"` ]; then echo -e $EXTRACTPROTODOMAIN"/"$THISWEBPATH" [Status: "${MAGENTA}$THISSTATUS${RESET}", Size: "$THISSIZE"]" >> $1-final-res.txt.tmp; fi
if [ `echo $THISSTATUS | grep "^5"` ]; then echo -e $EXTRACTPROTODOMAIN"/"$THISWEBPATH" [Status: "${RED}$THISSTATUS${RESET}", Size: "$THISSIZE"]" >> $1-final-res.txt.tmp; fi
done
# Finishing Touches
echo -e ${BLUE}"RESULTS: ${WHITE}$EXTRACTPROTODOMAIN"${RESET} > $1-final-res.txt
cat $1-final-res.txt.tmp >> $1-final-res.txt
mv $1-final-res.txt $EXTRACTJUSTDOMAIN-final-res.txt
cat $EXTRACTJUSTDOMAIN-final-res.txt
rm $1-{final-res.txt.tmp,final-res.txt.tmp.sorted}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment