def getIp_ApiInformation(argv=None): ''' Method that checks if the given email is stored in the md5crack.com. :param argv: query to be executed. Note that if the query is a domain, this will be resolved. ''' me = MaltegoTransform(argv) # Recovering the phone value try: query = me.getVar("@value") except: query = me.getValue() newEntities = ip_api.checkIpDetails(query=query) """ [ { "attributes": [ { "attributes": [], "type": "i3visio.text", "value": "DE" } ], "type": "i3visio.location.country", "value": "Germany" }, { "attributes": [], "type": "i3visio.text", "value": "1&1 Internet AG" }, { "attributes": [], "type": "i3visio.ipv4", "value": "217.160.129.99" }, { "attributes": [], "type": "i3visio.location.geo", "value": "51, 9" } ] """ # Adding the new entities me.addListOfEntities(newEntities) # Returning the output text... me.returnOutput()
parser = argparse.ArgumentParser( description='A library that wraps a search onto ip-api.com.', prog='checkIpDetails.py', epilog="", add_help=False) # Adding the main options # Defining the mutually exclusive group for the main options general = parser.add_mutually_exclusive_group(required=True) general.add_argument('-q', '--query', metavar='<ip_or_domain>', action='store', help='query to be resolved by ip-api.com.') 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.2.0', help='shows the version of the program and exists.') args = parser.parse_args() print json.dumps(ip_api_com.checkIpDetails(query=args.query), indent=2)
################################################################################## import argparse import json import osrframework.thirdparties.ip_api_com.checkIpDetails as ip_api_com if __name__ == "__main__": parser = argparse.ArgumentParser( description="A library that wraps a search onto ip-api.com.", prog="checkIpDetails.py", epilog="", add_help=False, ) # Adding the main options # Defining the mutually exclusive group for the main options general = parser.add_mutually_exclusive_group(required=True) general.add_argument( "-q", "--query", metavar="<ip_or_domain>", action="store", help="query to be resolved by ip-api.com." ) 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.2.0", help="shows the version of the program and exists." ) args = parser.parse_args() print json.dumps(ip_api_com.checkIpDetails(query=args.query), indent=2)