Search in sources :

Example 41 with INaviModule

use of com.google.security.zynamics.binnavi.disassembly.INaviModule in project binnavi by google.

the class PostgreSQLSectionFunctionsTests method testSetSectionName4.

@Test
public void testSetSectionName4() throws CouldntSaveDataException, CouldntLoadDataException, LoadCancelledException {
    final String newName = " NEW SECTION NAME ";
    final INaviModule module = getKernel32Module();
    final Map<Section, Integer> sections = getProvider().loadSections(module);
    final Section section = sections.keySet().iterator().next();
    getProvider().setSectionName(module.getConfiguration().getId(), section.getId(), newName);
    module.close();
    module.load();
    final Section section2 = module.getContent().getSections().getSection(section.getId());
    Assert.assertEquals(newName, section2.getName());
}
Also used : BigInteger(java.math.BigInteger) INaviModule(com.google.security.zynamics.binnavi.disassembly.INaviModule) Section(com.google.security.zynamics.binnavi.disassembly.types.Section) ExpensiveBaseTest(com.google.security.zynamics.binnavi.disassembly.types.ExpensiveBaseTest) Test(org.junit.Test)

Example 42 with INaviModule

use of com.google.security.zynamics.binnavi.disassembly.INaviModule in project binnavi by google.

the class PostgreSQLSectionFunctionsTests method testDeleteSection1.

@Test
public void testDeleteSection1() throws CouldntLoadDataException, LoadCancelledException {
    final INaviModule module = getKernel32Module();
    final Map<Section, Integer> sections = getProvider().loadSections(module);
    final int numberOfSections = sections.size();
    final Section section = sections.keySet().iterator().next();
    getProvider().deleteSection(section);
    module.close();
    module.load();
    final Map<Section, Integer> sections2 = getProvider().loadSections(module);
    Assert.assertEquals(numberOfSections - 1, sections2.size());
}
Also used : BigInteger(java.math.BigInteger) INaviModule(com.google.security.zynamics.binnavi.disassembly.INaviModule) Section(com.google.security.zynamics.binnavi.disassembly.types.Section) ExpensiveBaseTest(com.google.security.zynamics.binnavi.disassembly.types.ExpensiveBaseTest) Test(org.junit.Test)

Example 43 with INaviModule

use of com.google.security.zynamics.binnavi.disassembly.INaviModule in project binnavi by google.

the class PostgreSQLSectionFunctionsTests method testCreateSection6.

@Test
public void testCreateSection6() throws CouldntSaveDataException, CouldntLoadDataException, LoadCancelledException {
    final INaviModule module = getKernel32Module();
    final String sectionName = " SECTION NAME ";
    final BigInteger startAddress = new BigInteger("10000", 16);
    final BigInteger endAddress = new BigInteger("20000", 16);
    final int sectionId = getProvider().createSection(module.getConfiguration().getId(), sectionName, null, startAddress, endAddress, SectionPermission.READ_WRITE_EXECUTE, new byte[] {});
    module.close();
    module.load();
    final Section section = module.getContent().getSections().getSection(sectionId);
    Assert.assertEquals(section.getName(), sectionName);
    Assert.assertEquals(section.getStartAddress().toBigInteger(), startAddress);
    Assert.assertEquals(section.getEndAddress().toBigInteger(), endAddress);
    Assert.assertEquals(section.getSectionPermission(), SectionPermission.READ_WRITE_EXECUTE);
    module.close();
}
Also used : INaviModule(com.google.security.zynamics.binnavi.disassembly.INaviModule) BigInteger(java.math.BigInteger) Section(com.google.security.zynamics.binnavi.disassembly.types.Section) ExpensiveBaseTest(com.google.security.zynamics.binnavi.disassembly.types.ExpensiveBaseTest) Test(org.junit.Test)

Example 44 with INaviModule

use of com.google.security.zynamics.binnavi.disassembly.INaviModule in project binnavi by google.

the class PostgreSQLProviderTest method testSetImageBase1.

@Test
public void testSetImageBase1() throws CouldntSaveDataException, CouldntLoadDataException {
    final CProject project = getProvider().createProject("SOME_TEST_PROJECT");
    getProvider().createAddressSpace(project, "SOME_ADDRESS_SPACE");
    final CAddressSpace addressSpace = getProvider().loadAddressSpaces(project).get(0);
    final INaviModule module = getProvider().loadModules().get(0);
    getProvider().setImageBase(addressSpace, module, new CAddress(BigInteger.valueOf(0)));
}
Also used : CProject(com.google.security.zynamics.binnavi.disassembly.CProject) INaviModule(com.google.security.zynamics.binnavi.disassembly.INaviModule) CAddressSpace(com.google.security.zynamics.binnavi.disassembly.AddressSpaces.CAddressSpace) CAddress(com.google.security.zynamics.zylib.disassembly.CAddress) ExpensiveBaseTest(com.google.security.zynamics.binnavi.disassembly.types.ExpensiveBaseTest) Test(org.junit.Test)

Example 45 with INaviModule

use of com.google.security.zynamics.binnavi.disassembly.INaviModule in project binnavi by google.

the class PostgreSQLProviderTest method testAddModule1.

@Test
public void testAddModule1() throws CouldntSaveDataException, CouldntLoadDataException, CouldntDeleteException {
    final INaviModule module = getProvider().loadModules().get(0);
    final CProject project = getProvider().createProject("FOOBAR_PROJECT");
    getProvider().createAddressSpace(project, "FOOBAR_ADDRESS_SPACE");
    final CAddressSpace as = getProvider().loadAddressSpaces(project).get(0);
    getProvider().addModule(as, module);
    try {
        getProvider().addModule(as, module);
        fail();
    } catch (final CouldntSaveDataException exception) {
        getProvider().removeModule(as, module);
    }
}
Also used : CProject(com.google.security.zynamics.binnavi.disassembly.CProject) INaviModule(com.google.security.zynamics.binnavi.disassembly.INaviModule) CouldntSaveDataException(com.google.security.zynamics.binnavi.Database.Exceptions.CouldntSaveDataException) CAddressSpace(com.google.security.zynamics.binnavi.disassembly.AddressSpaces.CAddressSpace) ExpensiveBaseTest(com.google.security.zynamics.binnavi.disassembly.types.ExpensiveBaseTest) Test(org.junit.Test)

Aggregations

INaviModule (com.google.security.zynamics.binnavi.disassembly.INaviModule)180 Test (org.junit.Test)105 ExpensiveBaseTest (com.google.security.zynamics.binnavi.disassembly.types.ExpensiveBaseTest)69 INaviFunction (com.google.security.zynamics.binnavi.disassembly.INaviFunction)39 CAddress (com.google.security.zynamics.zylib.disassembly.CAddress)39 INaviView (com.google.security.zynamics.binnavi.disassembly.views.INaviView)29 UnrelocatedAddress (com.google.security.zynamics.binnavi.disassembly.UnrelocatedAddress)28 IAddress (com.google.security.zynamics.zylib.disassembly.IAddress)28 MockModule (com.google.security.zynamics.binnavi.disassembly.Modules.MockModule)24 BreakpointAddress (com.google.security.zynamics.binnavi.debug.models.breakpoints.BreakpointAddress)22 ArrayList (java.util.ArrayList)19 INaviInstruction (com.google.security.zynamics.binnavi.disassembly.INaviInstruction)18 CView (com.google.security.zynamics.binnavi.disassembly.views.CView)13 BigInteger (java.math.BigInteger)13 CTag (com.google.security.zynamics.binnavi.Tagging.CTag)12 CouldntSaveDataException (com.google.security.zynamics.binnavi.Database.Exceptions.CouldntSaveDataException)11 CTagManager (com.google.security.zynamics.binnavi.Tagging.CTagManager)11 CouldntLoadDataException (com.google.security.zynamics.binnavi.Database.Exceptions.CouldntLoadDataException)9 CAddressSpace (com.google.security.zynamics.binnavi.disassembly.AddressSpaces.CAddressSpace)9 COperandTree (com.google.security.zynamics.binnavi.disassembly.COperandTree)9