This preserves the current behavior of using a string value as Solidity
source code, but now also supports instances of the `file` type, and
will use the `name` property of the file object to pass to the
subprocess invocation of solc.
This implementation also now ensures resource cleanup for the stdout and
stderr pipe handles.
Make use of compiling via file handles in multi_tx_analysis
This will enable import statements in Solidity code to work for the
Manticore CLI out of the box
Note, Manticore still wants the source code, so if we compiled using a file
handle, rather than a source string, we need to read in the source
fixes#705
* added all the uint types supported by solidity
* fixed some incorrect indentation
* Added missing space around "+"
* added some proper exceptions and included all the integer parameter types
* improved exception handling
* missing check
* added preliminary version of unit test for ABI
* x
* half finished
* tes
* fixes
* docstr
* Raise exception only once
* cc
* Fix merge bug
* fix merge bug in tests
* Fix bugs introduced in merge
* Port most of the less invasive/controversial changes from dev-evm-dynamicarguments
* Port section of fixes from ethereum.py
* Port tests unrelated to concretizing dyn args
* Add remaining changes from evm.py
* clean, fmt, code climate
* rm unnecessary setup
* disable??
* fmt
* remove all the returns
* lol cc
* Rm unused code
* port to .format
* don't use map (for py2/3 compat)
* simplify slicing
* Rm dyn arg code, since it doesn't really even work
and will be included when dev-evm-dynamicarguments is totally resolved
* add address/get_uint test
* Revert "Rm dyn arg code, since it doesn't really even work"
69188da4caf1ff74288b6398e8140f627dc495c4
* Add trace file
* Make ethersplay compatible trace format
* Small cleanup
* Record separate init and rt traces, emit separate trace files
* add todo
* More pythonic
* Add test for end insn in trace file
* Fix test
* Move trace accumulation into will_evm_execute callback
here, we can easily and correctly check the .last_exception field
to see if we were in init code or rt code. from the did_evm_execute hook
the last instruction (end instruction) had a different .last_exception
so this was causing the last instruction to not be recorded in the trace.
* Add contract keyword arg to IntegrationTest._simple_cli_run
* Remove inline tests from test_eth
* Refactor IntegrationTest.test_eth_regressions to support multi-contract files
* rm unnecessary return, change assert to graceful handle
* Add regression test
* Add regression test
* Correct logic
* Rm unnecessary check
This branch is unnecessary, if this condition is true, then ultimately
the executor will do nothing, and we'll simply return anyway.
* Raise NoAliveStates if no alive states to execute
* docstr update
* Update mult_tx_analysis to handle NoAliveStates
* Fancy
* Update test
* Codeclimate fmt
* fmt
* better readability
* add docstr
* Array value configurable. 8,16,32..256 bits (not prefixed to 8)
* Test Array256->256
* Remove old 8 bit assumptions
* Add arrayProxy copy constructors and remove old 8 bit assumptions
* remove old 8 bit assumptions
* remove old 8 bit assumptions
* Better ArrayProxy special case handling
* Fix tests
* Review fixes
* review fix
* fix gas variable
* Review fixes
* Fix vm.gas access
* initial
* Add test for mul checker
* clean
* Rename and clean
* Rm testing
* Better comment, and clean
* Split tests, add more tests
* Clean up stuff, remove unnecessary masking
* fmt
* Add back constrain to make it match the originall buggy situation
* Clean up surrounding code, make it unit testable
* Correct name
* Use individual arguments for helpers
* Clean some unused variables
* Add basic infrastructure
* Add real eth regression tests
* Use check_call
* Suppress stdout
* Make 705 work
* Less error prone way of testing
* Create EVMInstructionException, properly emit did_evm_execute_instruction for insns that trap to the platform
* Emit event before execution of platform handlers. This is because many of the
platform handles actually destroy the cpu (platform.current) via pop_vm.
Clients that receive the event may want to access the cpu though, for example
to see the current PC. so we emit the event right before, so they can do this
* simplify
* move closure below result decl
* Add comment to explain
* Fix typo
* Revert back to pythonic style
It was this way to test emitting the did execute signal here, rather
than in the evm cpu
* Remove inline function definition from critical path
* Add test for events for exception instructions
* Armv7 code refactor
Removes dead imports, makes code style more consistent and a bit more compliant with pep8 (yeah i seems we don't enforce any particular style, but this seems to be a reasonable default for me).
* Review fix: add comment for armv7 _shift
* WIP. issues with setting PC correctly via POP are corrected. issues with pc relative addressing in thumb mode corrected. Still a memory access error, but getting there
* WIP - PC relative addressing in thumb mode now aligns the value for PC per the spec before applying offset
* General thumb mode fixes:
* ldr pc, <operand> now swaps modes and sets pc correctly
* the bl instruction sets the lr appropriately for the current mode
* the two operand forms of the ORR, EOR, and BIC instructions now exist
* tests added for these updates
* comment cleanup
* WIP :more thumb mode instructions, a special case for the sys_brk handled, and a really ugly solution to an internal plumbing problem
* First attempt at concretizing ARM mode
* Handle symbolic mode for ARMv7
* Clean up imports
* Make comment more accurate and use instruction.size
* Collapse _Shift and _Shift_thumb
* Make ARM mode handling more Pythonic
* Improve comment on arm shift register handling and capstone behavior
* whitespace cleanup
* Remove access check from COWMap.__setitem__/__getitem__
* Access checks happen via read/write, so these checks are unecessary.
* Add force parameter to read/write functions
* Introduce to AbstractCpu's accessors
* Add mem force tests
* Apply force param to symbolic operations
* Add symbolic force write tests
* Clean up test
* Fix symbolic write behavior; add tests
* Fix unicorn tests and exception handling; add a sym wrapper for sys_exit
* Add debug output when solving for exit() arg
* Update how sys_exit(expr) is handled
* Move algorithm into ManticoreEVM
* Rm buggy unused line
* Initial eth testing setup
* Check for overflow in mul also
* clarifying comment
* Install solc for travis
* Add sudo
* x
* Rm travis_retry, since we rarely actually use it, and it's not available in this script for some reason
* Check for specific findings
* Fix test
* Clean up transaction firing logic
* Use less strict check, better for floating point
* Fixes symbolic reentrancy example
* Fix coverage Issue# 527
* Remove debug unused code
* New solidity biased API and reporting
* Updated examples to new api WIP
* simple_mapping FIXED. new api
* Simple transaction example added. msg.value can be symbolic now
* Reentrancy symbolic now updated to new API + bugfixes
* Doc and cleanups in evm assembler
* EVMInstruction -> Instruction
* cleanups
* typo
* deepcopy in Constant
* Better EVM-asm api and doc
* some docs
* More evm asm docs
* Fix import *
* typo
* newline between text and param
* similar phrasing to all the other flags
* typo
* typo
* fix function name in comment
* sphinx newline
* documentation fixes
* documentation fixes
* EVMAssembler to EVMAsm
* Fix evm @hook signature
* EVMAsm
* EVMasm refactor
* WIP New Policy class
* WIP pubsub
* Update Signal tests
* EVM support - Wip
* EVM support - dependencies fixed
* EVM support - fix decree merge
* fix decode instrucion event
* Fix small bugs in evm opcodes (too many arguments + wrong LOG name) (#380)
Fix wrong call parameters + typo
* Fix Create/Call
* Fix depth
* Default fixed point in arithmetic simplifier
* small fixes from github comments
* Fix event decode_instruction signature
* wip wip
* Auto tests for evm
* New EVM tests
* Ran 9556 FAILED (failures=166, errors=8, skipped=62)
* Fix some arithmetic instructions
* Ran 9556 FAILED (failures=136, errors=8, skipped=62)
* More instructions - Optimizing symbolic memory
* Added gas to opcodes description - FIX DELEGATECALL POPS
* Add wip wallet example
* The tests
* Solidity constructors need argument after bytecode
* Simple integer overflow working
* Good merge
* Good good merge
* WIP manticore refactor
* Fix default old-style initial state
* context now working
* Fix context serialization
* Fix test models. Can not set a state constraints
* typo
* A few typos (constraints setter) and use of public properties in internal methods
* Fix init wallet example
* State __init__ needs to initialize platform constraints
* Internal methods use internal properties
* Better attack modeling
* Better example layout
* Storage backup on CALL is now faster .. and correct
* Add LOG support
* Minimal SE test
* Added examples
* Send ether bugfix
* EVM: Fix wrong balance destination on CALL + decrease caller balance on CREATE
* New balance management
* Trying to maintain known hashes
* Known hash concretization policy
* CALLDATA max size bugfix
* Minimal SE example
* Remove evm tests
* add -> enqueue
* @m.init
* Fix workspace url
* Some test skipped
* Ad Fixme to platform specific stuff in State
* add -> enqueue
* Enqueue created state
* Fix m.init
Use a messy hack to adhere to the spec (callback func receive 1 state argument)
* Add _coverage_file ivar to Manticore
* Fix symbolic files
* remove extra enqueue
* Fixing __main__
* comments
* Fix visitors oddity
* setup merged
* remove duplicates and add pysha3
* Remove EVMTests import
* Refactor platform specific code out of ManticoreOutput (#505)
* Initial moving work
* Clean
* Make linux.generate_workspace_files work
* Fix
* clean
* Add test
* Test workspace for platform files
* Skip EVM cpu pretty print
* Remove bad import
* Fix coverage.py for testing
* Clean comment
* Comment hack
* Print evm cpu
* pretty print evm world instead of platform
* delet old scripts/examples
* delet old tests
* Remove z3 install script
* Array.max_size can be None, include check for that
* Rm unused _symbolic_files
add_symbolic_files was moved to linux, so this is not needed
* Rm unused args
* Import evm
* Rm dup function
* Rm stray prints
* Add docs for new classmethod apis
* minimal
* minimal example
* fix minimal
* Fair symbolic SHA3 handling
* Simple mapping example
* coverage example
* fix tests
* fix minimal
* Some eko fixes
* New SETH
* integer_overflow refactored
* Fixing the examples
* init_bytecode -> init
'
* Concrete reentrancy exampole
* concrete reentrancy selfdestruct
* Update minimal.py
* It's a new Minimal
* Integer overflow example
* New minimal
* minimal fix
* Examples last minute fixes
* Remove debug print
* add plugin.py
* Fixing event subscription
* remove temp params
* Remove param
* Update uncovered will_exec callback prototype
* Clean up debug output
* Automatically generated intruction tests
* Uninplemented instruction test removed
* Unused concretization policy removed
* Fixes enabling default bplugins
* solc from PATH
* Removed unused import
* Logger name updated
* WIP New Policy class
* WIP pubsub
* Update Signal tests
* small fixes from github comments
* Fix event decode_instruction signature
* Good merge
* Good good merge
* WIP manticore refactor
* Fix default old-style initial state
* add -> enqueue
* @m.init
* Fix workspace url
* Some test skipped
* Ad Fixme to platform specific stuff in State
* add -> enqueue
* Enqueue created state
* Fix m.init
Use a messy hack to adhere to the spec (callback func receive 1 state argument)
* Add _coverage_file ivar to Manticore
* Fix symbolic files
* remove extra enqueue
* Fixing __main__
* comments
* Experimental plugin system
* tests fixed
* Fix plugins
* Some reporting moved to plugin
* Fix assertions test
* Add published events to classes that publish them
* Update how we verify callbacks
* Update Eventful._publish
* Dev plugins (#512)
* Yet another flavor for event name checking
* really it's a bunch of minimal bugfixes
* Remove get_all_event_names from Plugin
* Update where we get all events
* Use new metaclass-based event registry
* Define prefixes in one place
* remove debug print
* remove debug print
* WIP New Policy class
* WIP pubsub
* Update Signal tests
* small fixes from github comments
* Fix event decode_instruction signature
* Good merge
* Good good merge
* WIP manticore refactor
* Fix default old-style initial state
* add -> enqueue
* @m.init
* Fix workspace url
* Some test skipped
* Ad Fixme to platform specific stuff in State
* add -> enqueue
* Enqueue created state
* Fix m.init
Use a messy hack to adhere to the spec (callback func receive 1 state argument)
* Add _coverage_file ivar to Manticore
* Fix symbolic files
* remove extra enqueue
* Fixing __main__
* comments
* Refactor CLI, and Manticore high level interfaces (#498)
* Refactor main,
- classmethod for linux
- refactor manticore ctor - compat with old linux behavior
- changed verbosity API (to allow for this use case: what if you want to set verbosity for the stuff manticore does in its ctor?)
* rm old verbosity
* small
* Add decree classmethod
* Rm checks ; they are redundant anyway
* Misc
* Move add_symbolic_file to linux platform
* rm redundant checks
* Rm explicit args for deprecated interface
* Fix cli bug
* Allow for both linux and decree from cli
* Add back argv positional param for deprecated api compat
* adding abstract disasm class
* before adding abstract insn
* explicit capstone use
* (wip) removing capstone
* debugging nose
* removed disassembler from constructor
* nits
* capstone->cs and nits
* basic memory (wip)
* tmp
* added binja dissasm
* fixed execution pipeline - calling LLIL instructions
* updated parseargs to select disassembler
* unstable (disassembler at CPU constructor breaks tests)
* disasm fix for tests
* nit for aliases in x86
* added a flag to differentiate disassembly and IL-disassembly for binja
* before merging
* merging with dev-events master
* fixed signal forwarding for binja
* cleaner initialization
* Binja RegisterFile. Dropped Platform
* address fixup
* properly incrementing PC
* some work on XOR, SET_REG, REG, CONST, AND, PUSH, POP
* adding first CALL, JMP, LOAD (wip)
* JUMP fix
* GOTO and misc fixes in PC handling
* adding instructions (wip)
* fixing flags and sizes (wip)
* loading database if exists for faster analysis
* fix for register debug
* fixes for register sizes and flags
* FIX for multiple IL instructions sharing the same PC
* removed CONST_PTR and misc fixes
* RET, SHR, shift left & misc instructions, fixing insn sizes (wip)
* flag fixes
* ctypes 2's complement parsing
* JUMP_TO, SYSCALL
* syscall fixups and flag computation using binja il only
* FLAG, NEG, CMP(family) of LLIL, some unimplemented methods
* MUL, DIV
* cmpxchg
* MUL, IMUL, ROR, ROL
* fallback to capstone for all LLIL_UNIMPL and LLIL_UNIMPL_MEM
* fixes for registers and memory when switching CPUs
* check for binja to disable multiprocessing
* merging
* nit
* hack for serialization
* moved check for disassembler to Manticore from __main__
* removing __class__ refs
* cleanup from __class__.disasm
* size calculation from get_instruction_low_level_il
* fix for NEG, check for empty queue, execute refactor
* fixes for LLIL functions
* removal of redundant regfile writes
* nit fixes
* function overrides in Cpu classes and orphan printf cleanup
* nit
* incomplete merge
* verbosity temp mod
* cleanups of FIXMEs
* 2-stage constructor for disassembler
* cleanup binja refs in abstractcpu
* serialization for platform_cpu
* check for UNIMPL in all the il queue
* typo fix
* fix for arm
* typo correction and starting caching implementation
* restored register printing and fixed import in x86.py
* orn instruction plus unit test
* uadd8 and it instructions implemented
* SEL instruction implementation
* GE flag set by UADD8
* IT instruction condition code properly no longer prevents its execution
* support for multiple instruction tests added to testing setup
* unit test for SEL instruction
* cleaned up the tests for thumb instructions
* implemented sxth and rev instructions
* implemented tests for sxth and rev instructions
* updated the add implementation to support two operand variant (i.e., add r4, #4)
* added test for itete ne instruction
* Use correct event name
* Add test for state.generate_testcase
Test merely tests that this function publishes the 'will_generate_testcase' event
* Properly test; make sure the callback executes and error if not
This is the most convoluted unit test I've ever written.
* "better"
* ran
* Some dirty work
* Rm unnecessary sanitization
* Fix state.generate_inputs event publishing
We don't need to manually pass `self` because State is automatically
forwarded as an argument. Also correctly specify a message for the state
and expose to the API
* Rename
* Update test for new save_testcase args, make test more robust
* Simplify arguments related to generate_testcase_callback by removing default arg. Add test for this behavior
* Minor test fixup
* Add official API docs
* Remove unnecessary new event type
* Fix context serialization
* Fix test models. Can not set a state constraints
* typo
* A few typos (constraints setter) and use of public properties in internal methods
* State __init__ needs to initialize platform constraints
* Internal methods use internal properties
* test_record_branches removed
* Add taint args to buffer creation
Allows the `new_symbolic_buffer` and `symbolicate_buffer` functions to take keyword args for tainting. Defaults to frozenset in both cases.
* Add unit tests and ArrayProxy taint propery
Adds simple unit tests for tainted buffers. Added a property to the ArrayProxy class in smtlib.expression so that it's possible to access the taint of the proxied ArrayVariable.
* Updated docstrings
* WIP New Policy class
* WIP pubsub
* Update Signal tests
* small fixes from github comments
* Fix event decode_instruction signature
* Good merge
* Good good merge
* Eventful class commented
* The million typos
* Code revision
* Fix tests for new mor strict Eventful