Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env bash
- echo "[*] Script started"
- input="pdf_list.txt"
- keyword=$1
- output=$2
- echo "[*] Finding all possible pdf files"
- find . -type f -name "*.pdf" > "$input"
- echo "[*] PDF files found and saved in '"$input"'"
- cat "$input"
- echo "[*] Finding possible emails"
- while IFS= read -r line
- do
- pdftotext "$line" - | grep "$keyword" >> tmp_list.txt
- grep -i -o '[A-Z0-9._%+-]\+@[A-Z0-9.-]\+\.[A-Z]\{2,4\}' tmp_list.txt >> tmp_final.txt
- #sort -u tmp_final.txt > final_list.txt
- sort -u tmp_final.txt > "$output"
- done < "$input"
- echo "[*] Emails found and saved in $output"
- echo "[*] Cleaning up"
- rm -f tmp_list.txt && rm -f tmp_final.txt && rm -f "$input"
- echo "[*] Done"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement