From 22b3800da1cc7c95e42773133905266dea2820dd Mon Sep 17 00:00:00 2001 From: m4ll0k Date: Sun, 12 Mar 2017 13:10:10 -0400 Subject: [PATCH] first commit --- README.md | 1 + infoga.py | 258 ++++++++++++++++++++++++++++++++++++++++++ lib/__init__.py | 4 + lib/color.py | 17 +++ lib/info.py | 13 +++ lib/parser.py | 45 ++++++++ recon/__init__.py | 4 + recon/bingsearch.py | 51 +++++++++ recon/googlesearch.py | 51 +++++++++ recon/pgpsearch.py | 51 +++++++++ recon/yahoosearch.py | 52 +++++++++ required.txt | 4 + 12 files changed, 551 insertions(+) create mode 100755 README.md create mode 100755 infoga.py create mode 100755 lib/__init__.py create mode 100755 lib/color.py create mode 100755 lib/info.py create mode 100755 lib/parser.py create mode 100755 recon/__init__.py create mode 100755 recon/bingsearch.py create mode 100755 recon/googlesearch.py create mode 100755 recon/pgpsearch.py create mode 100755 recon/yahoosearch.py create mode 100644 required.txt diff --git a/README.md b/README.md new file mode 100755 index 0000000..2dc0396 --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +# Infoga diff --git a/infoga.py b/infoga.py new file mode 100755 index 0000000..55560d9 --- /dev/null +++ b/infoga.py @@ -0,0 +1,258 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# infoga - Gathering Email Information Tool +# by M0M0 (m4ll0k) - (c) 2017 + + +__license__ = """ +Copyright (c) 2017, {M0M0 (m4ll0k)} +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of EnableSecurity or Trustwave nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, +INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE +OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED +OF THE POSSIBILITY OF SUCH DAMAGE. +""" + +from lib import color,parser, info +from recon import * +## +try: + import os + import sys + import urllib3 + import requests + import getopt + import re + import socket + import json + from urlparse import urlparse + from time import strftime, sleep +except ImportError as error: + print "\n{}[!] "+str(error)+"{}\n".format(color.incolor.RED,color.incolor.RESET) +## +## +class infoga: + ## + def __init__(self, argv): + self.argv = argv + self.allemails = [] + self.conn = "" + self.strf = "[%s] "% (strftime('%H:%M:%S')) + # colors + self.r = color.incolor.RED + self.y = color.incolor.YELLOW + self.w = color.incolor.WHITE + self.mw = color.incolor.MWHITE + self.t = color.incolor.RESET + self.g = color.incolor.GREEN + self.b = color.incolor.BLUE + self.c = color.incolor.CRIMSON + self.n = color.incolor.CYAN + self.i = color.incolor.IND + # info + self.ver = info.__version__ + self.name = info.__name__ + self.desc = info.__info__ + self.code = info.__codename__ + self.auth = info.__author__ + self.url = info.__giturl__ + + def banner(self): + # ---------------------------------------------------------------- + print "{} ___ ___ {}".format(self.r,self.t) + print "{}| .-----.' _.-----.-----.---.-. {}".format(self.r,self.t) + print "{}|. | | _| _ | _ | _ | {}".format(self.r,self.t) + print "{}|. |__|__|__| |_____|___ |___._| {}".format(self.r,self.t) + print "{}|: | |_____| {}{}\"{}\"{}".format(self.r,self.t,self.n,self.ver,self.t) + print "{}|::.|{}{} N4m3:{} {}{} - {}{} ".format(self.r,self.t,self.w,self.t,self.y,self.name,self.desc,self.t) + print "{}|:..|{}{} C0d3n4m3:{} {}{}{} ".format(self.r,self.t,self.w,self.t,self.y,self.code,self.t) + print "{}|...|{}{} 4uth0r:{} {}{}{} ".format(self.r,self.t,self.w,self.t,self.y,self.auth,self.t) + print "{}| - |{}{} Github:{} {}{}{}{} ".format(self.r,self.t,self.w,self.t,self.i,self.y,self.url,self.t) + print "{}`---'{} \n".format(self.r,self.t) + + def usage(self): + # ------------------------------------------------------------------ + path = os.path.basename(sys.argv[0]) + self.banner() + print "{}Usage: {} -t [target] -s [source]:{}\n".format(self.mw,path,self.t) + print "{}\t-t\tDomain to search or company name{}".format(self.mw,self.t) + print "{}\t-s\tData source: all, google, bing, pgp, yahoo{}".format(self.mw,self.t) + print "{}\t-h\tShow this help and exit{}\n".format(self.mw,self.t) + print "{}Examples:{}".format(self.mw,self.t) + print "{}\t{} -t site.com -s all{}".format(self.mw,path,self.t) + print "{}\t{} -t site.com -s [google, bing, pgp, yahoo]{}\n".format(self.mw,path,self.t) + + def google(self): + print "{}{}{}{}Searching \"{}\" in Google...{}".format(self.mw,self.strf,self.t,self.y,self.keyword,self.t) + search = googlesearch.google_search(self.keyword) + search.process() + self.allemails = search.get_emails() + + def bing(self): + print "{}{}{}{}Searching \"{}\" in Bing...{}".format(self.mw,self.strf,self.t,self.y,self.keyword,self.t) + search = bingsearch.bing_search(self.keyword) + search.process() + self.allemails = search.get_emails() + + def yahoo(self): + print "{}{}{}{}Searching \"{}\" in Yahoo...{}".format(self.mw,self.strf,self.t,self.y,self.keyword,self.t) + search = yahoosearch.yahoo_search(self.keyword) + search.process() + self.allemails = search.get_emails() + + def pgp(self): + print "{}{}{}{}Searching \"{}\" in PGP...{}".format(self.mw,self.strf,self.t,self.y,self.keyword,self.t) + search = pgpsearch.pgp_search(self.keyword) + search.process() + self.allemails = search.get_emails() + + def all(self): + self.google() + self.bing() + self.yahoo() + self.pgp() + self.allemails.extend(self.allemails) + self.allemails = sorted(set(self.allemails)) + + def queque(self, findip): + self.new = [] + for q in self.findip: + if q not in self.new: + self.new.append(q) + return self.new + def socket(self): + v = '\n'.join(self.new) + self.conn = socket.gethostbyaddr(v) + return self.conn[0] + + def start(self): + # ------------------------------------------------------------------ + if len(sys.argv) < 4: + self.usage() + sys.exit(0) + try: + opts,args = getopt.getopt(self.argv, "t:s:h") + except getopt.GetoptError: + self.usage() + sys.exit(0) + + for opt,arg in opts: + if opt == "-t": + self.keyword = arg + elif opt == "-h": + self.usage() + sys.exit(0) + elif opt == "-s": + self.engine = arg + if self.engine not in ("all, google, bing, pgp, yahoo"): + print "\n{}[!]{}{} Invalid search engine!! Try with: all, google, bing, yahoo or pgp.{}\n".format(self.r,self.t,self.w,self.t) + sleep(1) + self.usage() + sys.exit(0) + else: + pass + + o = urlparse(self.keyword) + if o[0] in ['http','https']: + print "\n{}[!]{}{} Invalid scheme!! Try without: http://, https:// and www. :){}\n".format(self.r,self.t,self.w,self.t) + sleep(1) + sys.exit(0) + else: + pass + + ############################### + ################################ + + if self.engine == "google": + self.banner() + self.google() + ###################### + elif self.engine == "bing": + self.banner() + self.bing() + ###################### + elif self.engine == "yahoo": + self.banner() + self.yahoo() + ###################### + elif self.engine == "pgp": + self.banner() + self.pgp() + ###################### + elif self.engine == "all": + self.banner() + self.all() + ####################### + ####################### + if self.allemails == []: + print "\n{}{}{}{}Not found emails!!{}\n".format(self.mw,self.strf,self.t,self.r,self.t) + sys.exit(0) + ## + else: + print "\n{}{}{}{}All Email Found: {}\n".format(self.mw,self.strf,self.t,self.y,self.t) + for x in xrange(len(self.allemails)): + data = {'lang':'en'} + data['email'] = self.allemails[x] + req = requests.post('http://www.mailtester.com/testmail.php', data=data) + regex = re.compile(r"[0-9]+(?:\.[0-9]+){3}") + self.findip = regex.findall(req.content) + self.queque(self.findip) + print "{}Email: {}{}".format(self.r,self.t,self.allemails[x]) + # ---- + for s in range(len(self.new)): + net = urllib3.PoolManager() + res = net.request('GET', "https://api.shodan.io/shodan/host/"+self.new[s]+\ + "?key=UNmOjxeFS2mPA3kmzm1sZwC0XjaTTksy") + self.jso = json.loads(res.data) + + if 'country_code' and 'country_name' in self.jso: + for c in range(len(self.new)): + print "\t\t|_ {}{}{} ({})".format(self.g,self.new[s],self.t,self.socket()) + print "\t\t\t|" + print "\t\t\t|__ Country: {}({}) - City: {} ({})".format(self.jso['country_code'],self.jso['country_name'],\ + self.jso['city'],self.jso['region_code']) + print "\t\t\t|__ ASN: {} - ISP: {}".format(self.jso['asn'],self.jso['isp']) + print "\t\t\t|__ Latitude: {} - Longitude: {}".format(self.jso['latitude'],self.jso['longitude']) + print "\t\t\t|__ Hostname: {} - Organization: {}".format(self.jso['hostnames'],self.jso['org']) + print "" + + elif 'No information available for that IP.' or 'error' in self.jso: + print "\t\t\t|__ {} ({})"% (self.new[s],self.socket()) + print "\t\t\t|\t|__{}No information available for that IP!!{}".format(self.r,self.t) + print "" + + else: + print "\t\t\t|__ {} ({})".format(self.new[s],self.socket()) + +def main(argv): + main = infoga(argv) + main.start() + +if __name__ == "__main__": + try: + main(sys.argv[1:]) + except KeyboardInterrupt as err: + print "\n{}[!] Ctrl+c.. :({}".format(color.incolor.RED,color.incolor.RESET) + sleep(0.5) + sys.exit(0) + + diff --git a/lib/__init__.py b/lib/__init__.py new file mode 100755 index 0000000..c90b815 --- /dev/null +++ b/lib/__init__.py @@ -0,0 +1,4 @@ +#!/usr/bin/env python +# -*- coding:utf-8 -*- + +__all__ = ['color','info','parser'] \ No newline at end of file diff --git a/lib/color.py b/lib/color.py new file mode 100755 index 0000000..d1bcacf --- /dev/null +++ b/lib/color.py @@ -0,0 +1,17 @@ +#!/usr/bin/env python +# -*- coding:utf-8 -*- +# infoga - Gathering Email Information Tool +# Coded by M0M0 (m4ll0k) + +class incolor: + """ Colors """ + BLUE = '\033[1;34m' + GREEN = '\033[1;32m' + RED = '\033[1;31m' + WHITE = '\033[1;37m' + CYAN = '\033[1;36m' + YELLOW = '\033[1;33m' + CRIMSON = '\033[1;38m' + RESET = '\033[0m' + IND = '\033[04m' + MWHITE = '\033[37m' \ No newline at end of file diff --git a/lib/info.py b/lib/info.py new file mode 100755 index 0000000..4a29c7b --- /dev/null +++ b/lib/info.py @@ -0,0 +1,13 @@ +#!/usr/bin/env python +# -*- coding:utf-8 -*- +# infoga - Gathering Email Information Tool +# Coded by M0M0 (m4ll0k) + +__info__ = 'Gathering Email Information' +__author__ = 'M@M@ (M4ll0k)' +__version__ = 'v2.2' +__codename__ = 'Sp4gh3tti' +__name__= "infoga" +__giturl__ = "https://github.com/m4ll0k/infoga" + + diff --git a/lib/parser.py b/lib/parser.py new file mode 100755 index 0000000..3209efc --- /dev/null +++ b/lib/parser.py @@ -0,0 +1,45 @@ +#!/usr/bin/env python +# -*- coding:utf-8 -*- +# infoga - Gathering Email Information Tool +# Coded by M0M0 (m4ll0k) + +import re +import string + +class inparser: + """Parser Results""" + def __init__(self, results, keyword): + self.results = results + self.keyword = keyword + self.tempora = [] + + def _clear(self): + self.results = re.sub('','',self.results) + self.results = re.sub('','',self.results) + self.results = re.sub('','',self.results) + self.results = re.sub('','',self.results) + self.results = re.sub('%2f',' ',self.results) + self.results = re.sub('%3a',' ',self.results) + self.results = re.sub('','',self.results) + self.results = re.sub('','',self.results) + self.results = re.sub('','',self.results) + self.results = re.sub('','',self.results) + + for x in ('>', ':', '=', '<', '/', '\\', ';', '&', '%3A', '%3D', '%3C'): + self.results = string.replace(self.results, x, ' ') + + def _unique(self): + self.new=[] + for x in self.tempora: + if x not in self.new: + self.new.append(x) + return self.new + + def _emails(self): + self._clear() + _regmail = re.compile('[a-zA-Z0-9.\-_+#~!$&\',;=:]+'+'@'+'[a-zA-Z0-9.-]*'+self.keyword) + self.tempora = _regmail.findall(self.results) + _emails = self._unique() + return _emails + + diff --git a/recon/__init__.py b/recon/__init__.py new file mode 100755 index 0000000..5990488 --- /dev/null +++ b/recon/__init__.py @@ -0,0 +1,4 @@ +#!/usr/bin/env python +# -*- coding:utf-8 -*- + +__all__ = ['googlesearch', 'bingsearch', 'pgpsearch','yahoosearch'] \ No newline at end of file diff --git a/recon/bingsearch.py b/recon/bingsearch.py new file mode 100755 index 0000000..befa1f4 --- /dev/null +++ b/recon/bingsearch.py @@ -0,0 +1,51 @@ +#!/usr/bin/env python +# -*- coding:utf-8 -*- +# infoga - Gathering Email Information Tool +# Coded by M0M0 (m4ll0k) + +import httplib +import re +import string +import sys +from lib import color +from lib import parser + + +class bing_search: + + """Bing Search Engine""" + + def __init__(self, keyword): + self.keyword = keyword + self.results = "" + self.tresult = "" + self.server = "www.bing.com" + self.host = "www.bing.com" + self.u_agent = "(Mozilla/5.0 (Windows; U; Windows NT 6.0;en-US; rv:1.9.2) Gecko/20100115 Firefox/3.6" + self.t = color.incolor.RESET + self.r = color.incolor.RED + self.y = color.incolor.YELLOW + + def run_search(self): + try: + con = httplib.HTTP(self.server) + con.putrequest('GET', '/search?q=%40'+self.keyword) + con.putheader('Host', self.host) + con.putheader('Cookie', 'SRCHHPGUSR=ADLT=DEMOTE&NRSLT=50') + con.putheader('Accept-Language', 'en-us,en') + con.putheader('User-agent', self.u_agent) + con.endheaders() + # return code,messagge and header + returncode, returnmsg, header = con.getreply() + self.results = con.getfile().read() + self.tresult += self.results + except Exception as err: + print "\t\t|" + print "\t\t|__"+self.r+" Server not found!!\n"+self.t + + def get_emails(self): + _findemail = parser.inparser(self.tresult, self.keyword) + return _findemail._emails() + + def process(self): + self.run_search() \ No newline at end of file diff --git a/recon/googlesearch.py b/recon/googlesearch.py new file mode 100755 index 0000000..0e90558 --- /dev/null +++ b/recon/googlesearch.py @@ -0,0 +1,51 @@ +#!/usr/bin/env python +# -*- coding:utf-8 -*- +# infoga - Gathering Email Information Tool +# Coded by M0M0 (m4ll0k) + + +import requests +import re +import string +import sys +from lib import color +from lib import parser + +class google_search: + + """ Google Search Engine """ + + def __init__(self, keyword): + self.keyword = keyword + self.results = "" + self.tresult = "" + self.server = "www.google.com" + self.u_agent = "(Mozilla/5.0 (Windows; U; Windows NT 6.0;en-US; rv:1.9.2) Gecko/20100115 Firefox/3.6" + self.r = color.incolor.RED + self.y = color.incolor.YELLOW + self.w = color.incolor.WHITE + self.t = color.incolor.RESET + + def run_search(self): + try: + urlfy = "http://" +self.server+ "/search?num=500&start=50&hl=en&meta=&q=%40\"" +self.keyword+ "\"" + try: + req = requests.get(urlfy) + self.results = req.content + self.tresult += self.results + except Exception as err: + print "\t\t|" + print "\t\t|__"+self.r+" Server not found!!\n"+self.t + except Exception as err: + print str(err) + + def get_emails(self): + _findemails = parser.inparser(self.tresult, self.keyword) + return _findemails._emails() + + def process(self): + self.run_search() + + + + diff --git a/recon/pgpsearch.py b/recon/pgpsearch.py new file mode 100755 index 0000000..99c2394 --- /dev/null +++ b/recon/pgpsearch.py @@ -0,0 +1,51 @@ +#!/usr/bin/env python +# -*- coding:utf-8 -*- +# infoga - Gathering Email Information Tool +# Coded by M0M0 (m4ll0k) + + +import httplib +import re +import string +import sys +from lib import color +from lib import parser + + +class pgp_search: + + """PGP Server Search Engine""" + + def __init__(self, keyword): + '''pgp server search''' + self.keyword = keyword + self.results = "" + self.tresult = "" + self.server = "pgp.mit.edu" + self.host = "pgp.mit.edu" + self.u_agent = "(Mozilla/5.0 (Windows; U; Windows NT 6.0;en-US; rv:1.9.2) Gecko/20100115 Firefox/3.6" + self.t = color.incolor.RESET + self.r = color.incolor.RED + self.y = color.incolor.YELLOW + + def run_search(self): + try: + con = httplib.HTTP(self.server) + con.putrequest('GET', "/pks/lookup?search="+self.keyword+"&op=index") + con.putheader('Host', self.host) + con.putheader('User-agent', self.u_agent) + con.endheaders() + # return code,message and header + returncode, returnmsg, header = con.getreply() + self.results = con.getfile().read() + self.tresult += self.results + except Exception as err: + print "\t\t|" + print "\t\t|__"+self.r+" Server not found!!\n"+self.t + + def get_emails(self): + _findemail = parser.inparser(self.tresult, self.keyword) + return _findemail._emails() + + def process(self): + self.run_search() \ No newline at end of file diff --git a/recon/yahoosearch.py b/recon/yahoosearch.py new file mode 100755 index 0000000..b5a196b --- /dev/null +++ b/recon/yahoosearch.py @@ -0,0 +1,52 @@ +#!/usr/bin/env python +# -*- coding:utf-8 -*- +# infoga - Gathering Email Information Tool +# Coded by M0M0 (m4ll0k) + +import httplib +import re +import string +import sys +from lib import color +from lib import parser + +class yahoo_search: + + """Yahoo Search Engine""" + + def __init__(self, keyword): + + self.keyword = keyword + self.results = "" + self.tresult = "" + self.server = "search.yahoo.com" + self.host = "search.yahoo.com" + self.u_agent = "(Mozilla/5.0 (Windows; U; Windows NT 6.0;en-US; rv:1.9.2) Gecko/20100115 Firefox/3.6" + self.t = color.incolor.RESET + self.r = color.incolor.RED + self.y = color.incolor.YELLOW + + def run_search(self): + + try: + con = httplib.HTTP(self.server) + con.putrequest('GET', "/search?p=\"%40" +self.keyword+ "\"&b=500&pz=10") + con.putheader('Host', self.host) + con.putheader('User-agent', self.u_agent) + con.endheaders() + # return code,msg and header + returncode, returnmsg, headers = con.getreply() + self.results = con.getfile().read() + self.tresult += self.results + except Exception as err: + print "\t\t|" + print "\t\t|__ {} Server not found!\n {}".format(self.r,self.t) + + def get_emails(self): + + _findemails = parser.inparser(self.tresult, self.keyword) + return _findemails._emails() + + def process(self): + + self.run_search() diff --git a/required.txt b/required.txt new file mode 100644 index 0000000..38939d3 --- /dev/null +++ b/required.txt @@ -0,0 +1,4 @@ +requests +urllib3 +urlparse +