Search in sources :

Example 1 with InstructionGraph

use of com.google.security.zynamics.reil.algorithms.mono.InstructionGraph in project binnavi by google.

the class ValueTracker method track.

public static IStateVector<InstructionGraphNode, ValueTrackerElement> track(final ReilFunction function) {
    Preconditions.checkNotNull(function, "Error: function argument can not be null");
    // Translate the given graph to an instruction graph
    final InstructionGraph instructionGraph = createInitialGraph(function);
    final StateVector<InstructionGraphNode, ValueTrackerElement> stateVector = createInitialStateVector(instructionGraph);
    final ValueTrackerSolver tracker = new ValueTrackerSolver(instructionGraph, stateVector);
    return tracker.solve();
}
Also used : InstructionGraph(com.google.security.zynamics.reil.algorithms.mono.InstructionGraph) InstructionGraphNode(com.google.security.zynamics.reil.algorithms.mono.InstructionGraphNode)

Example 2 with InstructionGraph

use of com.google.security.zynamics.reil.algorithms.mono.InstructionGraph in project binnavi by google.

the class InstructionGraphTest method testEmpty.

@Test
public void testEmpty() {
    final ReilGraph rg = new ReilGraph(new ArrayList<ReilBlock>(), new ArrayList<ReilEdge>());
    final InstructionGraph g = InstructionGraph.create(rg);
    assertEquals(0, g.nodeCount());
    assertEquals(0, g.edgeCount());
}
Also used : ReilGraph(com.google.security.zynamics.reil.ReilGraph) ReilEdge(com.google.security.zynamics.reil.ReilEdge) ReilBlock(com.google.security.zynamics.reil.ReilBlock) InstructionGraph(com.google.security.zynamics.reil.algorithms.mono.InstructionGraph) Test(org.junit.Test)

Example 3 with InstructionGraph

use of com.google.security.zynamics.reil.algorithms.mono.InstructionGraph in project binnavi by google.

the class InstructionGraphTest method testTwoNodes.

@Test
public void testTwoNodes() {
    final ReilBlock block1 = new ReilBlock(Lists.newArrayList(ReilHelpers.createNop(0)));
    final ReilBlock block2 = new ReilBlock(Lists.newArrayList(ReilHelpers.createUndef(1, OperandSize.DWORD, "eax")));
    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 InstructionGraph g = InstructionGraph.create(rg);
    assertEquals(2, g.nodeCount());
    assertEquals(1, g.edgeCount());
    assertEquals(0, g.getNodes().get(0).getInstruction().getAddress().toLong());
    assertEquals(1, g.getNodes().get(1).getInstruction().getAddress().toLong());
}
Also used : ReilGraph(com.google.security.zynamics.reil.ReilGraph) ReilEdge(com.google.security.zynamics.reil.ReilEdge) ReilBlock(com.google.security.zynamics.reil.ReilBlock) InstructionGraph(com.google.security.zynamics.reil.algorithms.mono.InstructionGraph) Test(org.junit.Test)

Example 4 with InstructionGraph

use of com.google.security.zynamics.reil.algorithms.mono.InstructionGraph 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());
}
Also used : ReilGraph(com.google.security.zynamics.reil.ReilGraph) ReilEdge(com.google.security.zynamics.reil.ReilEdge) ReilBlock(com.google.security.zynamics.reil.ReilBlock) InstructionGraph(com.google.security.zynamics.reil.algorithms.mono.InstructionGraph) Test(org.junit.Test)

Aggregations

InstructionGraph (com.google.security.zynamics.reil.algorithms.mono.InstructionGraph)4 ReilBlock (com.google.security.zynamics.reil.ReilBlock)3 ReilEdge (com.google.security.zynamics.reil.ReilEdge)3 ReilGraph (com.google.security.zynamics.reil.ReilGraph)3 Test (org.junit.Test)3 InstructionGraphNode (com.google.security.zynamics.reil.algorithms.mono.InstructionGraphNode)1