def checkPhoneDetails(query=None): ''' Method that checks if the given hash is stored in the md5crack.com website. :param query: query to verify. :return: Python structure. ''' results = [] #TO-DO executing the query against Google and grab the results # The query should be something like "<QUERY> site:infobel.com" search = query + " site:infobel.com" # This will return a list of i3visio.uri objects uriObjects = google.processSearch(search) #TO-DO: grabbing the phone details for the QUERY for uri in uriObjects: # Recovering the website # Accessing the resources textResults = processing.getResults(uri["value"]) # Iterating over every result to process it and recover a person object for r in textResults: person = {} fullname = "" person["type"]="i3visio.person" person["value"] = "FULLNAME_NOT_FOUND" person["attributes"] = processing.extractFieldsFromResult(r) for entity in person["attributes"]: if entity["type"] == "i3visio.fullname": person["value"] = entity["value"] break # Appending the Uri of the infobel record: aux = {} aux["type"]= "i3visio.uri" aux["value"] = uri["value"] aux["attributes"] = [] person["attributes"].append(aux) # Appending the platform of the infobel record: aux = {} aux["type"]= "i3visio.platform" aux["value"] = "Infobel" aux["attributes"] = [] person["attributes"].append(aux) # Appending to the results results.append(person) return results
def checkPhoneDetails(query=None): ''' Method that checks if the given hash is stored in the md5crack.com website. :param query: query to verify. :return: Python structure. ''' results = [] #TO-DO executing the query against Google and grab the results # The query should be something like "<QUERY> site:infobel.com" search = query + " site:infobel.com" # This will return a list of i3visio.uri objects uriObjects = google.processSearch(search) #TO-DO: grabbing the phone details for the QUERY for uri in uriObjects: # Recovering the website # Accessing the resources textResults = processing.getResults(uri["value"]) # Iterating over every result to process it and recover a person object for r in textResults: person = {} fullname = "" person["type"] = "i3visio.person" person["value"] = "FULLNAME_NOT_FOUND" person["attributes"] = processing.extractFieldsFromResult(r) for entity in person["attributes"]: if entity["type"] == "i3visio.fullname": person["value"] = entity["value"] break # Appending the Uri of the infobel record: aux = {} aux["type"] = "i3visio.uri" aux["value"] = uri["value"] aux["attributes"] = [] person["attributes"].append(aux) # Appending the platform of the infobel record: aux = {} aux["type"] = "i3visio.platform" aux["value"] = "Infobel" aux["attributes"] = [] person["attributes"].append(aux) # Appending to the results results.append(person) return results
def domainToGoogleSearchUriWithEmails(argv): ''' List of URI entities corresponding to the results of a Google Search that tries to find emails from a domain. :param argv: the parameters to be searched. :return: Nothing is returned but the code of the entities is created. ''' me = MaltegoTransform(argv) """entity = me.getVar("@serialized") jsonData = json.loads(entity) """ # Recovering the Uri value try: domain = me.getVar("@value") except: domain = me.getValue() query = "\"*@" + domain + "\"" # Loading onto the Json data the information #jsonData["attributes"] = google.processSearch(query) newEntities = google.processSearch(query) # This returns a dictionary like the following: """ [{ 'attributes': [], 'type': 'i3visio.uri', 'value': 'http://foo.com' }, { 'attributes': [], 'type': 'i3visio.uri', 'value': 'http://bar.com' }, ... ] """ me.addListOfEntities(newEntities) #me.createAndShowListOfEntities(jsonData) #print json.dumps(entities, indent=2) #for uri in uriList: # newEnt = me.addEntity(uri["type"],uri["value"]) # newEnt.setDisplayInformation("<h3>" + uri["value"] +"</h3><p>"+str(uri["attributes"])+"</p>") # for extraAtt in uri["attributes"]: # newEnt.addAdditionalFields(str(extraAtt['type']), str(extraAtt['type']), True, str(extraAtt['value'])) # Returning the output text... me.returnOutput()
def domainToGoogleSearchUriWithEmails(argv): ''' List of URI entities corresponding to the results of a Google Search that tries to find emails from a domain. :param argv: the parameters to be searched. :return: Nothing is returned but the code of the entities is created. ''' me = MaltegoTransform(argv) """entity = me.getVar("@serialized") jsonData = json.loads(entity) """ # Recovering the Uri value try: domain = me.getVar("@value") except: domain = me.getValue() query = "\"*@" + domain + "\"" # Loading onto the Json data the information #jsonData["attributes"] = google.processSearch(query) newEntities = google.processSearch(query) # This returns a dictionary like the following: """ [{ 'attributes': [], 'type': 'i3visio.uri', 'value': 'http://foo.com' }, { 'attributes': [], 'type': 'i3visio.uri', 'value': 'http://bar.com' }, ... ] """ me.addListOfEntities(newEntities) #me.createAndShowListOfEntities(jsonData) #print json.dumps(entities, indent=2) #for uri in uriList: # newEnt = me.addEntity(uri["type"],uri["value"]) # newEnt.setDisplayInformation("<h3>" + uri["value"] +"</h3><p>"+str(uri["attributes"])+"</p>") # for extraAtt in uri["attributes"]: # newEnt.addAdditionalFields(str(extraAtt['type']), str(extraAtt['type']), True, str(extraAtt['value'])) # Returning the output text... me.returnOutput()
def textToGoogleSearchUri(argv): ''' List of URI entities corresponding to the results of a Google Search. :param argv: the text to be searched. :return: Nothing is returned but the code of the entities is created. ''' me = MaltegoTransform(argv) # Recovering the text value try: text = me.getVar("@value") except: text = me.getValue() newEntities = google.processSearch(text) # This returns a dictionary like the following: """ [{ 'attributes': [], 'type': 'i3visio.uri', 'value': 'http://foo.com' }, { 'attributes': [], 'type': 'i3visio.uri', 'value': 'http://bar.com' }, ... ] """ # Adding the new entities me.addListOfEntities(newEntities) # Returning the output text... me.returnOutput()
def textToGoogleSearchUri(argv): ''' List of URI entities corresponding to the results of a Google Search. :param argv: the text to be searched. :return: Nothing is returned but the code of the entities is created. ''' me = MaltegoTransform(argv) # Recovering the text value try: text = me.getVar("@value") except: text = me.getValue() newEntities = google.processSearch(text) # This returns a dictionary like the following: """ [{ 'attributes': [], 'type': 'i3visio.uri', 'value': 'http://foo.com' }, { 'attributes': [], 'type': 'i3visio.uri', 'value': 'http://bar.com' }, ... ] """ # Adding the new entities me.addListOfEntities(newEntities) # Returning the output text... me.returnOutput()