Search in sources :

Example 6 with ZyGraphViewSettings

use of com.google.security.zynamics.binnavi.ZyGraph.ZyGraphViewSettings in project binnavi by google.

the class InstructionNode method toString.

@Override
public String toString() {
    final ZyGraphViewSettings settings = new ZyGraphViewSettings(new GraphSettingsConfigItem());
    final DebuggerProvider provider = new DebuggerProvider(new ModuleTargetSettings(instruction.getModule()));
    return ZyInstructionBuilder.buildInstructionLine(instruction, settings, new CDefaultModifier(settings, provider)).first();
}
Also used : GraphSettingsConfigItem(com.google.security.zynamics.binnavi.config.GraphSettingsConfigItem) ZyGraphViewSettings(com.google.security.zynamics.binnavi.ZyGraph.ZyGraphViewSettings) DebuggerProvider(com.google.security.zynamics.binnavi.debug.debugger.DebuggerProvider) ModuleTargetSettings(com.google.security.zynamics.binnavi.debug.debugger.ModuleTargetSettings) CDefaultModifier(com.google.security.zynamics.binnavi.ZyGraph.Builders.Modifiers.CDefaultModifier)

Example 7 with ZyGraphViewSettings

use of com.google.security.zynamics.binnavi.ZyGraph.ZyGraphViewSettings in project binnavi by google.

the class ViewDumper method main.

public static void main(final String[] args) throws IOException, FileReadException, CouldntLoadDataException, InvalidDatabaseVersionException, CouldntLoadDriverException, CouldntConnectException, InvalidDatabaseException, CouldntInitializeDatabaseException, InvalidExporterDatabaseFormatException, CPartialLoadException, LoadCancelledException {
    ConfigManager.instance().read();
    final ZyGraphViewSettings viewSettings = ConfigManager.instance().getDefaultFlowGraphSettings();
    final ZyGraphProximitySettings proximitySettings = viewSettings.getProximitySettings();
    proximitySettings.setProximityBrowsingActivationThreshold(50);
    proximitySettings.setProximityBrowsingChildren(2);
    proximitySettings.setProximityBrowsingParents(2);
    ConfigManager.instance().updateFlowgraphSettings(viewSettings);
    @SuppressWarnings("unused") final MockSqlProvider m_provider = new MockSqlProvider();
    final String[] parts = CConfigLoader.loadPostgreSQL();
    final CDatabase m_database = new CDatabase("None", CJdbcDriverNames.jdbcPostgreSQLDriverName, parts[0], "test_disassembly", parts[1], parts[2], parts[3], false, false);
    m_database.connect();
    m_database.load();
    final INaviModule m_module = m_database.getContent().getModules().get(0);
    m_module.load();
    final IFlowgraphView m_view = m_database.getContent().getModules().get(0).getContent().getViewContainer().getNativeFlowgraphViews().get(199);
    m_view.load();
    System.out.println("MockSqlProvider provider = new MockSqlProvider();");
    System.out.println("MockModule module = new MockModule();");
    System.out.println("MockFunction function = new MockFunction();");
    System.out.println("List<INaviViewNode> nodes = new ArrayList<INaviViewNode>();");
    System.out.println("List<INaviEdge> edges = new ArrayList<INaviEdge>();");
    for (final INaviViewNode node : m_view.getGraph()) {
        final CCodeNode oldNode = (CCodeNode) node;
        System.out.printf("CCodeNode node_%d = new CCodeNode(%d, 0, 0, Color.BLUE, Color.BLACK, false, true, \"\", function, new HashSet<CTag>(), provider);\n", node.getId(), node.getId());
        for (final INaviInstruction instruction : oldNode.getInstructions()) {
            System.out.printf("final CInstruction newInstruction_%s = new CInstruction(module, new CAddress(%d), \"%s\", new ArrayList<COperandTree>(), new byte[0], provider);\n", instruction.getAddress(), instruction.getAddress().toLong(), instruction.getMnemonic());
            System.out.printf("node_%d.addInstruction(newInstruction_%s, \"\");\n", oldNode.getId(), instruction.getAddress());
        }
        System.out.printf("nodes.add(node_%d);\n", node.getId());
    }
    for (final INaviEdge edge : m_view.getGraph().getEdges()) {
        System.out.printf("CNaviEdge edge_%d = new CNaviEdge(%s, node_%d, node_%d, EdgeType.%s, 0, 0, 0, 0, Color.BLACK, false, true, \"\", new ArrayList<CBend>(), provider);\n", edge.getId(), edge.getId(), edge.getSource().getId(), edge.getTarget().getId(), edge.getType());
        System.out.printf("edges.add(edge_%d);\n", edge.getId());
        System.out.printf("CNaviViewNode.link(node_%d, node_%d);\n", edge.getSource().getId(), edge.getTarget().getId());
        System.out.printf("node_%d.addOutgoingEdge(edge_%d);\n", edge.getSource().getId(), edge.getId());
        System.out.printf("node_%d.addIncomingEdge(edge_%d);\n", edge.getTarget().getId(), edge.getId());
    }
    System.out.println("final INaviView view = new MockView(nodes, edges);");
    m_database.close();
}
Also used : ZyGraphViewSettings(com.google.security.zynamics.binnavi.ZyGraph.ZyGraphViewSettings) ZyGraphProximitySettings(com.google.security.zynamics.binnavi.ZyGraph.Settings.ZyGraphProximitySettings) CDatabase(com.google.security.zynamics.binnavi.Database.CDatabase) MockSqlProvider(com.google.security.zynamics.binnavi.Database.MockClasses.MockSqlProvider)

Example 8 with ZyGraphViewSettings

use of com.google.security.zynamics.binnavi.ZyGraph.ZyGraphViewSettings in project binnavi by google.

the class ZyGraphViewSettingsFactory method get.

public static ZyGraphViewSettings get() {
    final ZyGraphViewSettings settings = new ZyGraphViewSettings(new CallGraphSettingsConfigItem());
    settings.getLayoutSettings().setDefaultGraphLayout(LayoutStyle.CIRCULAR);
    return settings;
}
Also used : ZyGraphViewSettings(com.google.security.zynamics.binnavi.ZyGraph.ZyGraphViewSettings) CallGraphSettingsConfigItem(com.google.security.zynamics.binnavi.config.CallGraphSettingsConfigItem)

Example 9 with ZyGraphViewSettings

use of com.google.security.zynamics.binnavi.ZyGraph.ZyGraphViewSettings in project binnavi by google.

the class CSettingsDialogFunctions method showCallgraphSettingsDialog.

/**
   * Shows the initial call graph settings dialog.
   * 
   * @param parent Parent window used for dialogs.
   */
public static void showCallgraphSettingsDialog(final JFrame parent) {
    final ZyGraphViewSettings settings = ConfigManager.instance().getDefaultCallGraphSettings();
    final CGraphSettingsDialog dlg = new CGraphSettingsDialog(parent, "Initial Call graph Settings", settings, true, true);
    dlg.setVisible(true);
    ConfigManager.instance().updateCallgraphSettings(settings);
    ConfigManager.instance().saveSettings(parent);
}
Also used : ZyGraphViewSettings(com.google.security.zynamics.binnavi.ZyGraph.ZyGraphViewSettings) CGraphSettingsDialog(com.google.security.zynamics.binnavi.Gui.GraphSettings.CGraphSettingsDialog)

Example 10 with ZyGraphViewSettings

use of com.google.security.zynamics.binnavi.ZyGraph.ZyGraphViewSettings in project binnavi by google.

the class CGraphBuilder method loadNativeSettings.

/**
   * Generates the default graph settings for a native view.
   *
   * @param view The view whose graph settings are generated.
   *
   * @return The generated graph settings.
   */
private static Pair<Map<String, String>, ZyGraphViewSettings> loadNativeSettings(final INaviView view) {
    final ConfigManager configFile = ConfigManager.instance();
    // Native views receive the default settings when they are loaded.
    final ZyGraphViewSettings graphSettings = view.getGraphType() == GraphType.CALLGRAPH ? configFile.getDefaultCallGraphSettings() : configFile.getDefaultFlowGraphSettings();
    graphSettings.getProximitySettings().setProximityBrowsing(view.getGraph().nodeCount() >= graphSettings.getProximitySettings().getProximityBrowsingActivationThreshold());
    return new Pair<Map<String, String>, ZyGraphViewSettings>(new HashMap<String, String>(), graphSettings);
}
Also used : ZyGraphViewSettings(com.google.security.zynamics.binnavi.ZyGraph.ZyGraphViewSettings) ConfigManager(com.google.security.zynamics.binnavi.config.ConfigManager) Pair(com.google.security.zynamics.zylib.general.Pair)

Aggregations

ZyGraphViewSettings (com.google.security.zynamics.binnavi.ZyGraph.ZyGraphViewSettings)13 NaviNode (com.google.security.zynamics.binnavi.yfileswrap.zygraph.NaviNode)4 ZyGraph (com.google.security.zynamics.binnavi.yfileswrap.zygraph.ZyGraph)3 ZyGraph2DView (com.google.security.zynamics.zylib.yfileswrap.gui.zygraph.ZyGraph2DView)3 MockSqlProvider (com.google.security.zynamics.binnavi.Database.MockClasses.MockSqlProvider)2 CGraphSettingsDialog (com.google.security.zynamics.binnavi.Gui.GraphSettings.CGraphSettingsDialog)2 CDefaultModifier (com.google.security.zynamics.binnavi.ZyGraph.Builders.Modifiers.CDefaultModifier)2 CallGraphSettingsConfigItem (com.google.security.zynamics.binnavi.config.CallGraphSettingsConfigItem)2 DebuggerProvider (com.google.security.zynamics.binnavi.debug.debugger.DebuggerProvider)2 ModuleTargetSettings (com.google.security.zynamics.binnavi.debug.debugger.ModuleTargetSettings)2 NaviEdge (com.google.security.zynamics.binnavi.yfileswrap.zygraph.NaviEdge)2 CAddress (com.google.security.zynamics.zylib.disassembly.CAddress)2 Pair (com.google.security.zynamics.zylib.general.Pair)2 Edge (y.base.Edge)2 Node (y.base.Node)2 CDatabase (com.google.security.zynamics.binnavi.Database.CDatabase)1 MockDatabase (com.google.security.zynamics.binnavi.Database.MockClasses.MockDatabase)1 MockDebugger (com.google.security.zynamics.binnavi.Debug.Debugger.MockDebugger)1 CComment (com.google.security.zynamics.binnavi.Gui.GraphWindows.CommentDialogs.CComment)1 INodeModifier (com.google.security.zynamics.binnavi.ZyGraph.Builders.Modifiers.INodeModifier)1