Do a pip install google before running .
~ whfg sbe gur fnxr bs 10 cbfg
~ whfg sbe gur fnxr bs 10 cbfg
Code:
from optparse import OptionParser
import warnings
import urllib2
warnings.filterwarnings("ignore")
options = OptionParser(usage='%prog search [options]', description='Google fetch dork ~s0l@r*')
options.add_option('-c', '--count', type='int', default=5, help='Count of results')
options.add_option('-o', '--output', type='string', default='solar.txt', help='LOg output')
class bcolors:
HEADER = '\033[95m'
OKBLUE = '\033[94m'
OKGREEN = '\033[92m'
WARNING = '\033[93m'
ENDC = '\033[0m'
BOLD = '\033[91m'
class HeadRequest(urllib2.Request):
def get_method(self):
return "HEAD"
def addLog(target, opts):
output = open(opts.output, "a")
output.write(target + '\n')
output.close()
def main():
print bcolors.BOLD + """
___ _______ .__ _____
/ _ \_/\ _____\ _ \ | | / ___ \_______ /\|\/\
\/ \___/ / ___/ /_\ \| | / / ._\ \_ __ \ _) (__
\___ \\ \_/ \ |_< \_____/| | \/ \_ _/
/____ >\_____ /____/\_____\ |__| ) \
\/ \/ \/\|\/
""" + bcolors.ENDC
opts, args = options.parse_args()
z = 0
if len(args) < 1:
options.print_help()
exit()
domainList = []
print "Started .. "
print bcolors.WARNING + "-"*15 + bcolors.ENDC
from google import search
for url in search(args[0], stop=opts.count):
request = HeadRequest(url)
try:
response = urllib2.urlopen(request)
response_headers = response.info()
print response_headers.dict
except urllib2.HTTPError, e:
print ("Error code: %s" % e.code)
print bcolors.WARNING + "@> " + url + bcolors.ENDC
domainList.append(url)
print bcolors.WARNING + "-"*15 + bcolors.ENDC
print bcolors.BOLD + "Search Complete, filtering results." + bcolors.ENDC
domainList = list(set(domainList))
print bcolors.BOLD + "Building log." + bcolors.ENDC
for target in domainList:
addLog(target, opts)
print bcolors.BOLD + "Fetch complete : " + bcolors.ENDC + opts.output
if __name__ == '__main__':
main()