mirror of
https://github.com/mandiant/capa.git
synced 2025-12-23 07:28:34 -08:00
fix: filter address
This commit is contained in:
@@ -137,9 +137,11 @@ def main(argv=None):
|
|||||||
# TODO fix
|
# TODO fix
|
||||||
function_handles = tuple(filter(lambda fh: fh.address == args.function, function_handles))
|
function_handles = tuple(filter(lambda fh: fh.address == args.function, function_handles))
|
||||||
else:
|
else:
|
||||||
function_handles = tuple(filter(lambda fh: fh.address == args.function, function_handles))
|
function_handles = tuple(
|
||||||
|
filter(lambda fh: capa.render.verbose.format_address(fh.address) == args.function, function_handles)
|
||||||
|
)
|
||||||
|
|
||||||
if args.function not in [str(f) for f in function_handles]:
|
if args.function not in [capa.render.verbose.format_address(fh.address) for fh in function_handles]:
|
||||||
print("%s not a function" % args.function)
|
print("%s not a function" % args.function)
|
||||||
return -1
|
return -1
|
||||||
|
|
||||||
@@ -167,16 +169,16 @@ def ida_main():
|
|||||||
print("file: %s: %s" % (capa.render.verbose.format_address(addr), feature))
|
print("file: %s: %s" % (capa.render.verbose.format_address(addr), feature))
|
||||||
return
|
return
|
||||||
|
|
||||||
functions = extractor.get_functions()
|
function_handles = extractor.get_functions()
|
||||||
|
|
||||||
if function:
|
if function:
|
||||||
functions = tuple(filter(lambda f: f.start_ea == function, functions))
|
function_handles = tuple(filter(lambda fh: fh.inner.start_ea == function, function_handles))
|
||||||
|
|
||||||
if len(functions) == 0:
|
if len(function_handles) == 0:
|
||||||
print("0x%X not a function" % function)
|
print("0x%X not a function" % function)
|
||||||
return -1
|
return -1
|
||||||
|
|
||||||
print_features(functions, extractor)
|
print_features(function_handles, extractor)
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user