Search in sources :

Example 16 with Module

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

the class ModuleFactory method get.

public static Module get(final INaviModule module, final SQLProvider provider) {
    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));
    final Database db = new Database(new MockDatabase());
    return new Module(db, module, nodeTagManager, viewTagManager);
}
Also used : TagManager(com.google.security.zynamics.binnavi.API.disassembly.TagManager) CTagManager(com.google.security.zynamics.binnavi.Tagging.CTagManager) CTag(com.google.security.zynamics.binnavi.Tagging.CTag) MockDatabase(com.google.security.zynamics.binnavi.Database.MockClasses.MockDatabase) Database(com.google.security.zynamics.binnavi.API.disassembly.Database) Tree(com.google.security.zynamics.zylib.types.trees.Tree) MockDatabase(com.google.security.zynamics.binnavi.Database.MockClasses.MockDatabase) CTagManager(com.google.security.zynamics.binnavi.Tagging.CTagManager) INaviModule(com.google.security.zynamics.binnavi.disassembly.INaviModule) Module(com.google.security.zynamics.binnavi.API.disassembly.Module) CModule(com.google.security.zynamics.binnavi.disassembly.Modules.CModule)

Example 17 with Module

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

the class PluginInterface method showInWindow.

/**
   * Shows a view in a given window.
   *
   * @param window The window where the view is shown.
   * @param view The view to show.
   *
   * @return The view2d object that is shown.
   */
public View2D showInWindow(final GraphWindow window, final View view) {
    Preconditions.checkNotNull(view, "Error: View argument can not be null");
    final ViewContainer container = view.getContainer();
    if (container instanceof Module) {
        final Module module = (Module) container;
        return show(window.getNative(), view, new CModuleContainer(container.getDatabase().getNative(), module.getNative()));
    } else {
        final Project project = (Project) container;
        return show(window.getNative(), view, new CProjectContainer(container.getDatabase().getNative(), project.getNative()));
    }
}
Also used : Project(com.google.security.zynamics.binnavi.API.disassembly.Project) CProjectContainer(com.google.security.zynamics.binnavi.disassembly.CProjectContainer) Module(com.google.security.zynamics.binnavi.API.disassembly.Module) CModuleContainer(com.google.security.zynamics.binnavi.disassembly.Modules.CModuleContainer) IViewContainer(com.google.security.zynamics.binnavi.disassembly.views.IViewContainer) ViewContainer(com.google.security.zynamics.binnavi.API.disassembly.ViewContainer)

Example 18 with Module

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

the class BreakpointManagerTest method testGetEchoBreakpoint.

@Test
public void testGetEchoBreakpoint() {
    try {
        apiManager.getEchoBreakpoint(null, null);
        fail();
    } catch (final NullPointerException exception) {
    }
    try {
        apiManager.getEchoBreakpoint(null, new Address(0x123));
        fail();
    } catch (final NullPointerException exception) {
    }
    apiManager.setEchoBreakpoint(module, new Address(0x123));
    final Breakpoint breakpoint = apiManager.getEchoBreakpoint(module, new Address(0x123));
    assertEquals(0x123, breakpoint.getAddress().toLong());
    final Module module = ModuleFactory.get();
    apiManager.setEchoBreakpoint(module, new Address(0x123));
    assertTrue(apiManager.hasEchoBreakpoint(module, new Address(0x123)));
    final Breakpoint breakpoint2 = apiManager.getEchoBreakpoint(module, new Address(0x123));
    assertEquals(0x123, breakpoint2.getAddress().toLong());
    apiManager.removeEchoBreakpoint(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 19 with Module

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

the class DebuggerTest method testRelocation1.

@Test
public void testRelocation1() {
    final INaviModule nativeModule = new MockModule();
    mockDebugger.setAddressTranslator(nativeModule, new CAddress(100), new CAddress(200));
    final Module module = ModuleFactory.get(nativeModule);
    assertEquals(250, debugger.toImagebase(module, new Address(150)).toLong());
    assertEquals(150, debugger.toFilebase(module, new Address(250)).toLong());
}
Also used : INaviModule(com.google.security.zynamics.binnavi.disassembly.INaviModule) MockModule(com.google.security.zynamics.binnavi.disassembly.Modules.MockModule) RelocatedAddress(com.google.security.zynamics.binnavi.disassembly.RelocatedAddress) CAddress(com.google.security.zynamics.zylib.disassembly.CAddress) Address(com.google.security.zynamics.binnavi.API.disassembly.Address) 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) CAddress(com.google.security.zynamics.zylib.disassembly.CAddress) Test(org.junit.Test)

Example 20 with Module

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

the class PluginInterface method showInNewWindow.

/**
   * Shows a view in a new window.
   *
   * @param view The view to show.
   *
   * @return The view2d object that is shown.
   */
public View2D showInNewWindow(final View view) {
    Preconditions.checkNotNull(view, "Error: View argument can not be null");
    final ViewContainer container = view.getContainer();
    if (container instanceof Module) {
        final Module module = (Module) container;
        return show(null, view, new CModuleContainer(container.getDatabase().getNative(), module.getNative()));
    } else {
        final Project project = (Project) container;
        return show(null, view, new CProjectContainer(container.getDatabase().getNative(), project.getNative()));
    }
}
Also used : Project(com.google.security.zynamics.binnavi.API.disassembly.Project) CProjectContainer(com.google.security.zynamics.binnavi.disassembly.CProjectContainer) Module(com.google.security.zynamics.binnavi.API.disassembly.Module) CModuleContainer(com.google.security.zynamics.binnavi.disassembly.Modules.CModuleContainer) IViewContainer(com.google.security.zynamics.binnavi.disassembly.views.IViewContainer) ViewContainer(com.google.security.zynamics.binnavi.API.disassembly.ViewContainer)

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