use of com.google.security.zynamics.reil.ReilBlock in project binnavi by google.
the class InstructionGraphTest method testOneNode.
@Test
public void testOneNode() {
final ReilBlock block1 = new ReilBlock(Lists.newArrayList(ReilHelpers.createNop(0), ReilHelpers.createNop(0), ReilHelpers.createNop(0), ReilHelpers.createNop(0), ReilHelpers.createNop(0)));
final List<ReilBlock> blocks = Lists.<ReilBlock>newArrayList(block1);
final ReilGraph rg = new ReilGraph(blocks, new ArrayList<ReilEdge>());
final InstructionGraph g = InstructionGraph.create(rg);
assertEquals(5, g.nodeCount());
assertEquals(4, g.edgeCount());
}
use of com.google.security.zynamics.reil.ReilBlock in project binnavi by google.
the class OperandGraphTest method testTwoNodes.
@Test
public void testTwoNodes() {
final Collection<ReilInstruction> instructions1 = new ArrayList<ReilInstruction>();
instructions1.add(ReilHelpers.createAdd(0, OperandSize.DWORD, "eax", OperandSize.DWORD, "123", OperandSize.QWORD, "t0"));
final Collection<ReilInstruction> instructions2 = new ArrayList<ReilInstruction>();
instructions2.add(ReilHelpers.createAnd(1, OperandSize.QWORD, "t0", OperandSize.DWORD, String.valueOf(0xFFFFFFFF), OperandSize.DWORD, "t1"));
final ReilBlock block1 = new ReilBlock(instructions1);
final ReilBlock block2 = new ReilBlock(instructions2);
final ReilEdge edge1 = new ReilEdge(block1, block2, EdgeType.JUMP_CONDITIONAL_FALSE);
ReilBlock.link(block1, block2, edge1);
final List<ReilBlock> blocks = Lists.newArrayList(block1, block2);
final List<ReilEdge> edges = Lists.newArrayList(edge1);
final ReilGraph rg = new ReilGraph(blocks, edges);
final OperandGraph g = OperandGraph.create(rg);
assertEquals(6, g.nodeCount());
assertEquals(5, g.edgeCount());
}
use of com.google.security.zynamics.reil.ReilBlock in project binnavi by google.
the class CombineTest method testIndependentBaseRegisters.
@Test
public void testIndependentBaseRegisters() {
final ReilInstruction instruction1 = ReilHelpers.createAdd(100, OperandSize.DWORD, "esi", OperandSize.DWORD, "4", OperandSize.DWORD, "eax");
final ReilInstruction instruction2 = ReilHelpers.createAdd(101, OperandSize.DWORD, "edi", OperandSize.DWORD, "8", OperandSize.DWORD, "eax");
final ReilInstruction instruction3 = ReilHelpers.createStr(102, OperandSize.DWORD, "eax", OperandSize.DWORD, "ebx");
final ReilBlock block1 = new ReilBlock(Lists.newArrayList(instruction1));
final ReilBlock block2 = new ReilBlock(Lists.newArrayList(instruction2));
final ReilBlock block3 = new ReilBlock(Lists.newArrayList(instruction3));
final ReilEdge edge1 = new ReilEdge(block1, block3, EdgeType.JUMP_UNCONDITIONAL);
final ReilEdge edge2 = new ReilEdge(block2, block3, EdgeType.JUMP_UNCONDITIONAL);
ReilBlock.link(block1, block3, edge1);
ReilBlock.link(block2, block3, edge2);
final ReilFunction function = new ReilFunction("Fark", new ReilGraph(Lists.newArrayList(block1, block2, block3), Lists.newArrayList(edge1, edge2)));
System.out.println(function.getGraph());
final IStateVector<InstructionGraphNode, ValueTrackerElement> result = ValueTracker.track(function);
System.out.println(result);
}
Aggregations