Search in sources :

Example 1 with Module

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

the class PathFinderTest method setUp.

@Before
public void setUp() throws IOException, IllegalStateException, CouldntLoadDataException, InvalidDatabaseException, InvalidExporterDatabaseFormatException, com.google.security.zynamics.binnavi.Database.Exceptions.CouldntLoadDriverException, com.google.security.zynamics.binnavi.Database.Exceptions.CouldntConnectException, com.google.security.zynamics.binnavi.Database.Exceptions.CouldntInitializeDatabaseException, com.google.security.zynamics.binnavi.Database.Exceptions.CouldntLoadDataException, InvalidDatabaseVersionException, LoadCancelledException {
    final String[] parts = CConfigLoader.loadPostgreSQL();
    final CDatabase database = new CDatabase("None", CJdbcDriverNames.jdbcPostgreSQLDriverName, parts[0], "test_disassembly", parts[1], parts[2], parts[3], false, false);
    final Database db = new Database(database);
    database.connect();
    database.load();
    final MockSqlProvider provider = new MockSqlProvider();
    final TagManager nodeTagManager = new TagManager(new CTagManager(new Tree<CTag>(new TreeNode<CTag>(new CTag(0, "", "", TagType.NODE_TAG, provider))), TagType.NODE_TAG, provider));
    final TagManager viewTagManager = new TagManager(new CTagManager(new Tree<CTag>(new TreeNode<CTag>(new CTag(0, "", "", TagType.VIEW_TAG, provider))), TagType.VIEW_TAG, provider));
    m_notepad = new Module(db, database.getContent().getModule(1), nodeTagManager, viewTagManager);
    m_notepad.load();
    m_kernel32 = new Module(db, database.getContent().getModule(2), nodeTagManager, viewTagManager);
    m_kernel32.load();
}
Also used : CDatabase(com.google.security.zynamics.binnavi.Database.CDatabase) CTagManager(com.google.security.zynamics.binnavi.Tagging.CTagManager) TagManager(com.google.security.zynamics.binnavi.API.disassembly.TagManager) MockSqlProvider(com.google.security.zynamics.binnavi.Database.MockClasses.MockSqlProvider) CDatabase(com.google.security.zynamics.binnavi.Database.CDatabase) Database(com.google.security.zynamics.binnavi.API.disassembly.Database) CTag(com.google.security.zynamics.binnavi.Tagging.CTag) Tree(com.google.security.zynamics.zylib.types.trees.Tree) CTagManager(com.google.security.zynamics.binnavi.Tagging.CTagManager) Module(com.google.security.zynamics.binnavi.API.disassembly.Module) Before(org.junit.Before)

Example 2 with Module

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

the class TraceLoggerTest method setUp.

@Before
public void setUp() throws CouldntLoadDataException, InvalidDatabaseVersionException {
    final SQLProvider mockProvider = new MockSqlProvider();
    // CDatabase("", "", "", "", "", false,
    final IDatabase internalDatabase = new MockDatabase();
    // false);
    final Database database = new Database(internalDatabase);
    database.load();
    final MockProject mockProject = new MockProject();
    final ITreeNode<CTag> nodeRootNode = new TreeNode<CTag>(new CTag(0, "", "", TagType.NODE_TAG, mockProvider));
    final Tree<CTag> nodeTagTree = new Tree<CTag>(nodeRootNode);
    final TagManager nodeTagManager = new TagManager(new CTagManager(nodeTagTree, TagType.NODE_TAG, mockProvider));
    final ITreeNode<CTag> viewRootNode = new TreeNode<CTag>(new CTag(0, "", "", TagType.VIEW_TAG, mockProvider));
    final Tree<CTag> viewTagTree = new Tree<CTag>(viewRootNode);
    final TagManager viewTagManager = new TagManager(new CTagManager(viewTagTree, TagType.VIEW_TAG, mockProvider));
    final Module module = new Module(database, mockModule, nodeTagManager, viewTagManager);
    final Project project = new Project(database, mockProject, nodeTagManager, viewTagManager);
    m_mockModule = new Module(database, mockModule, viewTagManager, nodeTagManager);
    m_debugSettings = new ModuleTargetSettings(m_mockModule.getNative());
    m_mockDebugger = new MockDebugger(m_debugSettings);
    m_mockDebugger.setAddressTranslator(mockModule, new CAddress(0), new CAddress(0x1000));
    final Debugger debugger = new Debugger(m_mockDebugger);
    m_logger = new TraceLogger(debugger, module);
    m_projectLogger = new TraceLogger(debugger, project);
}
Also used : MockDebugger(com.google.security.zynamics.binnavi.Debug.Debugger.MockDebugger) IDatabase(com.google.security.zynamics.binnavi.Database.Interfaces.IDatabase) CTag(com.google.security.zynamics.binnavi.Tagging.CTag) CTagManager(com.google.security.zynamics.binnavi.Tagging.CTagManager) ModuleTargetSettings(com.google.security.zynamics.binnavi.debug.debugger.ModuleTargetSettings) SQLProvider(com.google.security.zynamics.binnavi.Database.Interfaces.SQLProvider) CAddress(com.google.security.zynamics.zylib.disassembly.CAddress) MockProject(com.google.security.zynamics.binnavi.disassembly.MockProject) MockProject(com.google.security.zynamics.binnavi.disassembly.MockProject) Project(com.google.security.zynamics.binnavi.API.disassembly.Project) MockDebugger(com.google.security.zynamics.binnavi.Debug.Debugger.MockDebugger) CTagManager(com.google.security.zynamics.binnavi.Tagging.CTagManager) TagManager(com.google.security.zynamics.binnavi.API.disassembly.TagManager) MockSqlProvider(com.google.security.zynamics.binnavi.Database.MockClasses.MockSqlProvider) TreeNode(com.google.security.zynamics.zylib.types.trees.TreeNode) ITreeNode(com.google.security.zynamics.zylib.types.trees.ITreeNode) MockDatabase(com.google.security.zynamics.binnavi.Database.MockClasses.MockDatabase) Database(com.google.security.zynamics.binnavi.API.disassembly.Database) IDatabase(com.google.security.zynamics.binnavi.Database.Interfaces.IDatabase) MockDatabase(com.google.security.zynamics.binnavi.Database.MockClasses.MockDatabase) Tree(com.google.security.zynamics.zylib.types.trees.Tree) MockModule(com.google.security.zynamics.binnavi.disassembly.Modules.MockModule) Module(com.google.security.zynamics.binnavi.API.disassembly.Module) Before(org.junit.Before)

Example 3 with Module

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

the class BreakpointManagerTest method testGetBreakpoint.

@Test
public void testGetBreakpoint() {
    try {
        apiManager.getBreakpoint(null, null);
        fail();
    } catch (final NullPointerException exception) {
    }
    try {
        apiManager.getBreakpoint(null, new Address(0x123));
        fail();
    } catch (final NullPointerException exception) {
    }
    apiManager.setBreakpoint(module, new Address(0x123));
    final Breakpoint breakpoint = apiManager.getBreakpoint(module, new Address(0x123));
    assertEquals(0x123, breakpoint.getAddress().toLong());
    final Module module = ModuleFactory.get();
    apiManager.setBreakpoint(module, new Address(0x123));
    assertTrue(apiManager.hasBreakpoint(module, new Address(0x123)));
    final Breakpoint breakpoint2 = apiManager.getBreakpoint(module, new Address(0x123));
    assertEquals(0x123, breakpoint2.getAddress().toLong());
    apiManager.removeBreakpoint(module, new Address(0x123));
}
Also used : CAddress(com.google.security.zynamics.zylib.disassembly.CAddress) BreakpointAddress(com.google.security.zynamics.binnavi.debug.models.breakpoints.BreakpointAddress) Address(com.google.security.zynamics.binnavi.API.disassembly.Address) UnrelocatedAddress(com.google.security.zynamics.binnavi.disassembly.UnrelocatedAddress) Module(com.google.security.zynamics.binnavi.API.disassembly.Module) Test(org.junit.Test)

Example 4 with Module

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

the class DebuggerTest method testRelocation5.

@Test(expected = NullPointerException.class)
public void testRelocation5() {
    final INaviModule nativeModule = new MockModule();
    final Module module = ModuleFactory.get(nativeModule);
    debugger.toFilebase(module, null);
    fail();
}
Also used : INaviModule(com.google.security.zynamics.binnavi.disassembly.INaviModule) MockModule(com.google.security.zynamics.binnavi.disassembly.Modules.MockModule) MemoryModule(com.google.security.zynamics.binnavi.debug.models.processmanager.MemoryModule) Module(com.google.security.zynamics.binnavi.API.disassembly.Module) MockModule(com.google.security.zynamics.binnavi.disassembly.Modules.MockModule) INaviModule(com.google.security.zynamics.binnavi.disassembly.INaviModule) Test(org.junit.Test)

Example 5 with Module

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

the class DebuggerTest method testRelocation3.

@Test(expected = NullPointerException.class)
public void testRelocation3() {
    final INaviModule nativeModule = new MockModule();
    final Module module = ModuleFactory.get(nativeModule);
    debugger.toImagebase(module, null);
}
Also used : INaviModule(com.google.security.zynamics.binnavi.disassembly.INaviModule) MockModule(com.google.security.zynamics.binnavi.disassembly.Modules.MockModule) MemoryModule(com.google.security.zynamics.binnavi.debug.models.processmanager.MemoryModule) Module(com.google.security.zynamics.binnavi.API.disassembly.Module) MockModule(com.google.security.zynamics.binnavi.disassembly.Modules.MockModule) INaviModule(com.google.security.zynamics.binnavi.disassembly.INaviModule) Test(org.junit.Test)

Aggregations

Module (com.google.security.zynamics.binnavi.API.disassembly.Module)25 Database (com.google.security.zynamics.binnavi.API.disassembly.Database)8 Address (com.google.security.zynamics.binnavi.API.disassembly.Address)7 INaviModule (com.google.security.zynamics.binnavi.disassembly.INaviModule)7 MemoryModule (com.google.security.zynamics.binnavi.API.debug.MemoryModule)6 TagManager (com.google.security.zynamics.binnavi.API.disassembly.TagManager)6 MockSqlProvider (com.google.security.zynamics.binnavi.Database.MockClasses.MockSqlProvider)6 CTag (com.google.security.zynamics.binnavi.Tagging.CTag)6 CTagManager (com.google.security.zynamics.binnavi.Tagging.CTagManager)6 CAddress (com.google.security.zynamics.zylib.disassembly.CAddress)6 Tree (com.google.security.zynamics.zylib.types.trees.Tree)6 Test (org.junit.Test)6 Project (com.google.security.zynamics.binnavi.API.disassembly.Project)5 MockModule (com.google.security.zynamics.binnavi.disassembly.Modules.MockModule)5 Function (com.google.security.zynamics.binnavi.API.disassembly.Function)4 View (com.google.security.zynamics.binnavi.API.disassembly.View)4 ViewContainer (com.google.security.zynamics.binnavi.API.disassembly.ViewContainer)4 MockDatabase (com.google.security.zynamics.binnavi.Database.MockClasses.MockDatabase)4 CModule (com.google.security.zynamics.binnavi.disassembly.Modules.CModule)4 IDatabase (com.google.security.zynamics.binnavi.Database.Interfaces.IDatabase)3