Improve evm cli output (#652)

* Replace starting text

* Use warning logger for detector warnings!

* Uniformity bt linux and evm

* clean up suppress hack

* Prettify output

* minor
This commit is contained in:
Mark Mossberg 2017-12-20 13:54:56 -05:00 committed by GitHub
parent 95967f84df
commit cc8ee5685e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 9 deletions

View File

@ -82,6 +82,7 @@ def ethereum_cli(args):
m.register_detector(UnitializedStorage())
m.register_detector(UnitializedMemory())
logger.info("Beginning analysis")
with open(args.argv[0]) as f:
source_code = f.read()
@ -90,8 +91,6 @@ def ethereum_cli(args):
contract_account = m.solidity_create_contract(source_code, owner=user_account)
attacker_account = m.create_account(balance=1000)
logger.info("Starting with %d processes", args.procs)
last_coverage = None
new_coverage = 0
while new_coverage != last_coverage and new_coverage < 100:

View File

@ -32,7 +32,7 @@ class Detector(Plugin):
with self.manticore.locked_context('seth.global_findings', set) as global_findings:
global_findings.add((address, pc, finding))
logger.info(finding)
logger.warning(finding)
def _get_src(self, address, pc):
return self.manticore.get_metadata(address).get_source_for(pc)
@ -803,14 +803,14 @@ class ManticoreEVM(Manticore):
with self.locked_context('seth') as context:
context['_pending_transaction'] = ('CALL', caller, address, value, data)
logger.info("Starting symbolic transaction: %d", self.completed_transactions + 1)
status = self.run(procs=self._config_procs)
with self.locked_context('seth') as context:
context['_completed_transactions'] = context['_completed_transactions'] + 1
logger.info("Coverage after %d transactions: %d%%", self.completed_transactions, self.global_coverage(address))
logger.info("There are %d reverted states now", len(self.terminated_state_ids))
logger.info("There are %d alive states now", len(self.running_state_ids))
logger.info("Finished symbolic transaction: %d | Code Coverage: %d%% | Reverted States: %d | Alive States: %d", self.completed_transactions, self.global_coverage(address), len(self.terminated_state_ids), len(self.running_state_ids))
return status
@ -1240,7 +1240,7 @@ class ManticoreEVM(Manticore):
f.write('0x%x\n'%o)
logger.info("Look for results in %s", self.workspace )
logger.info("Results in %s", self.workspace )
def global_coverage(self, account_address):
''' Returns code coverage for the contract on `account_address`.
@ -1270,7 +1270,8 @@ class ManticoreEVM(Manticore):
return count*100.0/total
#TODO: find a better way to suppress execution of Manticore._did_finish_run_callback
# TODO: Find a better way to suppress execution of Manticore._did_finish_run_callback
# We suppress because otherwise we log it many times and it looks weird.
def _did_finish_run_callback(self):
_shared_context = self.context
pass