use of com.google.security.zynamics.binnavi.disassembly.IBlockNode in project binnavi by google.
the class PostgreSQLProviderTest method testInstructionFunctionsAddReference5.
@Test(expected = NullPointerException.class)
public void testInstructionFunctionsAddReference5() throws CouldntSaveDataException, CouldntLoadDataException, LoadCancelledException {
final INaviModule module = getProvider().loadModules().get(1);
module.load();
final INaviFunction function = module.getContent().getFunctionContainer().getFunctions().get(1800);
function.load();
final IBlockNode basicBlock = function.getBasicBlocks().get(0);
final INaviInstruction instruction = Iterables.get(basicBlock.getInstructions(), 1);
final COperandTree tree = instruction.getOperands().get(0);
final INaviOperandTreeNode node = tree.getRootNode();
final IAddress address = instruction.getAddress();
PostgreSQLInstructionFunctions.addReference(getProvider(), node, address, null);
}
use of com.google.security.zynamics.binnavi.disassembly.IBlockNode in project binnavi by google.
the class PostgreSQLVerifyNotepadTest method verifyInstructions.
@Test
public void verifyInstructions() throws CouldntLoadDataException, LoadCancelledException {
final INaviModule module = m_database.getContent().getModules().get(0);
module.load();
final INaviFunction function = module.getContent().getFunctionContainer().getFunction(new CAddress(BigInteger.valueOf(0x0100195D)));
function.load();
final List<IBlockNode> blocks = function.getBasicBlocks();
final IBlockNode block = blocks.get(0);
assertEquals(BigInteger.valueOf(0x0100195D), block.getAddress().toBigInteger());
final Iterable<INaviInstruction> instructions = block.getInstructions();
Iterables.get(instructions, 0).toString();
assertEquals("0100195D mov edi, edi", Iterables.get(instructions, 0).toString());
assertEquals("0100195F push ebp", Iterables.get(instructions, 1).toString());
assertEquals("01001960 mov ebp, esp", Iterables.get(instructions, 2).toString());
assertEquals("01001962 push ecx", Iterables.get(instructions, 3).toString());
assertEquals("01001963 push 2", Iterables.get(instructions, 4).toString());
assertEquals("01001965 lea eax, ss: [ebp + LCData]", Iterables.get(instructions, 5).toString());
assertEquals("01001968 push eax", Iterables.get(instructions, 6).toString());
assertEquals("01001969 push 13", Iterables.get(instructions, 7).toString());
assertEquals("0100196B push 1024", Iterables.get(instructions, 8).toString());
assertEquals("01001970 mov ds: [16819428], sub_1005F63", Iterables.get(instructions, 9).toString());
assertEquals("0100197A mov ds: [16819436], 12", Iterables.get(instructions, 10).toString());
assertEquals("01001984 call ds: [GetLocaleInfoW]", Iterables.get(instructions, 11).toString());
assertEquals("0100198A cmp word ss: [ebp + LCData], word 49", Iterables.get(instructions, 12).toString());
assertEquals("0100198F jnz loc_10019B1", Iterables.get(instructions, 13).toString());
module.close();
}
use of com.google.security.zynamics.binnavi.disassembly.IBlockNode in project binnavi by google.
the class PostgreSQLVerifyNotepadTest method verifyReferences.
@Test
public void verifyReferences() throws CouldntLoadDataException, LoadCancelledException {
final INaviModule module = m_database.getContent().getModules().get(0);
module.load();
final INaviFunction function = module.getContent().getFunctionContainer().getFunction(new CAddress(BigInteger.valueOf(0x01006F10)));
function.load();
final List<IBlockNode> blocks = function.getBasicBlocks();
final IBlockNode block = blocks.get(12);
assertEquals(BigInteger.valueOf(0x100702B), block.getAddress().toBigInteger());
final Iterable<INaviInstruction> instructions = block.getInstructions();
assertEquals(1, Iterables.get(instructions, 10).getOperands().get(0).getRootNode().getChildren().get(0).getReferences().size());
module.close();
}
use of com.google.security.zynamics.binnavi.disassembly.IBlockNode in project binnavi by google.
the class PostgreSQLProviderTest method testInstructionFunctionsDeleteReference4.
@Test
public void testInstructionFunctionsDeleteReference4() throws CouldntLoadDataException, LoadCancelledException, CouldntSaveDataException, CouldntDeleteException, MaybeNullException {
final INaviModule module = getProvider().loadModules().get(1);
module.load();
final INaviFunction function = module.getContent().getFunctionContainer().getFunction("DelayLoadFailureHook");
function.load();
final IBlockNode basicBlock = function.getBasicBlocks().get(0);
final INaviInstruction instruction = Iterables.get(basicBlock.getInstructions(), 1);
final COperandTree tree = instruction.getOperands().get(0);
final INaviOperandTreeNode node = tree.getRootNode();
final IAddress address = instruction.getAddress();
final ReferenceType type = ReferenceType.DATA;
final int references = node.getReferences().size();
PostgreSQLInstructionFunctions.addReference(getProvider(), node, address, type);
final INaviModule module2 = getProvider().loadModules().get(1);
module2.load();
final INaviFunction function2 = module2.getContent().getFunctionContainer().getFunction("DelayLoadFailureHook");
function2.load();
final IBlockNode basicBlock2 = function2.getBasicBlocks().get(0);
final INaviInstruction instruction2 = Iterables.get(basicBlock2.getInstructions(), 1);
final COperandTree tree2 = instruction2.getOperands().get(0);
final INaviOperandTreeNode node2 = tree2.getRootNode();
assertEquals(references + 1, node2.getReferences().size());
PostgreSQLInstructionFunctions.deleteReference(getProvider(), node2, address, type);
final INaviModule module3 = getProvider().loadModules().get(1);
module3.load();
final INaviFunction function3 = module3.getContent().getFunctionContainer().getFunction("DelayLoadFailureHook");
function3.load();
final IBlockNode basicBlock3 = function3.getBasicBlocks().get(0);
final INaviInstruction instruction3 = Iterables.get(basicBlock3.getInstructions(), 1);
final COperandTree tree3 = instruction3.getOperands().get(0);
final INaviOperandTreeNode node3 = tree3.getRootNode();
assertEquals(references, node3.getReferences().size());
}
use of com.google.security.zynamics.binnavi.disassembly.IBlockNode in project binnavi by google.
the class PostgreSQLProviderTest method testInstructionFunctionsAddReference4.
@Test(expected = NullPointerException.class)
public void testInstructionFunctionsAddReference4() throws CouldntSaveDataException, CouldntLoadDataException, LoadCancelledException {
final INaviModule module = getProvider().loadModules().get(1);
module.load();
final INaviFunction function = module.getContent().getFunctionContainer().getFunctions().get(1800);
function.load();
final IBlockNode basicBlock = function.getBasicBlocks().get(0);
final INaviInstruction instruction = Iterables.get(basicBlock.getInstructions(), 1);
final COperandTree tree = instruction.getOperands().get(0);
final INaviOperandTreeNode node = tree.getRootNode();
PostgreSQLInstructionFunctions.addReference(getProvider(), node, null, null);
}
Aggregations