Search in sources :

Example 6 with ReilTranslator

use of com.google.security.zynamics.reil.translators.ReilTranslator in project binnavi by google.

the class RegisterTrackerTest method setUp.

@Before
public void setUp() throws InternalTranslationException {
    final MockOperandTree operandTreeFirst1 = new MockOperandTree();
    operandTreeFirst1.root = new MockOperandTreeNode(ExpressionType.SIZE_PREFIX, "dword");
    operandTreeFirst1.root.m_children.add(new MockOperandTreeNode(ExpressionType.REGISTER, "ecx"));
    final MockOperandTree operandTreeFirst2 = new MockOperandTree();
    operandTreeFirst2.root = new MockOperandTreeNode(ExpressionType.SIZE_PREFIX, "dword");
    operandTreeFirst2.root.m_children.add(new MockOperandTreeNode(ExpressionType.MEMDEREF, "["));
    operandTreeFirst2.root.m_children.get(0).m_children.add(new MockOperandTreeNode(ExpressionType.OPERATOR, "+"));
    operandTreeFirst2.root.m_children.get(0).m_children.get(0).m_children.add(new MockOperandTreeNode(ExpressionType.REGISTER, "ebp"));
    operandTreeFirst2.root.m_children.get(0).m_children.get(0).m_children.add(new MockOperandTreeNode(ExpressionType.IMMEDIATE_INTEGER, "5"));
    final List<MockOperandTree> operandsFirst = Lists.newArrayList(operandTreeFirst1, operandTreeFirst2);
    m_movInstruction = new MockInstruction(Long.parseLong("5"), "mov", operandsFirst);
    final MockOperandTree operandTreeSecond1 = new MockOperandTree();
    operandTreeSecond1.root = new MockOperandTreeNode(ExpressionType.SIZE_PREFIX, "dword");
    operandTreeSecond1.root.m_children.add(new MockOperandTreeNode(ExpressionType.REGISTER, "ecx"));
    final MockOperandTree operandTreeSecond2 = new MockOperandTree();
    operandTreeSecond2.root = new MockOperandTreeNode(ExpressionType.SIZE_PREFIX, "dword");
    operandTreeSecond2.root.m_children.add(new MockOperandTreeNode(ExpressionType.REGISTER, "edx"));
    final MockOperandTree operandTreesecond3 = new MockOperandTree();
    operandTreesecond3.root = new MockOperandTreeNode(ExpressionType.SIZE_PREFIX, "byte");
    operandTreesecond3.root.m_children.add(new MockOperandTreeNode(ExpressionType.IMMEDIATE_INTEGER, "9"));
    final List<MockOperandTree> operandsSecond = Lists.newArrayList(operandTreeSecond1, operandTreeSecond2, operandTreesecond3);
    m_shldInstruction = new MockInstruction(Long.parseLong("8"), "shld", operandsSecond);
    final MockCodeContainer block = new MockCodeContainer();
    block.m_instructions.add(m_movInstruction);
    block.m_instructions.add(m_shldInstruction);
    final ReilTranslator<MockInstruction> reilTranslator = new ReilTranslator<MockInstruction>();
    m_graph = reilTranslator.translate(environment, block);
    m_function = new ReilFunction("REGISTER_TRACKER_TEST", m_graph);
}
Also used : MockCodeContainer(com.google.security.zynamics.zylib.disassembly.MockCodeContainer) MockOperandTreeNode(com.google.security.zynamics.zylib.disassembly.MockOperandTreeNode) MockInstruction(com.google.security.zynamics.zylib.disassembly.MockInstruction) ReilTranslator(com.google.security.zynamics.reil.translators.ReilTranslator) MockOperandTree(com.google.security.zynamics.zylib.disassembly.MockOperandTree) ReilFunction(com.google.security.zynamics.reil.ReilFunction) Before(org.junit.Before)

Aggregations

ReilTranslator (com.google.security.zynamics.reil.translators.ReilTranslator)6 INaviInstruction (com.google.security.zynamics.binnavi.disassembly.INaviInstruction)5 StandardEnvironment (com.google.security.zynamics.reil.translators.StandardEnvironment)5 Test (org.junit.Test)3 CCodeNode (com.google.security.zynamics.binnavi.disassembly.CCodeNode)2 INaviModule (com.google.security.zynamics.binnavi.disassembly.INaviModule)2 ReilFunction (com.google.security.zynamics.reil.ReilFunction)2 CAddress (com.google.security.zynamics.zylib.disassembly.CAddress)2 MockCodeNodeData (com.google.security.zynamics.binnavi.Database.MockClasses.MockCodeNodeData)1 MockCodeNodeProvider (com.google.security.zynamics.binnavi.Database.MockClasses.MockCodeNodeProvider)1 MockSqlProvider (com.google.security.zynamics.binnavi.Database.MockClasses.MockSqlProvider)1 CCodeNodeParser (com.google.security.zynamics.binnavi.Database.NodeParser.CCodeNodeParser)1 CTag (com.google.security.zynamics.binnavi.Tagging.CTag)1 CTagManager (com.google.security.zynamics.binnavi.Tagging.CTagManager)1 CFunctionNode (com.google.security.zynamics.binnavi.disassembly.CFunctionNode)1 CNaviViewEdge (com.google.security.zynamics.binnavi.disassembly.CNaviViewEdge)1 COperandTree (com.google.security.zynamics.binnavi.disassembly.COperandTree)1 COperandTreeNode (com.google.security.zynamics.binnavi.disassembly.COperandTreeNode)1 INaviFunction (com.google.security.zynamics.binnavi.disassembly.INaviFunction)1 MockFunction (com.google.security.zynamics.binnavi.disassembly.MockFunction)1