Skip to content

Instantly share code, notes, and snippets.

@noobsdt
Last active August 15, 2020 15:28
Show Gist options
  • Save noobsdt/2979b3fbdc9f54ac3b47c168e134d49e to your computer and use it in GitHub Desktop.
Save noobsdt/2979b3fbdc9f54ac3b47c168e134d49e to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
import sys
import requests
import subprocess
from time import sleep
from bs4 import BeautifulSoup
from requests.utils import requote_uri
def dorking(dorks):
try:
url = 'https://www.google.com/search?q=site:' + dork + '%20' + sys.argv[1] + '&btnG=Search&hl=en-US&start=00&filter=0'
encoded_url = requote_uri(url)
print('\033[1;34m[*] Dork URL: ' + encoded_url + '\033[0m')
print()
req = requests.get(encoded_url)
soup = BeautifulSoup(req.text, 'html.parser')
links = soup.select('div .kCrYT a')
for link in links:
glink = link.get('href')
echo = subprocess.Popen(['echo', glink], stdout=subprocess.PIPE,)
sed = subprocess.Popen(['sed', 's/\/url?q=//'], stdin=echo.stdout, stdout=subprocess.PIPE,)
sed2 = subprocess.Popen(['sed', 's/&.*//'], stdin=sed.stdout, stdout=subprocess.PIPE,)
for link in sed2.stdout:
res = link.decode('ascii')
print(res.strip())
except ConnectionError:
print("Connection Error! 😣️")
if req.status_code == 429:
print("\033[1;36m[*] Need to solve Google reCaptcha! 😣️\033[0m")
sys.exit()
with open('vendors.txt') as file:
print("\033[1;34mCompany Or Keyword: " + sys.argv[1] + '\033[0m')
print()
for dork in list(file.readlines()):
#d = 'site:' + sys.argv[1] + '+' + dork
print(f'\033[1;32m[~] Searching for {dork} \033[0m')
try:
dorking(dork)
sleep(20)
print()
except:
print(f'\033[1;36m[*] Nothing found for {dork}\033[0m')
pass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment