Exemple #1
0
def find_http_sha256(hash, count=False):
    be = BinaryEdge(API_KEY)
    search = "http.sha256:%s" %(hash)
    results = be.host_search(search)
    if count == True:
        print "Results: %d" %(results['total'])
        return
    for ip in results['events']:
        print "%s:%s" %(ip['target']['ip'], ip['target']['port'])
Exemple #2
0
 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)
Exemple #3
0
 def binaryedge(self):
     conf = configparser.ConfigParser()
     conf.read('config.ini')      
     key = conf.get("binaryedge","key") 
     be = BinaryEdge(key)
     search = self.lineEdit.text()
     page = self.lineEdit_2.text()
     print('[*]搜索关键词:'+search)
     print('[*]搜索页数:'+page)
     
     for mun in range(int(page)):
         results = be.host_search(search,str(mun))
         for ip in results['events']:
             ipi =results ['events'][ip]['target']['ip']
             porti=results ['events'][ip]['target']['port']
             #print(str(ipi) +':'+ str(porti))
             self.textEdit.append(str(ipi) +':'+ str(porti))
from pybinaryedge import BinaryEdge
import os

key= os.environ['BINARYEDGE_API_KEY']

binaryEdge = BinaryEdge(key)

search_domain = 'www.python.org'

results = binaryEdge.host_search(search_domain)

for ip in results['events']:
    print("%s" %(ip['target']['ip']))
Exemple #5
0
if rethink:
    for page in range(first, last):
        print(Fore.RED +
              '----------------------------------Rethink DB - Page ' +
              str(page) + '--------------------------------' + Fore.RESET)
        rethink_results = binaryedge_query(rethink_query + " " + query, page)
        check_rethinkdb(rethink_results)

if s3asia:
    search = '"s3.ap-southeast-1.amazonaws.com"' + " " + query + ' tag:"WEBSERVER"'
    for page in range(first, last):
        print(
            Fore.RED +
            '----------------------------------s3.ap-southeast-1.amazonaws.com - Page '
            + str(page) + '--------------------------------' + Fore.RESET)
        results = be.host_search(search, page)
        check_amazons3(results)

if s3usa:
    search = '"s3-us-west-2.amazonaws.com"' + " " + query + ' tag:"WEBSERVER"'
    for page in range(first, last):
        print(
            Fore.RED +
            '----------------------------------s3.ap-southeast-1.amazonaws.com - Page '
            + str(page) + '--------------------------------' + Fore.RESET)
        results = be.host_search(search, page)
        check_amazons3(results)

if s3europe:
    search = '"s3-eu-west-1.amazonaws.com"' + " " + query + ' tag:"WEBSERVER"'
    for page in range(first, last):
Exemple #6
0
def binaryedgeQuery(query, limit):
    from pybinaryedge import BinaryEdge
    import ODBconfig
    BEkey = ODBconfig.BINARY_API_KEY

    requestleft = binaryedgecheck(BEkey)
    if requestleft > 0:
        limit = int(limit)
        #params country:us port
        pages = int(limit / 20) + (
            limit % 20 > 0
        )  #20 results per page, see how many pages need to grab by rounding up
        if pages > 999:
            pages = 1000
            print("Max pages is 1000")
        be = BinaryEdge(BEkey)

        counter = 0
        BEres = []
        results = be.host_search(query)
        total = results["total"]
        maxpages = int(total / 20) + (
            total % 20 > 0
        )  #20 results per page, see how many pages need to grab by rounding up
        if pages > maxpages:
            pages = maxpages
        if results["events"]:
            for x in results["events"]:
                if "error" in x["result"]:
                    if not x["result"][
                            "error"]:  #one more step to get rid of crap
                        BEres.append((x["target"]["ip"], x["origin"]["type"],
                                      x["target"]["port"]))
                else:
                    BEres.append((x["target"]["ip"], x["origin"]["type"],
                                  x["target"]["port"]))

        try:
            for i in range(2, maxpages + 1):
                results = be.host_search(query, i)
                if not results["events"]:
                    break

                for x in results["events"]:
                    if "error" in x["result"]:

                        if not x["result"]["error"]:
                            BEres.append(
                                (x["origin"]["ip"], x["origin"]["type"],
                                 x["target"]["port"]))
                    else:
                        BEres.append((x["target"]["ip"], x["origin"]["type"],
                                      x["target"]["port"]))
        except Exception as e:
            print(str(e))
        BEres = list(set(BEres))  #for some reason return sdupe records
        BEres = BEres[:limit]
        return BEres
    elif requestleft == 0:
        print(
            f"{Fore.RED}ERROR! {Fore.RESET}Your {Fore.CYAN}BinaryEdge{Fore.RESET} plans has {Fore.GREEN}no more queries left{Fore.RESET}. Wait til requests cycle or pay for a plan"
        )
        sys.exit()