proof-of-concept of the experimental python3.6 version (manticore only)
This commit is contained in:
parent
462fcfb274
commit
b473726781
@ -16,7 +16,8 @@ import logging
|
||||
logging.basicConfig()
|
||||
|
||||
import argparse
|
||||
import md5
|
||||
#import md5
|
||||
import hashlib
|
||||
import os
|
||||
import struct
|
||||
|
||||
@ -147,7 +148,7 @@ class DeepState(object):
|
||||
|
||||
def read_c_string(self, ea, concretize=True, constrain=False):
|
||||
"""Read a NUL-terminated string from `ea`."""
|
||||
assert isinstance(ea, (int, long))
|
||||
assert isinstance(ea, (int))
|
||||
chars = []
|
||||
while True:
|
||||
b, ea = self.read_uint8_t(ea, concretize=concretize, constrain=constrain)
|
||||
@ -285,7 +286,7 @@ class DeepState(object):
|
||||
for b in byte_str:
|
||||
if isinstance(b, str):
|
||||
new_bytes.extend(ord(bn) for bn in b)
|
||||
elif isinstance(b, (int, long)):
|
||||
elif isinstance(b, (int)):
|
||||
new_bytes.append(b)
|
||||
elif isinstance(b, (list, tuple)):
|
||||
new_bytes.extend(self._concretize_bytes(b))
|
||||
@ -333,7 +334,7 @@ class DeepState(object):
|
||||
return
|
||||
|
||||
test_dir = self.context['test_dir']
|
||||
test_name = md5.new(input_bytes).hexdigest()
|
||||
test_name = hashlib.md5.new(input_bytes).hexdigest()
|
||||
|
||||
if self.context['failed']:
|
||||
test_name += ".fail"
|
||||
|
||||
@ -21,7 +21,7 @@ try:
|
||||
import manticore
|
||||
except Exception as e:
|
||||
if "Z3NotFoundError" in repr(type(e)):
|
||||
print "Manticore requires Z3 to be installed."
|
||||
print("Manticore requires Z3 to be installed.")
|
||||
sys.exit(255)
|
||||
else:
|
||||
raise
|
||||
@ -88,7 +88,7 @@ class DeepManticore(DeepState):
|
||||
return ea + 1
|
||||
|
||||
def concretize(self, val, constrain=False):
|
||||
if isinstance(val, (int, long)):
|
||||
if isinstance(val, (int)):
|
||||
return val
|
||||
elif isinstance(val, str):
|
||||
assert len(val) == 1
|
||||
@ -104,7 +104,7 @@ class DeepManticore(DeepState):
|
||||
return concrete_val
|
||||
|
||||
def concretize_min(self, val, constrain=False):
|
||||
if isinstance(val, (int, long)):
|
||||
if isinstance(val, (int)):
|
||||
return val
|
||||
concrete_val = min(self.state.concretize(val, policy='MINMAX'))
|
||||
if constrain:
|
||||
@ -112,7 +112,7 @@ class DeepManticore(DeepState):
|
||||
return concrete_val
|
||||
|
||||
def concretize_max(self, val, constrain=False):
|
||||
if isinstance(val, (int, long)):
|
||||
if isinstance(val, (int)):
|
||||
return val
|
||||
concrete_val = max(self.state.concretize(val, policy='MINMAX'))
|
||||
if constrain:
|
||||
@ -121,7 +121,7 @@ class DeepManticore(DeepState):
|
||||
|
||||
def concretize_many(self, val, max_num):
|
||||
assert 0 < max_num
|
||||
if isinstance(val, (int, long)):
|
||||
if isinstance(val, (int)):
|
||||
return [val]
|
||||
return self.state.solve_n(val, max_num)
|
||||
|
||||
|
||||
@ -30,11 +30,11 @@ setuptools.setup(
|
||||
author_email="peter@trailofbits.com",
|
||||
license="Apache-2.0",
|
||||
keywords="tdd testing symbolic execution",
|
||||
install_requires=['claripy==7.8.6.16','angr==7.8.7.1', 'manticore'],
|
||||
install_requires=[], #'claripy==7.8.6.16','angr==7.8.7.1', 'manticore'],
|
||||
entry_points={
|
||||
'console_scripts': [
|
||||
'deepstate = deepstate.main_manticore:main',
|
||||
'deepstate-angr = deepstate.main_angr:main',
|
||||
#'deepstate-angr = deepstate.main_angr:main',
|
||||
'deepstate-manticore = deepstate.main_manticore:main',
|
||||
]
|
||||
})
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user