Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions angr_platforms/bf/engine_bf.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import logging
import angr
import claripy

l = logging.getLogger(__name__)

Expand Down Expand Up @@ -99,7 +98,7 @@ def process_successors(self, successors, **kwargs):
successors.add_successor(
the_end,
state.ip,
claripy.true(),
angr.claripy.true(),
"Ijk_Exit",
add_guard=False,
exit_stmt_idx=-1,
Expand Down Expand Up @@ -129,7 +128,7 @@ def process_successors(self, successors, **kwargs):
newstate = state.copy()
newstate.regs.inout = 1 # Set this to 0 to cause a write syscall
newstate.ip = state.ip + 1
successors.add_successor(newstate, newstate.ip, claripy.true(), "Ijk_Syscall",
successors.add_successor(newstate, newstate.ip, angr.claripy.true(), "Ijk_Syscall",
add_guard=False, exit_stmt_idx=-1, exit_ins_addr=state.ip, source=my_block)
# Syscalls, even fake ones like this, end a basic block.
break
Expand All @@ -138,7 +137,7 @@ def process_successors(self, successors, **kwargs):
new_state = state.copy()
new_state.regs.inout = 0 # This must be 0 when we do a syscall to get a read!
new_state.ip = state.ip + 1
successors.add_successor(new_state, new_state.ip, claripy.true(), "Ijk_Syscall",
successors.add_successor(new_state, new_state.ip, angr.claripy.true(), "Ijk_Syscall",
add_guard=False, exit_stmt_idx=-1, exit_ins_addr=state.ip, source=my_block)
# Syscalls, even fake ones like this, end the basic block
break
Expand Down
11 changes: 6 additions & 5 deletions angr_platforms/ct64/ct64_angr.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@

import angr
import archinfo
import claripy
import cle

from angr.claripy import And, BVV

from .ct64_engine import UberEngineWithCT64K

l = logging.getLogger('angr.ct64k')
Expand Down Expand Up @@ -93,12 +94,12 @@ def state_blank(self, addr=None, **kwargs):

def state_entry(self, *args, **kwargs):
state = self.state_blank(*args, **kwargs)
state.memory.store(3, claripy.BVV(0, (0x200 - 3)*16))
state.memory.store(0x300, claripy.BVV(0, (0x1000 - 0x300)*16))
state.memory.store(3, BVV(0, (0x200 - 3)*16))
state.memory.store(0x300, BVV(0, (0x1000 - 0x300)*16))
return state

def _hard_checker(self, state, addr):
crange = claripy.And(addr >= 0x200, addr < 0x300)
crange = And(addr >= 0x200, addr < 0x300)
if not state.solver.satisfiable(extra_constraints=(crange,)):
return None

Expand Down Expand Up @@ -131,7 +132,7 @@ def hard_checker_wr(self, state):

# output
def hard_200_rd(state):
return claripy.BVV(0, 16)
return BVV(0, 16)

def hard_200_wr(state, v):
state.posix.fd[1].write_data(v)
Expand Down
2 changes: 1 addition & 1 deletion angr_platforms/ct64/ct64_engine.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import angr
import claripy
import angr.claripy as claripy

class CT64KMixin(angr.engines.SuccessorsEngine):
def process_successors(self, successors, **kwargs):
Expand Down
2 changes: 1 addition & 1 deletion angr_platforms/ebpf/simos_ebpf.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
)
from angr.simos import SimUserland, register_simos
from angr.sim_procedure import SimProcedure
from claripy import BVS, BVV
from angr.claripy import BVS, BVV

from . import ArchExtendedBPF

Expand Down
1 change: 0 additions & 1 deletion tests/manual_msp430_mc_cusco.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
l.setLevel(logging.DEBUG)
linspect = logging.getLogger('angr.state_plugins.inspect')
linspect.setLevel(logging.ERROR)
logging.getLogger("claripy.backends.backend_z3").setLevel(logging.WARNING)
logging.getLogger("angr.engines.vex.expressions").setLevel(logging.WARNING)
logging.getLogger('pyvex.lifting.util.lifter_helper').setLevel(logging.WARNING)
logging.getLogger('angr_platforms.msp430.instrs_msp430').setLevel(logging.WARNING)
Expand Down
6 changes: 3 additions & 3 deletions tests/test_bpf_idea.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import os

import angr
import claripy
import angr.claripy as claripy

from angr_platforms.bpf import *
from angr_platforms.bpf.lift_bpf import MAX_INSTR_ID
Expand Down Expand Up @@ -35,7 +35,7 @@ def test_idea_correct_flag():

assert len(simgr.found) == 1
assert simgr.found[0].history.addr == 4058 * 8 # executed until "ret ALLOW"
assert claripy.backends.concrete.convert(simgr.found[0].regs._res).value == 1 # the result is ALLOW
assert simgr.found[0].regs._res.concrete_value == 1 # the result is ALLOW


def test_idea_incorrect_flag():
Expand Down Expand Up @@ -64,7 +64,7 @@ def test_idea_incorrect_flag():

assert len(simgr.found) == 1
assert simgr.found[0].history.addr == 4045 * 8 # executed until "ret DENY"
assert claripy.backends.concrete.convert(simgr.found[0].regs._res).value == 0 # the result is DENY
assert simgr.found[0].regs._res.concrete_value == 0 # the result is DENY


def main():
Expand Down
5 changes: 2 additions & 3 deletions tests/test_riscv.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import os

import angr
import claripy

from angr_platforms.risc_v import *

Expand All @@ -17,8 +16,8 @@ def test_schoolbook_multiplication():

startState = proj.factory.call_state(targetAddress)

A = claripy.BVS("A",32)
B = claripy.BVS("B",32)
A = angr.claripy.BVS("A",32)
B = angr.claripy.BVS("B",32)
startState.memory.store(startState.regs.a0, A)
startState.memory.store(startState.regs.a1, B)

Expand Down
36 changes: 19 additions & 17 deletions tests/test_tricore.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
"""
import os
import unittest

import angr
import claripy
from angr.claripy import BVS

from angr_platforms.tricore import * # pylint: disable=[wildcard-import, unused-wildcard-import]

TEST_PROGRAMS_BASE = str(os.path.join(os.path.dirname(os.path.realpath(__file__)), '..', 'test_programs', 'tricore'))
Expand Down Expand Up @@ -51,7 +53,7 @@ def test_angr_find_v1(self):
proj.hook(0xa10061e0, angr.SIM_PROCEDURES['linux_kernel']['read']())

ea = state.regs.sp + 15
password = claripy.BVS('password', 8*8)
password = BVS('password', 8*8)
state.memory.store(ea, password)

state.regs.a4 = ea
Expand All @@ -78,7 +80,7 @@ def test_angr_find_v2(self):
proj.hook(0xa10061e0, angr.SIM_PROCEDURES['linux_kernel']['read']())

ea = state.regs.sp + 7
password = claripy.BVS('password', 8*8)
password = BVS('password', 8*8)
state.memory.store(ea, password)

sm = proj.factory.simulation_manager(state)
Expand All @@ -103,7 +105,7 @@ def test_angr_avoid(self):
proj.hook(0xa10006c8, angr.SIM_PROCEDURES['libc']['printf']())

ea = state.regs.sp + 0x1c
password = claripy.BVS('password', 8*8)
password = BVS('password', 8*8)
state.memory.store(ea, password)

state.regs.a4 = ea
Expand All @@ -127,7 +129,7 @@ def test_angr_find_condition(self):
state = proj.factory.blank_state(addr=0xa10004c0)

ea = state.regs.sp + 0x1c
password = claripy.BVS('password', 8*8)
password = BVS('password', 8*8)
state.memory.store(ea, password)

state.regs.a4 = ea
Expand All @@ -150,9 +152,9 @@ def test_angr_symbolic_registers(self):

state = proj.factory.blank_state(addr=0xa10005ae)

d1 = claripy.BVS('d1', 8*4)
d2 = claripy.BVS('d2', 8*4)
d3 = claripy.BVS('d3', 8*4)
d1 = BVS('d1', 8*4)
d2 = BVS('d2', 8*4)
d3 = BVS('d3', 8*4)
state.regs.d1 = d1
state.regs.d2 = d2
state.regs.d3 = d3
Expand All @@ -176,8 +178,8 @@ def test_angr_symbolic_stack(self):

state = proj.factory.blank_state(addr=0xa100044a)

user_input0 = claripy.BVS('user_input0', 8*4)
user_input1 = claripy.BVS('user_input1', 8*4)
user_input0 = BVS('user_input0', 8*4)
user_input1 = BVS('user_input1', 8*4)
state.memory.store(state.regs.a10 + 8, user_input0)
state.memory.store(state.regs.a10 + 12, user_input1)

Expand All @@ -199,10 +201,10 @@ def test_angr_symbolic_memory(self):

state = proj.factory.blank_state(addr=0xa10004c4)

user_input0 = claripy.BVS('user_input0', 8*8)
user_input1 = claripy.BVS('user_input1', 8*8)
user_input2 = claripy.BVS('user_input2', 8*8)
user_input3 = claripy.BVS('user_input3', 8*8)
user_input0 = BVS('user_input0', 8*8)
user_input1 = BVS('user_input1', 8*8)
user_input2 = BVS('user_input2', 8*8)
user_input3 = BVS('user_input3', 8*8)
state.memory.store(0xa10088f0, user_input0)
state.memory.store(0xa10088f8, user_input1)
state.memory.store(0xa1008900, user_input2)
Expand All @@ -229,8 +231,8 @@ def test_angr_symbolic_dynamic_memory(self):

state = proj.factory.blank_state(addr=0xa10004f2)

user_input0 = claripy.BVS('user_input0', 8*8)
user_input1 = claripy.BVS('user_input1', 8*8)
user_input0 = BVS('user_input0', 8*8)
user_input1 = BVS('user_input1', 8*8)

state.memory.store(0xa100894c, 0x11111111)
state.memory.store(0xa1008944, 0x22222222)
Expand All @@ -257,7 +259,7 @@ def test_angr_constraints(self):

self.assertEqual(proj.arch.name, 'TRICORE')

password = claripy.BVS('password', 8*16)
password = BVS('password', 8*16)

state = proj.factory.blank_state(addr=0xa10004d6)
state.memory.store(0xa1008900, state.memory.load(0xa1007b8e, 16))
Expand Down
Loading