Guest User

Untitled

a guest
Oct 7th, 2020
46
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/bash
  2. if [ "$#" != "1" ]; then
  3.         echo "Usage: breach-parse <domain to search> <file to output> or \n breach-parse <domain to search><domain to search> <file to output>"
  4.         exit 1
  5. else
  6.         master=results.txt
  7.         path="$(pwd)/data/"
  8.  
  9.         touch $master
  10.         total_Files=$(find $path -type f | wc -l)
  11.         file_count=0
  12.  
  13.         function ProgressBar {
  14.                 let _progress=(${file_count}*100/${total_Files}*100)/100
  15.                 let _done=(${_progress}*4)/10
  16.                 let _left=40-${_done}
  17.  
  18.                 _fill=$(printf "%${_done}s")
  19.                 _empty=$(printf "%${_left}s")
  20.  
  21.         printf "\r Progress : [${_fill// /\#}${_empty// /-}] ${_progress}%%"
  22.         }
  23.  
  24.         find $path -type f -print0 | while read -d $'\0' file
  25.         do
  26.                 grep -a -E "$1" "$file" >> $master
  27.                 ((++file_count))
  28.                 ProgressBar ${number} ${total_Files}
  29.         done
  30. fi
  31. echo
  32. echo
  33. echo  Results:
  34.  
  35. cat $master
  36. rm $master
  37. exit 0
RAW Paste Data