mirror of
https://github.com/trailofbits/manticore.git
synced 2026-10-12 02:23:44 +00:00
* py/missing-call-to-init
* Remove deprecated should_profile argument
* WASM __init__ call and variable names
* Mute warnings about printing evm account IDs
LGTM thinks we're logging potentially sensitive data when we create a symbolic account and print the user ID. I can't imagine a context where we would ever care about this alert in general, so I'm going to disable it.
* Fix mixed attribute/function names
* Another missing __init__ call
* Remove single-op form of _bitwise_instruction
It's never used
* Use built-in ops instead of lambda
* Missing import
* Some unreachable code
Still missing some in evm.py
* Blacken
* Tag examples as examples
* NotImplemented -> NotImplementedError
* Fix unnecessary `pass`
* Revert "Remove single-op form of _bitwise_instruction"
This reverts commit 1b7a4110f4.
* Mute overzealous call argument error
Co-authored-by: Brad Larsen <[email protected]>
44 lines
992 B
Python
44 lines
992 B
Python
"""
|
|
Script used to profile Manticore runs.
|
|
"""
|
|
|
|
from __future__ import print_function
|
|
|
|
from sys import argv, exit
|
|
|
|
from manticore.native import Manticore
|
|
from manticore.core.plugin import Profiler
|
|
|
|
|
|
def profile(program, sort="cumulative"):
|
|
print(f'[*] Profiling program "{program}"')
|
|
|
|
m = Manticore(program)
|
|
profiler = Profiler()
|
|
m.register_plugin(profiler)
|
|
m.run()
|
|
m.finalize()
|
|
|
|
stats = profiler.get_profiling_data()
|
|
print(f"[*] Loaded profiling data.")
|
|
|
|
if stats is None:
|
|
print(f"[*] Failed to collect stats for program {program}")
|
|
return
|
|
|
|
stats.sort_stats(sort)
|
|
|
|
stats.print_stats()
|
|
|
|
|
|
if __name__ == "__main__":
|
|
if len(argv) != 2:
|
|
print(f"usage: python {argv[0]} PROGRAM [SORT_METHOD]")
|
|
print("The default SORT_METHOD is cumulative")
|
|
print(
|
|
"SORT_METHODs can be seen on https://docs.python.org/3/library/profile.html#pstats.Stats.sort_stats"
|
|
)
|
|
exit()
|
|
|
|
profile(argv[1])
|