diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..fbfa7d1 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +**/*.pyc diff --git a/discovery/googlesearch.py b/discovery/googlesearch.py index f3ac972..94bbaa1 100644 --- a/discovery/googlesearch.py +++ b/discovery/googlesearch.py @@ -5,20 +5,20 @@ import time class search_google: - def __init__(self,word,limit,start,filetype): + def __init__(self,word,limit,start,filetype, area): self.word=word self.results="" self.totalresults="" self.filetype=filetype - self.server="www.google.com" - self.hostname="www.google.com" + self.server="google.com" + "." + area + self.hostname="www.google.com" + "." + area self.userAgent="(Mozilla/5.0 (Windows; U; Windows NT 6.0;en-US; rv:1.9.2) Gecko/20100115 Firefox/3.6" self.quantity="100" self.limit=limit self.counter=start def do_search_files(self): - h = httplib.HTTP(self.server) + h = httplib.HTTPS(self.server) h.putrequest('GET', "/search?num="+self.quantity+"&start=" + str(self.counter) + "&hl=en&meta=&q=filetype:"+self.filetype+"%20site:" + self.word) h.putheader('Host', self.hostname) h.putheader('User-agent', self.userAgent) diff --git a/metagoofil.py b/metagoofil.py index c702017..f136b23 100644 --- a/metagoofil.py +++ b/metagoofil.py @@ -31,7 +31,8 @@ def usage(): print " -h: work with documents in directory (use \"yes\" for local analysis)" print " -n: limit of files to download" print " -o: working directory (location to save downloaded files)" - print " -f: output file\n" + print " -f: output file" + print " -a: google area(example:hk, default:com)\n" print " Examples:" print " metagoofil.py -d apple.com -t doc,pdf -l 200 -n 50 -o applefiles -f results.html" print " metagoofil.py -h yes -o applefiles -f results.html (local dir analysis)\n" @@ -50,10 +51,11 @@ def doprocess(argv): localanalysis = "no" failedfiles = [] emails = [] + area = "com" if len(sys.argv) < 3: usage() try: - opts, args = getopt.getopt(argv, "l:d:f:h:n:t:o:") + opts, args = getopt.getopt(argv, "l:d:f:h:n:t:o:a:") except getopt.GetoptError: usage() for opt, arg in opts: @@ -76,6 +78,8 @@ def doprocess(argv): dir = arg elif opt == '-f': outhtml = arg + elif opt == '-a': + area = arg if os.path.exists(dir): pass else: @@ -84,7 +88,7 @@ def doprocess(argv): print "\n[-] Starting online search..." for filetype in filetypes: print "\n[-] Searching for "+ filetype + " files, with a limit of " + str(limit) - search = googlesearch.search_google(word, limit, start, filetype) + search = googlesearch.search_google(word, limit, start, filetype, area) search.process_files() files = search.get_files() print "Results: " + str(len(files)) + " files found"