Search in sources :

Example 6 with ValueTrackerElement

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

the class AddTransformerTest method testAddRegisterConstant.

@Test
public void testAddRegisterConstant() {
    final ReilInstruction instruction = ReilHelpers.createAdd(0x100, OperandSize.DWORD, "t0", OperandSize.DWORD, "4", OperandSize.QWORD, "t1");
    final ValueTrackerElement state = new ValueTrackerElement();
    final ValueTrackerElement result = AddTransformer.transform(instruction, state);
    assertTrue(result.getState("t1") instanceof Addition);
    assertTrue(((Addition) result.getState("t1")).getLhs() instanceof Symbol);
    assertTrue(((Addition) result.getState("t1")).getRhs() instanceof Literal);
}
Also used : ReilInstruction(com.google.security.zynamics.reil.ReilInstruction) Addition(com.google.security.zynamics.reil.algorithms.mono.valuetracking.elements.Addition) Symbol(com.google.security.zynamics.reil.algorithms.mono.valuetracking.elements.Symbol) Literal(com.google.security.zynamics.reil.algorithms.mono.valuetracking.elements.Literal) ValueTrackerElement(com.google.security.zynamics.reil.algorithms.mono.valuetracking.ValueTrackerElement) Test(org.junit.Test)

Example 7 with ValueTrackerElement

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

Aggregations

ValueTrackerElement (com.google.security.zynamics.reil.algorithms.mono.valuetracking.ValueTrackerElement)7 ReilInstruction (com.google.security.zynamics.reil.ReilInstruction)5 Test (org.junit.Test)5 ReilFunction (com.google.security.zynamics.reil.ReilFunction)3 InstructionGraphNode (com.google.security.zynamics.reil.algorithms.mono.InstructionGraphNode)3 ReilBlock (com.google.security.zynamics.reil.ReilBlock)2 ReilEdge (com.google.security.zynamics.reil.ReilEdge)2 ReilGraph (com.google.security.zynamics.reil.ReilGraph)2 Literal (com.google.security.zynamics.reil.algorithms.mono.valuetracking.elements.Literal)2 INaviInstruction (com.google.security.zynamics.binnavi.disassembly.INaviInstruction)1 INaviModule (com.google.security.zynamics.binnavi.disassembly.INaviModule)1 UnrelocatedAddress (com.google.security.zynamics.binnavi.disassembly.UnrelocatedAddress)1 INaviView (com.google.security.zynamics.binnavi.disassembly.views.INaviView)1 Addition (com.google.security.zynamics.reil.algorithms.mono.valuetracking.elements.Addition)1 IAloc (com.google.security.zynamics.reil.algorithms.mono.valuetracking.elements.IAloc)1 IValueElement (com.google.security.zynamics.reil.algorithms.mono.valuetracking.elements.IValueElement)1 Symbol (com.google.security.zynamics.reil.algorithms.mono.valuetracking.elements.Symbol)1 Undefined (com.google.security.zynamics.reil.algorithms.mono.valuetracking.elements.Undefined)1 ReilTranslator (com.google.security.zynamics.reil.translators.ReilTranslator)1 StandardEnvironment (com.google.security.zynamics.reil.translators.StandardEnvironment)1