mirror of
https://github.com/mandiant/capa.git
synced 2025-12-23 15:37:37 -08:00
feat: add handles and type annotations
This commit is contained in:
@@ -130,23 +130,24 @@ def main(argv=None):
|
||||
for feature, addr in extractor.extract_file_features():
|
||||
print("file: %s: %s" % (capa.render.verbose.format_address(addr), feature))
|
||||
|
||||
functions = extractor.get_functions()
|
||||
function_handles = extractor.get_functions()
|
||||
|
||||
if args.function:
|
||||
if args.format == "freeze":
|
||||
functions = tuple(filter(lambda f: f == args.function, functions))
|
||||
# TODO fix
|
||||
function_handles = tuple(filter(lambda fh: fh.address == args.function, function_handles))
|
||||
else:
|
||||
functions = tuple(filter(lambda f: str(f) == args.function, functions))
|
||||
function_handles = tuple(filter(lambda fh: fh.address == args.function, function_handles))
|
||||
|
||||
if args.function not in [str(f) for f in functions]:
|
||||
if args.function not in [str(f) for f in function_handles]:
|
||||
print("%s not a function" % args.function)
|
||||
return -1
|
||||
|
||||
if len(functions) == 0:
|
||||
if len(function_handles) == 0:
|
||||
print("%s not a function", args.function)
|
||||
return -1
|
||||
|
||||
print_features(functions, extractor)
|
||||
print_features(function_handles, extractor)
|
||||
|
||||
return 0
|
||||
|
||||
|
||||
Reference in New Issue
Block a user