441 Commits

Author SHA1 Message Date
Disconnect3d
fe2538f6bc Add docstring for ARM's operand.is_shifted (#788)
So that people don't have to google that by themselves! lolo
2018-03-05 18:42:48 -05:00
Disconnect3d
328b62350a Change assertion->exception and add msg when target file is not present (#778) 2018-03-02 15:55:13 -05:00
Feist Josselin
7349a0b13d Fix out-of-bound index in EVMWorld._process_pending_transaction (#786) 2018-03-02 15:52:56 -05:00
Mark Mossberg
03ecb3fd9f
Fix cli --data parameter (#781)
* Actually use args.data

* Update decree
2018-03-01 18:48:10 -05:00
Arun John Kuruvilla
17e90986b8 Used a namedtuple for pending transaction. Issue #689 (#775)
* Used a namedtuple for pending transaction. Issue #689

* Changed field names in namedtuple. Issue #689
2018-03-01 18:27:52 -05:00
Disconnect3d
9b75a1f0fe Unicorn emulator: get uc_arch & uc_mode values just once (#779) 2018-03-01 18:24:27 -05:00
Disconnect3d
20cb97f7ae Fix Cpu.execute's improper reporting of Unimplemented instruction (#777)
When particular instruction's implementation raised an `AttributeError` it was catched by `Cpu.execute` and we just saw "oh this instruction is not implemented" while it was, but its implementation was broken.
2018-03-01 13:40:51 -05:00
feliam
48f88be759 Dev fix solver getvalue (#739)
* Increment default gas

* Do not solve concrete values

* Do not solve concrete values

* Do not solve concrete values

* Remove comment

* Make solver get_value return concrete values untouched - wip

* Handle solver.get_value integers

* fix reporting

* Make solver.get_value return the expression untouched when concrete

* Remove hack; we know `c` can't be an int type

* Revert "Remove hack; we know `c` can't be an int type"

0849094525d7e4cea0295d4be13552dea9c8ad72

* Fix cli --data argument

Previously, it was being ignored :/

* Fix linux output generation

solve.get_value returns back an int, if it concretized the sym var

* Revert "Fix cli --data argument"

2ee740acb20a9d393e1a7984d7ec0e0fe64dbfaf
2018-02-28 18:11:54 -05:00
39370ccf3c Let the Python interpreter be specified externally (#774) 2018-02-27 12:33:25 -05:00
feliam
461da57ea3
Array value configurable. 8,16,32..256 bits (not prefixed to 8) (#732)
* 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
2018-02-26 21:09:34 -03:00
Yan Ivnitskiy
a3ee31e6e6
Manticore 0.1.7 Release (#764) 2018-02-23 18:31:31 -05:00
Yan Ivnitskiy
394401e3f4
Fix ARMv7's ADD (#769)
* Fix armv7's ADD
2018-02-23 18:07:49 -05:00
Mark Mossberg
b9aa483745
evm: Fix MUL overflow false positive (#767)
* 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
2018-02-23 12:42:15 -08:00
Mark Mossberg
3f1c51fa91
Improve solc error output (#765)
* Improve err handling when there's a solc error, print the error

* Fix bug, don't merge stdout/err

* Simplify

* Add more space
2018-02-23 08:13:55 -08:00
Mark Mossberg
d0f69c755c
Add ethereum regression tests (#763)
* 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
2018-02-22 13:04:01 -08:00
Jean Jordaan
8e47a6ebe9 Drive-by typo correction ;-) (#762) 2018-02-22 10:17:49 -03:00
Mark Mossberg
ebe0baa178
Emit events for exception raising evm instructions (#722)
* 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
2018-02-20 12:10:29 -08:00
Mark Mossberg
9f0d25c5d9 Fix evm state handling regression (#741)
* Revert breaking change

* Add assertion to verify states being queued
2018-02-20 09:57:07 -03:00
Disconnect3d
105a7d3aee Speedup x86 execution by caching AMD64RegFile.all_registers (#755)
* Cache `all_registers` for AMD64RegFile
2018-02-19 20:48:26 -05:00
Disconnect3d
680fc8f17e Armv7 code refactor (#749)
* 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
2018-02-17 11:51:58 -05:00
Garret Reece
c6f457d72e Updates for thumb mode (#610)
* 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
2018-02-15 15:47:36 -05:00
Srinivas P G
fca3179dd0 System calls addition - sys_getrandom and sys_openat (#640)
* version argument in manticore

* Fix 591 - Exception Handler

* Issue 597 - Remove the unused policy argument

* getrandom system call - Initial commit

* openat system call initial commit

* getrandom system call fixes

* openat and getrandom system call

* Update sys_getrandom

* Make BadFd more generic as FdError

* Resolve mode inside File

* Support opening directory with open(2)

* Fix fd leak

* add sys_openat tests
2018-02-14 16:52:54 -05:00
feliam
843a4f399e
Fix finalize (#738)
* fix finalize

* Document the state id -1
2018-02-14 18:28:50 -03:00
feliam
2f2de29d36
Better plugin context management. (#730)
* Better plugin context management. Example UseDef logging plugin for evm

* Example plugin to log use-def

* Better plugin name checking hints

* Better plugin name checking hints2

* Fix uninititalize-plugins (found via the warning)

* Remove redundant variables in example

* Typo

* Better warning print (class name)

* better safety check + context fix

* better variabke naming

* Update manticore.py
2018-02-14 17:13:40 -03:00
Mark Mossberg
84aca4ac1b
Add docs on symbolic input (#750)
* Change tagline

* Not sure socket support is a gotcha exactly

* initial docs

* Better docs

* Code blocks

* Links to the api docs

* Improve language

* Doc add_symbolic_file in public API

* Rm stray init
2018-02-13 19:15:54 -05:00
feliam
f8587ff13e Bump default gas budget (#740) 2018-02-13 18:55:52 -05:00
Arun John Kuruvilla
4d84551375 Fixed Issue #723 - changed _pop() to _pop_vm() (#745) 2018-02-08 17:25:40 -03:00
feliam
5a38737ede
Fix sha3 (#703)
* the fix

* Add default example sha3 when unknown

* Review

* Remove IF statement on potentially symbolic value
2018-02-05 15:00:05 -03:00
ggrieco-tob
2f2b081aa9 Added multiprocessing support to generate testcases in finalize (#697)
* Added multiprocessing support to generate testcase in finalize

* Improve the code using @feliam suggestions

* Fixed multiprocessing code. Now it really seems to work!™
2018-02-02 13:37:24 -05:00
Mark Mossberg
97307906c5
Fix incorrect number of transaction in certain states (#724)
* privatize Executor.put, use in evm

* better typeerror

* Simplify execute(), directly raise exception in _process...
2018-02-02 13:23:04 -05:00
Yan Ivnitskiy
9f7b87d0b8
Use the 'force' flag for bss zeroing (#719)
* Clean up bss trailer zeroing
2018-01-31 11:47:46 -05:00
feliam
a1f809732d
Quick evm header fix (#679)
* Quick evm header fix

* Fix BLOKKHASH
2018-01-30 17:31:28 -03:00
Yan Ivnitskiy
c0068431c9
Introduce a 'force' parameter to memory access functions (#632)
* 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
2018-01-30 12:17:27 -05:00
feliam
faf1d16b99
Allow importing solidity files from current folder (#717) 2018-01-29 20:28:31 -03:00
Yan Ivnitskiy
60d2b61fb3
Run linux examples in Travis (#668)
* Update makefile; add a list target for testing

* simplify nostdlib example

* Make sendmail example return success

* Add tests to run all examples

* Add some targets to exclude

* Run example scripts; temporarily add a workspace accsesor to mcore

* Optionally read end of main from argv

* Make concolic test more robust

* Clean up Makefile

* Be better with phony targets

* Add run_simple and state_control tests

* verbosity++

* Make sure we fail when we intend to

* Simplify travis_test.sh

* Remove multi_arch_sym
2018-01-18 15:50:13 -05:00
ggrieco-tob
7907d0179d
Added support to analyze solidity source code with multiple contracts using the --contract command line option (#712) 2018-01-17 16:11:13 -03:00
feliam
aeb3b99f7d
the fix (#702) 2018-01-16 13:53:01 -03:00
Alexander Holman MBCS AMIAP
000ef094f9 Update state.py (#709)
replace `\0` with `NULL` as per issue #699
2018-01-16 11:26:07 -05:00
Alexander Holman MBCS AMIAP
03f92a7f0b Update manticore.py (#710)
Removed first of twice declared function `enqueue` as per #706
2018-01-16 11:25:16 -05:00
feliam
465c926a2e
Fix metadata setting race (#675)
* Set the sol metadata before building the contract account

* EVM account lazy hashes

* new_address now public

* Micro-optimization more readable

* Arithmetanic
2018-01-08 20:34:27 -03:00
ggrieco-tob
7b2607b0a6
Improved readability of .tx files using repr to print function call arguments (#694) 2018-01-08 14:09:27 -03:00
feliam
98712cf426
Adds support for unmarshaling bytes32 type (#680)
* Adds support for unmarshaling bytes32 type

* Review fixes
2018-01-05 18:04:35 -03:00
ggrieco-tob
976f31446d
Add missing DivideByZeroError import and replaced DivideError by DivideByZeroError (#692) 2018-01-05 16:06:00 -03:00
ggrieco-tob
743d479cbf
Added missing **kwargs to ManticoreEVM constructor (#686) 2018-01-05 12:39:25 -03:00
ggrieco-tob
3b796091c2
NotImplemented(x) -> NotImplementedError(x) (#677) 2017-12-29 12:49:50 -03:00
ggrieco-tob
b6753a34ae
Adds support for unmarshaling uint8 type (#681) 2017-12-29 12:48:07 -03:00
Mark Mossberg
4c0f4bc6cf
Trick rtd into thinking we don't need z3 (#671) 2017-12-22 19:11:25 -05:00
Mark Mossberg
a9be273c2e Update README.md (#670) 2017-12-22 18:44:09 -05:00
Mark Mossberg
8a588c70f4
Manticore 0.1.6 (#662)
* Update CHANGELOG.md

* Add external contributors

* add categories

* Update CHANGELOG.md

* initial rough notes from commit log

* Update CHANGELOG.md

* Update CHANGELOG.md

* Bump version numbers

* Update CHANGELOG.md

* readme 2.0

* update tagline
2017-12-22 18:30:16 -05:00
Mark Mossberg
a7fb995aa1
Update __main__.py (#669) 2017-12-22 18:27:40 -05:00