Skip to content

Instantly share code, notes, and snippets.

@hateshape
Created March 28, 2020 21:40
Show Gist options
  • Save hateshape/0f6da68b5fdfa0fe2c9b08639fecd07c to your computer and use it in GitHub Desktop.
Save hateshape/0f6da68b5fdfa0fe2c9b08639fecd07c to your computer and use it in GitHub Desktop.

Revisions

  1. hateshape created this gist Mar 28, 2020.
    39 changes: 39 additions & 0 deletions ffufsv2.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,39 @@
    #!/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}