Skip to content

Instantly share code, notes, and snippets.

@daudmalik06
Forked from EdOverflow/reddit.sh
Created April 29, 2018 10:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save daudmalik06/0fec7bc9b24541873dfb8734f7c0459a to your computer and use it in GitHub Desktop.
Save daudmalik06/0fec7bc9b24541873dfb8734f7c0459a to your computer and use it in GitHub Desktop.
Use reddit.com for recon purposes.
#!/bin/bash
# Variables
BOLD='\033[1m'
END='\033[0m'
# Queries
site_results=$(curl -Ls "https://www.reddit.com/search?q=site%3A$1" -H "User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0" | tidy -q 2> /dev/null | grep "search-link")
url_results=$(curl -Ls "https://www.reddit.com/search?q=url%3A$1" -H "User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0" | tidy -q 2> /dev/null | grep "search-link")
self_results=$(curl -Ls "https://www.reddit.com/search?q=selftext%3A$1" -H "User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0" | grep "search-title")
# Output
echo
echo -e "${BOLD}Hosts:${END}"
echo "========================"
echo $site_results | grep -Po '.*?//\K.*?(?=/)' | sort | uniq
echo
echo -e "${BOLD}Links:${END}"
echo "========================"
echo $site_results | grep -Eo "(http|https)://[a-zA-Z0-9./?=_-]*" | sort | uniq
echo $url_results | grep -Eo "(http|https)://[a-zA-Z0-9./?=_-]*" | sort | uniq
echo
echo -e "${BOLD}Self-posts:${END}"
echo "========================"
echo $self_results | grep -Eo "(http|https)://[a-zA-Z0-9./?=_-]*" | grep "comments" | sort | uniq
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment