Search in sources :

Example 21 with Module

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

the class PluginInterface method showInLastWindow.

/**
   * Shows a view in the last window.
   *
   * @param view The view to show.
   *
   * @return The view2d object that is shown.
   */
public View2D showInLastWindow(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(CWindowManager.instance().getLastWindow(), view, new CModuleContainer(container.getDatabase().getNative(), module.getNative()));
    } else {
        final Project project = (Project) container;
        return show(CWindowManager.instance().getLastWindow(), 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 22 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 MockSqlProvider provider = new MockSqlProvider();
    final Date creationDate = new Date();
    final Date modificationDate = new Date();
    final CModule internalModule = new CModule(123, "Name", "Comment", creationDate, modificationDate, "12345678123456781234567812345678", "1234567812345678123456781234567812345678", 55, 66, new CAddress(0x555), new CAddress(0x666), new DebuggerTemplate(1, "Mock Debugger", "localhaus", 88, provider), null, Integer.MAX_VALUE, false, 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, internalModule, nodeTagManager, viewTagManager);
}
Also used : DebuggerTemplate(com.google.security.zynamics.binnavi.debug.debugger.DebuggerTemplate) CTag(com.google.security.zynamics.binnavi.Tagging.CTag) CTagManager(com.google.security.zynamics.binnavi.Tagging.CTagManager) Date(java.util.Date) CAddress(com.google.security.zynamics.zylib.disassembly.CAddress) TagManager(com.google.security.zynamics.binnavi.API.disassembly.TagManager) CTagManager(com.google.security.zynamics.binnavi.Tagging.CTagManager) MockSqlProvider(com.google.security.zynamics.binnavi.Database.MockClasses.MockSqlProvider) 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) 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) CModule(com.google.security.zynamics.binnavi.disassembly.Modules.CModule)

Example 23 with Module

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

the class CModuleNodeMenuBuilder method getPluginModules.

/**
   * Returns the API module objects for the modules for which the menu was built.
   *
   * @return The API module objects.
   */
private List<Module> getPluginModules() {
    final DatabaseManager manager = PluginInterface.instance().getDatabaseManager();
    for (final Database database : manager) {
        if (database.getNative() == m_database) {
            final List<Module> allModules = database.getModules();
            final List<Module> menuModules = new ArrayList<Module>();
            for (final INaviModule module : m_modules) {
                menuModules.add(ObjectFinders.getObject(module, allModules));
            }
            return menuModules;
        }
    }
    throw new IllegalStateException("IE01165: Unknown database");
}
Also used : DatabaseManager(com.google.security.zynamics.binnavi.API.disassembly.DatabaseManager) INaviModule(com.google.security.zynamics.binnavi.disassembly.INaviModule) Database(com.google.security.zynamics.binnavi.API.disassembly.Database) IDatabase(com.google.security.zynamics.binnavi.Database.Interfaces.IDatabase) ArrayList(java.util.ArrayList) INaviModule(com.google.security.zynamics.binnavi.disassembly.INaviModule) Module(com.google.security.zynamics.binnavi.API.disassembly.Module)

Example 24 with Module

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

the class View2D method findView.

/**
   * Searches for the API view that wraps a given internal view.
   *
   * @param database Database to search for.
   * @param internalView Internal view to search for.
   * @param databases Databases to search through.
   *
   * @return The API view that wraps the given internal view.
   */
private static View findView(final IDatabase database, final INaviView internalView, final List<Database> databases) {
    final Database apiDatabase = ObjectFinders.getObject(database, databases);
    View view = null;
    for (final Module m : apiDatabase.getModules()) {
        if (!m.isLoaded()) {
            continue;
        }
        view = ObjectFinders.getObject(internalView, m.getViews());
        if (view != null) {
            return view;
        }
    }
    for (final Project project : apiDatabase.getProjects()) {
        if (!project.isLoaded()) {
            continue;
        }
        view = ObjectFinders.getObject(internalView, project.getViews());
        if (view != null) {
            return view;
        }
    }
    throw new IllegalStateException("Error: Unknown view");
}
Also used : Project(com.google.security.zynamics.binnavi.API.disassembly.Project) Database(com.google.security.zynamics.binnavi.API.disassembly.Database) IDatabase(com.google.security.zynamics.binnavi.Database.Interfaces.IDatabase) Module(com.google.security.zynamics.binnavi.API.disassembly.Module) View(com.google.security.zynamics.binnavi.API.disassembly.View) INaviView(com.google.security.zynamics.binnavi.disassembly.views.INaviView)

Example 25 with Module

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

the class PathfinderPlugin method extendModuleMenu.

@Override
public List<JComponent> extendModuleMenu(final List<Module> modules) {
    // This function is used to extend the context menu of module
    // nodes in the project tree or in tables of the main window
    // where modules are listed.
    // The module list given as the parameter contains a list of modules.
    // In case the context menu of a module node is created, this list
    // contains exactly one module. In case the context menu of a
    // table is created, the list contains the corresponding modules of the selected
    // rows of the table.
    final List<JComponent> menus = new ArrayList<JComponent>();
    if (modules.size() == 1) {
        // The pathfinding functionality is only offered when the list
        // contains just a single module. This means that either a node
        // of the project tree was clicked or just one module is selected
        // in the modules table.
        final Module targetModule = modules.get(0);
        menus.add(new JMenuItem(new PathfindingAction(targetModule)));
    }
    return menus;
}
Also used : ArrayList(java.util.ArrayList) JComponent(javax.swing.JComponent) Module(com.google.security.zynamics.binnavi.API.disassembly.Module) JMenuItem(javax.swing.JMenuItem)

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