def CheckUpdate(self): self.Banner() if ".git" not in os.listdir(os.getcwd()): sys.exit(Printer.MyPrinter().eprint("Git directory not found, please download Infoga from Github repository")) elif ".git" in os.listdir(os.getcwd()): Printer.MyPrinter().nprint("Updateting...") os.chdir(os.getcwd()+"/.git") os.system("git pull") sys.exit()
def Start(self): if len(sys.argv) < 2: self.Usage() try: opts, args = getopt.getopt( self.argv, "t:s:i:", ["target=", "source=", "info=", "update", "version", "help"]) except getopt.GetoptError: self.Usage() for opt, arg in opts: if opt in ("-t", "--target"): self.Keyword = arg self.CheckUrl(self.Keyword) elif opt in ("-s", "--source"): self.engine = arg if self.engine not in ("all", "google", "bing", "yahoo", "pgp"): self.Banner() sys.exit(Printer.MyPrinter().eprint( "Invalid search engine!! Try with: all,google, bing, yahoo or pgp" )) elif opt in ("-i", "--info"): self.email = arg self.CheckEmail(self.email) elif opt == "--help": self.Usage() elif opt == "--version": self.CheckVersion() elif opt == "--update": self.CheckUpdate() self.Banner() Netcraft.netcraft(self.CheckUrl(self.Keyword)).Run() if self.engine == "google": self.Google() if self.engine == "bing": self.Bing() if self.engine == "yahoo": self.Yahoo() if self.engine == "pgp": self.Pgp() if self.engine == "all": self.All() if self.AllEmails == []: sys.exit(Printer.MyPrinter().eprint("Not found email!")) else: self.AllEmails = sorted(set(self.AllEmails)) Printer.MyPrinter().nprint("All email found: ") self.GetInfo()
def CheckEmail(self, email): if "@" not in email: self.Banner() sys.exit( Printer.MyPrinter().eprint("Invalid email!! Check your email")) self.Banner() self.Getinfo(email)
def Getinfo(self, email): Printer.MyPrinter().mprint("Email: %s" % (email)) data = {'lang': 'en'} data['email'] = email req = requests.post("http://mailtester.com/testmail.php", data=data) regex = re.compile("[0-9]+(?:\.[0-9]+){3}") ip = regex.findall(req.content) new = [] for e in ip: if e not in new: new.append(e) for s in range(len(new)): net = urllib3.disable_warnings() net = urllib3.PoolManager() res = net.request( "GET", "https://api.shodan.io/shodan/host/" + new[s] + "?key=UNmOjxeFS2mPA3kmzm1sZwC0XjaTTksy") jso = json.loads(res.data) try: self.sock = socket.gethostbyaddr(new[s])[0] except socket.herror, err: try: self.sock = (jso["hostnames"][0]) except KeyError, err: pass
def Pgp(self): Printer.MyPrinter().nprint("Searching \"%s\" in Pgp..." % (self.CheckUrl(self.Keyword))) Search = PgpSearch.Pgpsearch(self.CheckUrl(self.Keyword)) Search.Process() Emails = Search.GetEmail() self.AllEmails.extend(Emails)
def Yahoo(self): Printer.MyPrinter().nprint("Searching \"%s\" in Yahoo..." % (self.CheckUrl(self.Keyword))) Search = YahooSearch.Yahoosearch(self.CheckUrl(self.Keyword)) Search.Process() Emails = Search.GetEmail() self.AllEmails.extend(Emails)
def Bing(self): Printer.MyPrinter().nprint("Searching \"%s\" in Bing..." % (self.CheckUrl(self.Keyword))) Search = BingSearch.Bingsearch(self.CheckUrl(self.Keyword)) Search.Process() Emails = Search.GetEmail() self.AllEmails.extend(Emails)
def Google(self): Printer.MyPrinter().nprint("Searching \"%s\" in Google..." % (self.CheckUrl(self.Keyword))) Search = GoogleSearch.Googlesearch(self.CheckUrl(self.Keyword)) Search.Process() Emails = Search.GetEmail() self.AllEmails.extend(Emails)
def GetInfo(self): for x in range(len(self.AllEmails)): Printer.MyPrinter().mprint("Email: %s"%(self.AllEmails[x])) data = {'lang':'en'} data['email'] = self.AllEmails[x] req = requests.post("http://mailtester.com/testmail.php",data=data) regex = re.compile("[0-9]+(?:\.[0-9]+){3}") ip = regex.findall(req.content) new = [] for e in ip: if e not in new: new.append(e) for s in range(len(new)): net = urllib3.PoolManager() res = net.request("GET","https://api.shodan.io/shodan/host/"+new[s]+"?key=UNmOjxeFS2mPA3kmzm1sZwC0XjaTTksy") jso = json.loads(res.data) try: self.sock = socket.gethostbyaddr(new[s])[0] except socket.herror,err: try: self.sock = jso["hostnames"][0] except KeyError,err: pass if "country_code" and "country_name" in jso: print "\t\t|_ %s (%s)"%(new[s],self.sock) print "\t\t\t|" print "\t\t\t|__ Country: %s(%s) - City: %s (%s)"%(jso["country_code"],jso["country_name"],jso["city"],jso["region_code"]) print "\t\t\t|__ ASN: %s - ISP: %s"%(jso["asn"],jso["isp"]) print "\t\t\t|__ Latitude: %s - Longitude: %s"%(jso["latitude"],jso["longitude"]) print "\t\t\t|__ Hostname: %s - Organization: %s"%(jso["hostnames"][0],jso["org"]) try: print "\t\t\t|__ Vulns: %s - Ports: %s"%(jso["vulns"][0],jso["ports"][0]) except KeyError,err: pass print ""
def Run(self): try: ((url)) = (( "http://searchdns.netcraft.com/?restriction=site+contains&host=%s&lookup=wait..&position=limited" % (self.target))) ((html)) = ((Net.Conn().Urllib2(url, None, self.headers))) if html: ((reg)) = ((re.findall('url=\S+"', html, re.I))) print "" ((Printer.MyPrinter().nprint("Searching \"" + (self.target) + "\" Websites Correlation..."))) if reg: ((Printer.MyPrinter().nprint("Found %s sites " % (len(reg))))) print "" for x in range(len(reg)): ((host)) = ((reg[x].split('"')[0])) print((" - %s" % (host.split("url=")[1]))) print "" else: ((Printer.MyPrinter().iprint("Not found sites"))) except Exception, err: pass
def CheckUrl(self,url): o = urlparse.urlsplit(url) scheme = o.scheme netloc = o.netloc path = o.path if scheme not in ["http","https",""]: self.Banner() sys.exit(Printer.MyPrinter().eprint("Scheme %s not supported!"%(scheme))) if netloc == "": if path.startswith("www."): return path.split("www.")[1] else: return path else: if netloc.startswith("www."): return netloc.split("www.")[1] else: return netloc
elif opt == "--version": self.CheckVersion() elif opt == "--update": self.CheckUpdate() self.Banner() Netcraft.netcraft(self.CheckUrl(self.Keyword)).Run() if self.engine == "google": self.Google() if self.engine == "bing": self.Bing() if self.engine == "yahoo": self.Yahoo() if self.engine == "pgp": self.Pgp() if self.engine == "all": self.All() if self.AllEmails == []: sys.exit(Printer.MyPrinter().eprint("Not found email!")) else: self.AllEmails = sorted(set(self.AllEmails)) Printer.MyPrinter().nprint("All email found: ") self.GetInfo() if __name__ == "__main__": try: Infoga(sys.argv[1:]).Start() except KeyboardInterrupt, err: sys.exit(Printer.MyPrinter().eprint("Ctr+c...:("))