Search in sources :

Example 16 with ZyGraph

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

the class CPanelCloser method closeModifiedGraph.

/**
   * Closes a modified graph.
   *
   * @param parent The parent window of the panel.
   * @param panel The panel to be closed.
   *
   * @return True, if the panel can be closed. False, if the user vetoed the operation.
   */
private static boolean closeModifiedGraph(final JFrame parent, final IGraphPanel panel) {
    final ZyGraph graph = panel.getModel().getGraph();
    final int result = CMessageBox.showYesNoCancelQuestion(parent, String.format("Do you want to save the view '%s' before closing?", CNameShortener.shorten(graph.getRawView())));
    if (result == JOptionPane.YES_OPTION) {
        if (graph.getRawView().getType() == ViewType.Native) {
            saveNativeGraph(parent, panel);
        } else {
            saveNonNativeGraph(parent, graph);
        }
    }
    return (result == JOptionPane.YES_OPTION) || (result == JOptionPane.NO_OPTION);
}
Also used : ZyGraph(com.google.security.zynamics.binnavi.yfileswrap.zygraph.ZyGraph)

Example 17 with ZyGraph

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

the class CTaggedGraphNodeNodeTest method test2getGraphNode.

@Test
public void test2getGraphNode() throws FileReadException, CouldntLoadDataException, LoadCancelledException, CouldntSaveDataException {
    final ZyGraph graph = ZyGraphFactory.generateTestGraph();
    final CCodeNode node = graph.getRawView().getBasicBlocks().get(0);
    final NaviNode naviNode = graph.getNode(node);
    final CTaggedGraphNodeNode taggedNode = new CTaggedGraphNodeNode(graph, naviNode);
    assertEquals(naviNode, taggedNode.getGraphNode());
}
Also used : ZyGraph(com.google.security.zynamics.binnavi.yfileswrap.zygraph.ZyGraph) CCodeNode(com.google.security.zynamics.binnavi.disassembly.CCodeNode) NaviNode(com.google.security.zynamics.binnavi.yfileswrap.zygraph.NaviNode) Test(org.junit.Test)

Example 18 with ZyGraph

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

the class CTaggedGraphNodesContainerNodeTest method test1Simple.

@Test
public void test1Simple() throws FileReadException, CouldntLoadDataException, LoadCancelledException, CouldntSaveDataException {
    final ZyGraph graph = ZyGraphFactory.generateTestGraph();
    final CTagsTreeModel model = new CTagsTreeModel(null);
    final CTag tag = new CTag(0, "tag", "description", TagType.NODE_TAG, new MockSqlProvider());
    final TreeNode<CTag> treeNode = new TreeNode<CTag>(tag);
    final CTaggedGraphNodesContainerNode containerNode = new CTaggedGraphNodesContainerNode(graph, model, treeNode);
    assertEquals("Tagged Nodes (0/0/1/1)", containerNode.toString());
    assertEquals(null, containerNode.getIconName());
    containerNode.getIcon();
}
Also used : ZyGraph(com.google.security.zynamics.binnavi.yfileswrap.zygraph.ZyGraph) MockSqlProvider(com.google.security.zynamics.binnavi.Database.MockClasses.MockSqlProvider) TreeNode(com.google.security.zynamics.zylib.types.trees.TreeNode) CTag(com.google.security.zynamics.binnavi.Tagging.CTag) CTagsTreeModel(com.google.security.zynamics.binnavi.Gui.GraphWindows.NodeTaggingTree.CTagsTreeModel) Test(org.junit.Test)

Example 19 with ZyGraph

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

the class CBreakpointTableTest method testAddedDebugger.

/**
   * This test is making sure that listeners are correctly attached to new debuggers.
   *
   * @throws CouldntSaveDataException
   * @throws FileReadException
   */
@Test
public void testAddedDebugger() throws CouldntSaveDataException, FileReadException {
    ConfigManager.instance().read();
    final INaviModule mockModule = new MockModule();
    final DebugTargetSettings target = new ModuleTargetSettings(mockModule);
    final DebuggerProvider debuggerProvider = new DebuggerProvider(target);
    final ZyGraphViewSettings settings = new ZyGraphViewSettings(new FlowGraphSettingsConfigItem());
    settings.getLayoutSettings().setDefaultGraphLayout(LayoutStyle.CIRCULAR);
    final ZyGraph graph = new ZyGraph(new MockView(), new LinkedHashMap<Node, NaviNode>(), new LinkedHashMap<Edge, NaviEdge>(), settings, new ZyGraph2DView());
    final IViewContainer viewContainer = new MockViewContainer();
    final CBreakpointTable table = new CBreakpointTable(debuggerProvider, graph, viewContainer);
    final MockDebugger debugger = new MockDebugger(new ModuleTargetSettings(mockModule));
    final MockModule module = new MockModule();
    debugger.getBreakpointManager().addBreakpoints(BreakpointType.REGULAR, Sets.newHashSet(new BreakpointAddress(module, new UnrelocatedAddress(new CAddress(0)))));
    debuggerProvider.addDebugger(debugger);
    table.dispose();
}
Also used : FlowGraphSettingsConfigItem(com.google.security.zynamics.binnavi.config.FlowGraphSettingsConfigItem) IViewContainer(com.google.security.zynamics.binnavi.disassembly.views.IViewContainer) MockViewContainer(com.google.security.zynamics.binnavi.disassembly.MockViewContainer) ZyGraphViewSettings(com.google.security.zynamics.binnavi.ZyGraph.ZyGraphViewSettings) MockView(com.google.security.zynamics.binnavi.disassembly.MockView) ZyGraph(com.google.security.zynamics.binnavi.yfileswrap.zygraph.ZyGraph) Node(y.base.Node) NaviNode(com.google.security.zynamics.binnavi.yfileswrap.zygraph.NaviNode) NaviNode(com.google.security.zynamics.binnavi.yfileswrap.zygraph.NaviNode) DebugTargetSettings(com.google.security.zynamics.binnavi.debug.debugger.DebugTargetSettings) ModuleTargetSettings(com.google.security.zynamics.binnavi.debug.debugger.ModuleTargetSettings) CAddress(com.google.security.zynamics.zylib.disassembly.CAddress) MockDebugger(com.google.security.zynamics.binnavi.Debug.Debugger.MockDebugger) INaviModule(com.google.security.zynamics.binnavi.disassembly.INaviModule) MockModule(com.google.security.zynamics.binnavi.disassembly.Modules.MockModule) DebuggerProvider(com.google.security.zynamics.binnavi.debug.debugger.DebuggerProvider) UnrelocatedAddress(com.google.security.zynamics.binnavi.disassembly.UnrelocatedAddress) ZyGraph2DView(com.google.security.zynamics.zylib.yfileswrap.gui.zygraph.ZyGraph2DView) BreakpointAddress(com.google.security.zynamics.binnavi.debug.models.breakpoints.BreakpointAddress) NaviEdge(com.google.security.zynamics.binnavi.yfileswrap.zygraph.NaviEdge) Edge(y.base.Edge) NaviEdge(com.google.security.zynamics.binnavi.yfileswrap.zygraph.NaviEdge) Test(org.junit.Test)

Example 20 with ZyGraph

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

the class SetupCriteriaGraphTest method setUp.

public void setUp() throws CouldntLoadDataException, LoadCancelledException, FileReadException, CouldntSaveDataException {
    final ZyGraph graph = ZyGraphFactory.generateTestGraph();
    final CCriteriaFactory criteriaFactory = new CCriteriaFactory(graph, null, null);
    final List<ICriteriumCreator> criteria = criteriaFactory.getConditions();
    final CCriteriumTree m_ctree = new CCriteriumTree();
    final JCriteriumTree jtree = new JCriteriumTree(m_ctree, criteria);
    jtree.getModel().setRoot(new JCriteriumTreeNode(m_ctree, m_ctree.getRoot().getCriterium(), criteria));
    final CCriteriumTreeNode parent = new CCriteriumTreeNode(null);
    final CCriteriumTreeNode child = new CCriteriumTreeNode(null);
    m_ctree.appendNode(parent, child);
}
Also used : JCriteriumTree(com.google.security.zynamics.binnavi.Gui.CriteriaDialog.ExpressionTree.JCriteriumTree) ZyGraph(com.google.security.zynamics.binnavi.yfileswrap.zygraph.ZyGraph) JCriteriumTreeNode(com.google.security.zynamics.binnavi.Gui.CriteriaDialog.ExpressionTree.JCriteriumTreeNode) CCriteriumTree(com.google.security.zynamics.binnavi.Gui.CriteriaDialog.ExpressionModel.CCriteriumTree) CCriteriumTreeNode(com.google.security.zynamics.binnavi.Gui.CriteriaDialog.ExpressionModel.CCriteriumTreeNode) ICriteriumCreator(com.google.security.zynamics.binnavi.Gui.CriteriaDialog.Conditions.ICriteriumCreator)

Aggregations

ZyGraph (com.google.security.zynamics.binnavi.yfileswrap.zygraph.ZyGraph)23 NaviNode (com.google.security.zynamics.binnavi.yfileswrap.zygraph.NaviNode)9 Test (org.junit.Test)9 CModuleContainer (com.google.security.zynamics.binnavi.disassembly.Modules.CModuleContainer)5 CCodeNode (com.google.security.zynamics.binnavi.disassembly.CCodeNode)4 INaviInstruction (com.google.security.zynamics.binnavi.disassembly.INaviInstruction)4 INaviModule (com.google.security.zynamics.binnavi.disassembly.INaviModule)4 MockSqlProvider (com.google.security.zynamics.binnavi.Database.MockClasses.MockSqlProvider)3 ZyGraphViewSettings (com.google.security.zynamics.binnavi.ZyGraph.ZyGraphViewSettings)3 INaviCodeNode (com.google.security.zynamics.binnavi.disassembly.INaviCodeNode)3 INaviFunction (com.google.security.zynamics.binnavi.disassembly.INaviFunction)3 INaviViewNode (com.google.security.zynamics.binnavi.disassembly.INaviViewNode)3 INaviView (com.google.security.zynamics.binnavi.disassembly.views.INaviView)3 ZyGraph2DView (com.google.security.zynamics.zylib.yfileswrap.gui.zygraph.ZyGraph2DView)3 MockDatabase (com.google.security.zynamics.binnavi.Database.MockClasses.MockDatabase)2 MockDebuggerProvider (com.google.security.zynamics.binnavi.Debug.Debugger.MockDebuggerProvider)2 CGraphWindow (com.google.security.zynamics.binnavi.Gui.GraphWindows.CGraphWindow)2 CComment (com.google.security.zynamics.binnavi.Gui.GraphWindows.CommentDialogs.CComment)2 CTag (com.google.security.zynamics.binnavi.Tagging.CTag)2 CCodeNodeUpdater (com.google.security.zynamics.binnavi.ZyGraph.Updaters.CodeNodes.CCodeNodeUpdater)2