Advertisement
Guest User

Untitled

a guest
Nov 26th, 2019
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.69 KB | None | 0 0
  1. #!/usr/bin/env bash
  2. echo "[*] Script started"
  3. input="pdf_list.txt"
  4. keyword=$1
  5. output=$2
  6.  
  7. echo "[*] Finding all possible pdf files"
  8. find . -type f -name "*.pdf" > "$input"
  9.  
  10. echo "[*] PDF files found and saved in '"$input"'"
  11. cat "$input"
  12.  
  13. echo "[*] Finding possible emails"
  14. while IFS= read -r line
  15. do
  16.  
  17.     pdftotext "$line" - | grep "$keyword" >> tmp_list.txt
  18.     grep -i -o '[A-Z0-9._%+-]\+@[A-Z0-9.-]\+\.[A-Z]\{2,4\}' tmp_list.txt >> tmp_final.txt
  19.     #sort -u tmp_final.txt > final_list.txt
  20.     sort -u tmp_final.txt > "$output"
  21.  
  22. done < "$input"
  23.  
  24. echo "[*] Emails found and saved in $output"
  25. echo "[*] Cleaning up"
  26. rm -f tmp_list.txt && rm -f tmp_final.txt && rm -f "$input"
  27. echo "[*] Done"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement