# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # ################################################################################## import argparse import json import sys import urllib2 import osrframework.thirdparties.infobel_com.checkPhoneDetails as infobel_com if __name__ == "__main__": parser = argparse.ArgumentParser(description='A library that wraps a search onto infobel.com via Google.', prog='checkPhoneDetails.py', add_help=False) # Adding the main options # Defining the mutually exclusive group for the main options parser.add_argument('-q', '--query', metavar='<query>', action='store', help='query to be performed to infobel.com.', required=True) groupAbout = parser.add_argument_group('About arguments', 'Showing additional information about this program.') groupAbout.add_argument('-h', '--help', action='help', help='shows this help and exists.') groupAbout.add_argument('--version', action='version', version='%(prog)s 0.1.0', help='shows the version of the program and exists.') args = parser.parse_args() print json.dumps(infobel_com.checkPhoneDetails(query=args.query), indent=2)
def phoneToPerson(argv): ''' Method that obtains all the entities in a given profile. :param argv: the serialized entity. First parameter is always the platform and the second parameter is always the phone. :return: Nothing is returned but the code of the entities is created. ''' me = MaltegoTransform(argv) # Recovering the phone value try: phone = me.getVar("@value") except: phone = me.getValue() # Trying to recover all the possible i3visio entities newEntities = infobel_com.checkPhoneDetails(phone) # This returns a dictionary like the following: """ [ { "attributes": [ { "attributes": [], "type": "i3visio.fullname", "value": "-----" }, { "attributes": [], "type": "i3visio.location.postalcode", "value": "-----" }, { "attributes": [], "type": "i3visio.location.city", "value": "-----" }, { "attributes": [], "type": "i3visio.location.address", "value": "-----" }, { "attributes": [], "type": "i3visio.uri", "value": "-----" }, { "attributes": [], "type": "i3visio.platform", "value": "Infobel" } ], "type": "i3visio.person", "value": "-----" } ] """ # Adding the new entities me.addListOfEntities(newEntities) # Returning the output text... me.returnOutput()
def phoneToPerson(argv ): ''' Method that obtains all the entities in a given profile. :param argv: the serialized entity. First parameter is always the platform and the second parameter is always the phone. :return: Nothing is returned but the code of the entities is created. ''' me = MaltegoTransform(argv) # Recovering the phone value try: phone = me.getVar("@value") except: phone = me.getValue() # Trying to recover all the possible i3visio entities newEntities = infobel_com.checkPhoneDetails(phone) # This returns a dictionary like the following: """ [ { "attributes": [ { "attributes": [], "type": "i3visio.fullname", "value": "-----" }, { "attributes": [], "type": "i3visio.location.postalcode", "value": "-----" }, { "attributes": [], "type": "i3visio.location.city", "value": "-----" }, { "attributes": [], "type": "i3visio.location.address", "value": "-----" }, { "attributes": [], "type": "i3visio.uri", "value": "-----" }, { "attributes": [], "type": "i3visio.platform", "value": "Infobel" } ], "type": "i3visio.person", "value": "-----" } ] """ # Adding the new entities me.addListOfEntities(newEntities) # Returning the output text... me.returnOutput()