def do_transform(self, request, response, config): be = BinaryEdge(config['binaryedge.local.api_key']) domain = request.entity.value try: # Only consider the fist page res = be.domain_subdomains(domain) except BinaryEdgeException as e: raise MaltegoException('BinaryEdge error: %s' % e.msg) else: for e in res["events"]: if e != domain: response += Domain(e) return response
def run(self, conf, args, plugins): be = BinaryEdge(conf['BinaryEdge']['key']) try: if hasattr(args, 'which'): if args.which == 'ip': if args.score: res = be.host_score(unbracket(args.IP)) elif args.image: res = be.image_ip(unbracket(args.IP)) elif args.torrent: if args.historical: res = be.torrent_historical_ip(unbracket(args.IP)) else: res = be.torrent_ip(unbracket(args.IP)) elif args.historical: res = be.host_historical(unbracket(args.IP)) elif args.dns: res = be.domain_ip(args.IP, page=args.page) else: res = be.host(unbracket(args.IP)) print(json.dumps(res, sort_keys=True, indent=4)) elif args.which == 'search': if args.image: res = be.image_search(args.SEARCH, page=args.page) else: res = be.host_search(args.SEARCH, page=args.page) print(json.dumps(res, sort_keys=True, indent=4)) elif args.which == 'dataleaks': if args.domain: res = be.dataleaks_organization(args.EMAIL) else: res = be.dataleaks_email(args.EMAIL) print(json.dumps(res, sort_keys=True, indent=4)) elif args.which == 'domain': if args.subdomains: res = be.domain_subdomains(args.DOMAIN, page=args.page) else: res = be.domain_dns(args.DOMAIN, page=args.page) print(json.dumps(res, sort_keys=True, indent=4)) else: self.parser.print_help() else: self.parser.print_help() except ValueError as e: print('Invalid Value: %s' % e.message) except BinaryEdgeNotFound: print('Search term not found') except BinaryEdgeException as e: print('Error: %s' % e.message)
def scan(query): print('[-] Searching now in BinaryEdge..') be = BinaryEdge('<your_token>') results = be.domain_subdomains(query) subdom_list = results.get('events') return subdom_list