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 __init__(self): l = Library() p = Printer() name = raw_input("What is your name?") fav_color = raw_input("What is your favorite color?") hair_color = raw_input("What is your hair color?") birth_year = int(raw_input("What year were you born?(4 digits)")) current_year = int(raw_input("What is the current year?(4 digits)")) age = l.get_age(current_year, birth_year) p.print_out(age) color = l.get_color(fav_color) p.print_color(color) haircolor = l.get_haircolor(hair_color) p.print_haircolor(haircolor)
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
import pytest from lib import Printer test_array = [['1', '7'], ['2', '8'], ['3', '9'], ['4', '10'], ['5', '11'], ['6', '12']] subject = Printer() class TestPrinter: def test_print_string_6_player(self): assert subject.print_territories(test_array) == 'Player 1:\n1\n7\n\nPlayer 2:\n2\n8\n\nPlayer 3:\n3\n9\n\nPlayer 4:\n4\n10\n\nPlayer 5:\n5\n11\n\nPlayer 6:\n6\n12'
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...:("))
from lib import Assigner from lib import Printer full_list = [ 'Alaska', 'Northwest Territory', 'Greenland', 'Alberta', 'Ontario', 'Quebec', 'Western United States', 'Eastern United States', 'Central America', 'Venezuela', 'Peru', 'Brazil', 'Argentina', 'North Africa', 'Egypt', 'East Africa', 'Congo', 'South Africa', 'Madagascar', 'Iceland', 'Scandinavia', 'Ukraine', 'Great Britian', 'Northern Europe', 'Southern Europe', 'Western Europe', 'Indonesia', 'New Guinea', 'Western Australia', 'Eastern Australia', 'Siam', 'India', 'China', 'Mongolia', 'Japan', 'Irkutsk', 'Yakutsk', 'Kamchatka', 'Siberia', 'Afghanistan', 'Ural', 'Middle East' ] assigner = Assigner() scrambled_list = assigner.randomise(full_list) printer = Printer() number = 0 print("Please enter number of players (2-6): ") input = input() number = int(input) print('Printing territories for {} players...\n'.format(number)) chunked_territories = assigner.chunk_territories(scrambled_list, number) printer.print_territories(chunked_territories)