Exemple #1
0
def process_search(options):
    search_query = []
    search_query.extend(
        [hex_pattern(val.replace(' ', '')) for val in options.hex])
    search_query.extend(
        [ascii_pattern(val) for lst in options.a for val in lst])
    search_query.extend(
        [wide_pattern(val) for lst in options.w for val in lst])

    result = BINOBJ.search(search_query,
                           limit=options.limit,
                           exact=options.exact,
                           test=options.test)
    if 'error' in result:
        print(Style.BRIGHT + Fore.RED + result['error']['message'])
        return

    if 'stats' in result:
        show_stats_new(result['stats'], options.limit)

    if len(result['results']) == 0:
        return


#    if len(result['results']) >= options.limit:
#        print("Showing top {0} results:".format(options.limit))
#    else:
#        print("Results:")

    show_results(result['results'], pretty_print=options.pretty_print)
Exemple #2
0
def query_hex(xxxx, limit):
    query = []
    query.append(hex_pattern(xxxx))
    result = bly.search(query, limit=limit, exact=False)
    if result.has_key('error'):
        print("Error" + result['error']['message'])
        return
    return result
Exemple #3
0
def query_hex(xxxx, limit):
	query = []
	query.append(hex_pattern(xxxx))
	result = bly.search(query, limit=limit, exact=False)
	if result.has_key('error'):
		print ("Error" + result['error']['message'])
		return
	return result
def process_search(options):
    search_query = []
    search_query.extend([hex_pattern(val.replace(' ', '')) for val in options.hex])
    search_query.extend([ascii_pattern(val) for lst in options.a for val in lst])
    search_query.extend([wide_pattern(val) for lst in options.w for val in lst])

    result = BINOBJ.search(
        search_query, limit=options.limit, exact=options.exact, test=options.test)
    if 'error' in result:
        print(Style.BRIGHT + Fore.RED + result['error']['message'])
        return

    if 'stats' in result:
        show_stats_new(result['stats'], options.limit)

    if len(result['results']) == 0:
        return

#    if len(result['results']) >= options.limit:
#        print("Showing top {0} results:".format(options.limit))
#    else:
#        print("Results:")

    show_results(result['results'], pretty_print=options.pretty_print)
Exemple #5
0
def query_all_functions(limit, maxlen, every):
    query = []
    fcns = r2p.cmdj("aflj")
    for f in fcns:
        if f['size'] > maxlen:
            print "skip"
            continue
        b = get_bytes(f['offset'], f['size'])
        print "0x%x  %5d  %20s  %s" % (f['offset'], f['size'], f['name'], b)
        query.append(hex_pattern(b))
        if every:
            result = bly.search(query, limit=limit, exact=True)
            if result.has_key('error'):
                print("Error" + result['error']['message'])
            else:
                show_results(result)
            query = []
    if every:
        return None
    result = bly.search(query, limit=limit, exact=True)
    if result.has_key('error'):
        print("Error" + result['error']['message'])
        return
    return result
Exemple #6
0
def query_all_functions(limit, maxlen, every):
	query = []
	fcns = r2p.cmdj("aflj")
	for f in fcns:
		if f['size'] > maxlen:
			print "skip"
			continue
		b = get_bytes(f['offset'], f['size'])
		print "0x%x  %5d  %20s  %s"%(f['offset'], f['size'], f['name'], b)
		query.append(hex_pattern(b))
		if every:
			result = bly.search(query, limit=limit, exact=True)
			if result.has_key('error'):
				print ("Error" + result['error']['message'])
			else:
				show_results(result)
			query = []
	if every:
		return None
	result = bly.search(query, limit=limit, exact=True)
	if result.has_key('error'):
		print ("Error" + result['error']['message'])
		return
	return result