212 Commits

Author SHA1 Message Date
JP Smith
fcf0024d5d Fix capstone MOV issue (#365)
* add temporary workaround for capstone bug

* rename cs to rest
2017-06-29 12:02:31 -04:00
Mark Mossberg
7c00b44675 Update docs (#360)
* Update State docs

* Update manticore docs

* Document models

* Doc models

* Use sphinx link
2017-06-28 14:58:23 -04:00
Mark Mossberg
b197a47f96 Adjust verbosity settings (#358)
* Show "Generating testcase" message by default

* Rephrase program finished to be less obtuse

* Rm excessive debug print
2017-06-27 19:18:41 -04:00
Garret Reece
7d3d9a9ed1 lsl.w in thumb mode fixed, plus tests (#350)
- blx <Rm> swaps mode appropriately
- asr.w and lsr.w in thumb mode handle immediates for op2 correctly
- unit tests for thumb mode behavior for shifting instructions
- unit tests check for correct mode on BX and BLX instructions
2017-06-27 13:52:20 -05:00
Garret Reece
e931992abb Add ldrd and strd instructions and tests (#348)
* LDRD and STRD implementation and tests
2017-06-26 17:22:59 -05:00
feliam
520a9be47d Dev - events (#341)
* Wip refactoring

* Executor and exceptions refactor wip wip

* Fixing all_insts auto tests

* Visited and generate testcase now at manticore api level

* Aggregating state statistics into executor statistics

* Wip refactoring

* Executor and exceptions refactor wip wip

* Fixing all_insts auto tests

* Visited and generate testcase now at manticore api level

* Aggregating state statistics into executor statistics

* forwarding events wip

* state setstate fix and setup_stack merge fix

* will_terminate_state fix and tests skipped

* Update all ConcretizeRegister and ConcretizeMemory

* Wip refactoring

* Executor and exceptions refactor wip wip

* Fixing all_insts auto tests

* Visited and generate testcase now at manticore api level

* Aggregating state statistics into executor statistics

* Wip refactoring

* Executor and exceptions refactor wip wip

* Fixing all_insts auto tests

* Visited and generate testcase now at manticore api level

* Aggregating state statistics into executor statistics

* forwarding events wip

* state setstate fix and setup_stack merge fix

* will_terminate_state fix and tests skipped

* Update all ConcretizeRegister and ConcretizeMemory

* Exceptions are crazy crazy crazy

* fix last merge

* Merge merge until it pass

* Instructions count default to 0

* will/did execute/emulate

* Delayed keybpoard interrupt now shutdowns nicely

* fix auto test generator x86

* Undo bad merge

* utterly hopeless

* basic working

* Fix merge bugs and github comments

* Remove unnecesary comment - github comments

* trace_item not used there

* model-platform and system.py fixed

* backup/restore to store/load -- cpu.instruction property

* Slightly better did/will naming and dynamic signal forwarding

* platform.constraints and cpu.instruction as properties

* Fix forward signals getattr

* set las decoded pc at decode_instruction() / reenable instruction_cache

* Signals name convention: did/will/on

* Forward normal signals

* Maintain last decoded pc in abstractcpu

* Changed context manager so it just wont raise interrupt

* Decree now forwards signals and sets constraints

* linux.SymbolicFile does not need to maintain constraints

* remove debbug print

* Assimilating some PR commets

* size_total == size

* better merge of manticore.py

* typo

* Forwarding only specified objects in signal arguments

* Fix few broken tests

* revert + merge

* remove some unused stuff from manticore()

* manticore context <-> executor context

* manticore context <-> executor context2

* context context context

* forgotten return

* Fix basix.arm

* arm bitwise fix

* fix context

* Comment 1

* Comment 2

* Comment 3

* Comment 4

* Comment 5

* Comment 6

* Fix (still needs refactor but it works) profiling

* Fix (still needs refactor but it works) profiling

* The forgotten bit

* Update tests to reflect current output

* Verbosity fix

* Fix verbosity test
2017-06-26 18:06:18 -03:00
Mark Mossberg
edbb613045 Add basic binja viz plugin (#347)
* Add basic binja plugin

* Inline lnk

* Better instructions
2017-06-23 18:18:11 -04:00
Theofilos Petsios
e2c0414dca added _multiprocess_can_split_ directive (#351)
* added _multiprocess_can_split_ directive

* renamed Readme
2017-06-23 17:53:19 -04:00
Douglas Gastonguay-Goddard
6133a0e2ed Feature changes to support concrete execution. (#337)
* Feature changes to support concrete execution.

- Add ctypes to lseek for signed seeks. Pass whence to seek.
- Move mmap and related functions from SLinux to Linux.
- Introduce function _sys_open_get_file to isolate symbolic code in sys_open to SLinux.

* Remove white space, use super(...)._sys_open_get_file, self.current.address_bit_size.
2017-06-22 10:13:21 -04:00
Mark Mossberg
9a2d19f498 Update README.md to use pypi (#346)
* Update README.md

* Update README.md

* Update README.md
2017-06-21 19:58:09 -04:00
Mark Mossberg
3ec9043b2e Fix verbosity=1 (#345)
* Only enable debug executor after verbosity 1

* Add regression test for checking uniform cli output for nonverbose mode
2017-06-21 17:48:37 -04:00
JP Smith
860d51ebf1 Fix simple abspath bug (#344)
Fixes #343
2017-06-21 16:59:11 -04:00
Theofilos Petsios
a3f0d92393 Revert "rename getState to get_state (#338)" (#340)
This reverts commit d0465b3f91ad344d0f97312a4b181ca4093c1caf.
2017-06-20 18:14:24 -04:00
JP Smith
d0465b3f91 rename getState to get_state (#338) 2017-06-20 17:23:14 -04:00
Mark Mossberg
3bf529c371 Activate executor debug logging with verbosity=2 (#310)
Currently, we no verbosity level do we activate debug level logging
from the executor, however there is significant debug logging in the
executor for state forking output.
2017-06-19 16:50:11 -04:00
Scott
186fa9c8ca Changed Socket parameters to accept seek paramaters (#308) 2017-06-15 20:07:52 -04:00
Theofilos Petsios
285aaf8258 nits for common Socket/File FD operations (#301)
* nits for common Socket/File FD operations

* rev

* _is_open changed to _assert_open throwing IndexError

* reverted NotImplemented in File sync()

* moved sys_fstat from SLinux to Linux & fixes for _assert_open

* nit in sys_write

* comment nits
2017-06-15 13:54:24 -04:00
Mark Mossberg
9abef20b67 Manticore 0.1.2 (#306)
* Manticore 0.1.2

* Update changelog
2017-06-14 15:56:11 -04:00
JP Smith
5109e2835f Fix building linux examples and test for future failure (#284)
* fix building linux examples and test for future failure

* fix cd back and typo
2017-06-14 11:23:55 -04:00
JP Smith
b12224d8a6 short circuit _getState when queue is empty (#302) 2017-06-14 09:45:59 -04:00
Garret Reece
7f550becc6 Add mrc and movt
* Add MOVT instruction

* Add new ARM operand types for MRC

* mrc implementation seems to work

* UXTB inst implemented, provisional implementations of LDREX and STREX

* Added unit tests for MRC, MOVT, and UXTB

* Added mode swapping from blx instruction on arm cpu

* Make tests pass
2017-06-13 13:21:19 -05:00
JP Smith
5ea4a87ddb Fix SymbolicMemoryException (#303)
* fix SymbolicMemoryException

* make simple_parse's visited.txt more correct
2017-06-12 15:28:57 -04:00
JP Smith
1f8c4e18c6 Move pretty printing into helpers (#299)
* move pretty printing into helpers

* switch to using __str__
2017-06-09 17:48:56 -04:00
Theofilos Petsios
aa798c652e make SymbolicFile inherit from File (#298)
* make SymbolicFile inherit from File

* Create linux.py

Nit from merge (restore class to inheriting from File)

* Fixes on file creation

* revert of __stdin__ in assert

* removed asserts in SymbolicFile init
2017-06-09 17:35:42 -04:00
Mark Mossberg
0533fe1d2d Use global path for workspace (#295)
Temporary hack around simple chdir OS model
2017-06-09 13:42:49 -04:00
Mark Mossberg
595a33d3e0 Add .sync to regular Files also (#297) 2017-06-09 13:42:39 -04:00
JP Smith
31b39ccf9d unskip win32 API test (#294) 2017-06-09 11:39:28 -04:00
JP Smith
c7f5600cd1 unskip basic stdin test (#293) 2017-06-09 10:47:55 -04:00
Theofilos Petsios
584206f3f7 fixes #291 for incorrect syscall returns and some indent issues (#292)
* fixes #291 for incorrect syscall returns and some indent issues

* relative import fix

* commented weakref removal
2017-06-08 17:39:39 -04:00
Yan
776f6125ad fsync, rename, and a few cleanups (#290)
* Add sys_fsync()
* Add sys_rename()
* Fix sys_write return value
2017-06-08 15:57:20 -04:00
Mark Mossberg
586dff2491 Make Linux write(2) work with Files (#289)
* Add is_full() so sys_write can be generic

* Refactor Linux.sys_write to use File/Socket.write

Previously it used .transmit, which does not exist on Files. Remove
.transmit from Linux.Socket as that's a Decree artifact and it is more
linuxy to use write

* Support list arguments in File.write

* Revert accidental decree change
2017-06-08 14:03:31 -04:00
Mark Mossberg
22bfedf8bb Fix signal_transmit crash (#286)
* Check if fd is in self.rwait

* Check if set is empty
2017-06-07 17:22:37 -04:00
Theofilos Petsios
f3a48f23b8 removed duplicate type property (#283) 2017-06-06 15:27:01 -04:00
feliam
b0d967b687 remove callbacks (#282) 2017-06-06 12:16:30 -03:00
Yan
45a5393a1b Remove obsolete ABI code (#281) 2017-06-05 16:33:36 -04:00
Yan
2916d7e3ae Support tracing (#247)
* Script for generating syscall tables

* Add generated syscall table

* Reintroduce tracing script

* Add configuration options needed by verify.py

* Clean up verify; remove dependency on experimental after_hook

* trace experiments

* reorg verify.py

* Update after merge

* Remove Manticore param

* Remove unused vars

* Use regfile api; redo last_instr check

* Fix gdb->mcore name descrepancy

* Move kwargs to explicit args for Linux/SLinux

 * Maintain options in makeLinux to not overcomplicate the Manticore
   class

* Address merge issues

* remove debug stmt

* Reintroduce options

* Revert linux.py/manticore.py from master

* Use the qemu -s and -R flags

* Import syscalls table from master

* And import extract_syscalls.py script

* Fix verify reference

* Move syscall to arg

* Update register references

* Simplify last instruction check

* Add logging filter to TRACE logger as well

* Be consistent with state synchronization

* Be explicit about gdb types

* Improve mmap debug output

* Return error if ioctl is not implemented

* Fix syscall sync

* Make logging more self-contained

* Use errno const in ioctl impl
2017-06-05 16:16:54 -04:00
JP Smith
14499f7ba8 Add solve_buffer to API (#280)
* add solve_buffer to api and update google ctf script to use it

* start adding push/pop_constraints functionality

* remove push/pop constraints, just use with

* add mark's changes

* add solve_buffer to api.rst

* fix typo
2017-06-05 14:49:39 -04:00
Feist Josselin
573d171491 Add input-related features (#248)
* Add input-related features
* Add add_symbolic_file() function to Manticore
      -> Add symbolic file: m.add_symbolic_file('file.txt')
      -> 'symbolic.txt' is not longer a default symb file
* Symb files are generated by Executor.generate_testcase()
* Add generate_inputs() function to State
      -> can be called by an user-level script

* Use of Executor._getFilename to generate symb files in the workspace

* Consolidate the filename of generated symb files

* - replace % with format in executor.generate_testcase / state.generate_inputs
- replace file() with open() in executor.generate_testcase / state.generate_inputs
- replace hasasttr with getattr in executor.generate_testcase / state.generate_inputs
- use None as default arguments for symbolic_files

* file -> open

* Simplify symbolic_files param

* Make filename uniform

* Docstring clean
2017-06-05 12:25:49 -04:00
Mark Mossberg
5b5392e54d Implement user variadic model interface (#276)
* Add variadic decorator

* Add check for _variadic func attribute

* Expose @variadic at top level

* Use variable for the actual name of attr

* Update naming

* Use helper

* Maybe more pythonic?

* Add variadic to public API

* Add variadic decorator tests

* Clean

* Remove variadic parameter

* Add docstrings

* Document parameter

* Clean

* Better use of autodoc

* Update docstring

* Add todo comment
2017-05-31 15:48:19 -04:00
Feist Josselin
aeca64285a Optimizations and bug fixes in smt formulas (#249)
* Remove the use of the incremental mode in get_all_values

* Improvement and bug fixes in visitor.py
* PretyPrinter: Remove dupplicate printed information
* TranslatorSmtLib: Remove dupplicate operands in the generated formulas
* ConstantFolderSimplifier:
  * Add new operators (BitVecZeroExtand / BitVecExtract)
  * Add no-trivial operators into the operations dict
      -> users can known that these operators are handled
* ArithmeticSimplifier:
  * Use of a recursive approach to visit expression (faster)
  * Fix the missing calls to no-trivial operators for constant folding
  * Add new operator (ArraySelect)

* Fix issues on corner cases (tests/travis_test.sh ok)

ArithmeticSimplifier: recursive approach less interesting in travis_test.sh
Use a stack approach, which includes bugfixes of the original

* - Call direclty constant_folder() in ArithmeticSimplifier
- Remove None bindings in ConstantFolderSimplifier.operators
- Move the fixed point thing direclty to the Visitors.visit (new parameter: use_fixed_point)

* - Calling constant_folder only if all operands are constants
- Add None default attribute to getattr
2017-05-26 16:28:22 -03:00
Yan
0b710dd86a Add basic syscalls (#270)
* Add sys_umask and sys_chdir
2017-05-26 11:50:39 -04:00
Mark Mossberg
8354ded7e0 Test hook api (#274) 2017-05-25 16:22:08 -04:00
Mark Mossberg
c2b0617f32 Check returncode of manticore (#273) 2017-05-25 16:04:34 -04:00
David Manouchehri
d87c983b98 Added Dockerfile. (#240)
* Added Dockerfile.

* Changes as requested by @japesinator.
2017-05-24 16:49:37 -05:00
JP Smith
124c9d6de5 Add manticore-examples to README and remove google challenge (#271)
* add manticore-examples to README and remove google challenge

* re-do usage section and add manticore-examples repo
2017-05-24 16:09:48 -05:00
Yan
452c92a340 Update fstat/fstat64, add few syscall wrappers (#261)
* mmap; newstat; exit; sigprocmask syscall wrappers

* Fix fstat and fstat64 implementations

* use st_blocks/st_blksize

* Experiment with fstat structs

* Make uname more verbose

* Fix uname implementation

* Fix newfstat

* Fix fstat64

* Fix fstat

* Refactor uname
2017-05-24 15:15:50 -04:00
Yan
3c977719f0 Linux platform refactoring (#264)
* Clean up model syscall invocation
* Move read_string to Cpu
* move push/pop helpers to Cpu
* Reorg Linux initialization
* Update linux test
* fstat64 test harness
* assert read_string only considers concrete bytes
* Ensure that correct aliases exist during ctor
* Improve alias check
2017-05-23 15:30:58 -04:00
feliam
475f786f21 Fix x86.PUNPCKL emulation (#259)
* Fix x86.PUNPCKL emulation

* trace check wip

* PUNPCKH/L and Readlink /proc

* PUNPCK fixes

* remove debug traceback

* rename arguments insteag of commenting them

* fix comment
2017-05-23 15:21:48 -03:00
JP Smith
ea4f8edfd4 remove default nsolves parameter from solve_n (#266) 2017-05-22 14:14:27 -05:00
JP Smith
0029c8fdc5 refactor the verbosity interface to look cleaner (#265) 2017-05-22 14:14:03 -05:00