Skip to content

Instantly share code, notes, and snippets.

@NoDataFound
Created March 16, 2023 10:18
Show Gist options
  • Save NoDataFound/42e90a9e9a15531f10976d590c5000e1 to your computer and use it in GitHub Desktop.
Save NoDataFound/42e90a9e9a15531f10976d590c5000e1 to your computer and use it in GitHub Desktop.
SSC_Dork.py
# `SSC Portfolio` + `response['entries']['domain']` + `Google Dorks`
#filetype:pdf confidential site:portfolio_id+Domains
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import json
import requests
from dotenv import load_dotenv
import os
from prettytable import PrettyTable
import bs4
import time
import csv
load_dotenv('../.env')
api_token = os.environ.get('ASI_TOKEN')
headers = {
"Content-Type": "application/json",
"Authorization": f"Token {api_token}",
}
portfolio_id = "9"
url = 'https://api.securityscorecard.io/portfolios/'+portfolio_id+'/companies'
response = requests.get(url, headers=headers).json()
with open('google_dorks_log.csv', 'a+', encoding='UTF8', newline='') as f:
w = csv.writer(f, delimiter=',', quotechar='"', quoting=csv.QUOTE_MINIMAL)
for domains in response['entries'][:25]:
domain = domains['domain']
dorks = 'https://www.google.com/search?q=filetype%3Apdf+confidential+site%3A'+domain
dork_response = requests.get(dorks)
soup = bs4.BeautifulSoup(dork_response.text,
"html.parser")
time.sleep(.600)
heading_object=soup.find_all( 'h3' )
for info in heading_object:
#print(info.getText())
details = info.getText()
w.writerow([domain, dorks, details])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment