├── README.md └── scrape.sh /README.md: -------------------------------------------------------------------------------- 1 | # pastebin-scraper 2 | 3 | A tool that leverages the API of https://psbdmp.ws/ to find emails and domains dumped in pastebin which could lead to finding some juicy information. 4 | 5 | ## Usage 6 | 7 | ``` 8 | $ ./scrape.sh 9 | Usage: 10 | Search for domains - ./script.sh -d domain.com 11 | Search for emails - ./script.sh -e foo@bar.com 12 | General search - ./script.sh -g foobar 13 | ``` 14 | 15 | ## Example 16 | 17 | ``` 18 | $ ./scrape.sh -d facebook.com 19 | Searching pastebin... 20 | Task completed. Output present in ./output/domain/facebook.com/ 21 | ``` 22 | 23 | ## Installation 24 | 25 | ``` 26 | $ git clone https://github.com/streaak/pastebin-scraper.git 27 | $ cd pastebin-scraper 28 | $ sudo chmod +x ./scrape.sh 29 | $ sudo apt-get install jq 30 | $ mkdir -p output/domain/ output/email/ output/general/ 31 | ``` 32 | 33 | ## Output 34 | 35 | 36 | Outputs will either be stored in `./output/domain`, `./output/email` or `./output/general depending` depending on what you search for. The output will contain 2 files, `output.json` and `urls.txt`. `output.json` will contain the original json returned by the API in a beautified format and `urls.txt` will contain the URLs returned by the API in text format. 37 | 38 | ## TODO 39 | 40 | * Add more features 41 | 42 | ## Acknowledgments 43 | 44 | * [Tomnomnom](https://twitter.com/tomnomnom) 45 | * [Ed](https://twitter.com/edoverflow) 46 | * [CaptainFreak](https://twitter.com/0xcaptainfreak) 47 | -------------------------------------------------------------------------------- /scrape.sh: -------------------------------------------------------------------------------- 1 | echo -e "$(tput setaf 1) ____ ____ _____ __ ____ ____ ____ ___ ____ 2 | | \| \ / ___/ / ]| \ / || \ / _]| \ 3 | | o ) o ) _____( \_ / / | D )| o || o ) [_ | D ) 4 | | _/| || |\__ |/ / | / | || _/ _]| / 5 | | | | O ||_____|/ \ / \_ | \ | _ || | | [_ | \ 6 | | | | | \ \ || . \| | || | | || . \ 7 | |__| |_____| \___|\____||__|\_||__|__||__| |_____||__|\_|$(tput sgr0)" 8 | 9 | echo -e "\n\t\t\t\t By @Streaak" 10 | if [ $# -eq 0 ] || [ $1 == '-h' ]; then 11 | echo -e "$(tput setaf 2)\nUsage:$(tput sgr0)" 12 | echo "Search for domains - ./script.sh -d domain.com" 13 | echo "Search for emails - ./script.sh -e foo@bar.com" 14 | echo "General search - ./script.sh -g foobar" 15 | exit 0 16 | fi 17 | 18 | function scrape() { 19 | echo "Searching pastebin..." 20 | curl -s -X GET "$url" | python -m json.tool > ./output/$dir/output.json 21 | cat ./output/$dir/output.json | jq -r '.data[] | .id' | awk '{print "https://psbdmp.ws/" $1 }' > ./output/$dir/urls.txt 22 | echo "Task completed. Output present in ./output/$dir/$2" 23 | exit 0 24 | return 0 25 | } 26 | 27 | if [[ $1 == '-g' ]] && [[ $2 != '' ]] ; then 28 | dir=general/$2 29 | url=https://psbdmp.ws/api/search/$2 30 | mkdir -p ./output/$dir/ 31 | scrape 32 | elif [[ $2 == '' ]]; then 33 | echo "Missing Value. Try to run ./script.sh -g " 34 | exit 0 35 | fi 36 | 37 | if [[ $1 == '-e' ]] && [[ $2 != '' ]] ; then 38 | dir=email/$2 39 | url=https://psbdmp.ws/api/search/email/$2 40 | mkdir -p ./output/$dir/ 41 | scrape 42 | elif [[ $2 == '' ]]; then 43 | echo "Missing Value. Try to run ./script.sh -e " 44 | exit 0 45 | fi 46 | 47 | if [[ $1 == '-d' ]] && [[ $2 != '' ]] ; then 48 | dir=domain/$2 49 | url=https://psbdmp.ws/api/search/domain/$2 50 | mkdir -p ./output/$dir/ 51 | scrape 52 | elif [[ $2 == '' ]]; then 53 | echo "Missing Value. Try to run ./script.sh -d " 54 | exit 0 55 | fi 56 | --------------------------------------------------------------------------------