Search in sources :

Example 16 with Edge

use of y.base.Edge in project binnavi by google.

the class ZyGraphBuilder method convertEdges.

/**
   * Converts the edges of a view into Graph2D edges.
   *
   * @param edges The edges to convert.
   * @param graph2D The graph where the edges are inserted.
   * @param rawNodeToNodeMap Keeps track of view node => graph node mappings.
   * @param adjustColors
   */
private void convertEdges(final Collection<INaviEdge> edges, final Graph2D graph2D, final Map<INaviViewNode, Node> rawNodeToNodeMap, final boolean adjustColors) {
    for (final INaviEdge edge : edges) {
        // Get the nodes connected by the edge
        final NaviNode sourceNode = m_ynodeToNodeMap.get(rawNodeToNodeMap.get(edge.getSource()));
        final NaviNode targetNode = m_ynodeToNodeMap.get(rawNodeToNodeMap.get(edge.getTarget()));
        final Pair<Edge, NaviEdge> result = ZyEdgeBuilder.convertEdge(edge, sourceNode, targetNode, graph2D, adjustColors);
        m_yedgeToEdgeMap.put(result.first(), result.second());
    }
}
Also used : NaviNode(com.google.security.zynamics.binnavi.yfileswrap.zygraph.NaviNode) INaviEdge(com.google.security.zynamics.binnavi.disassembly.INaviEdge) NaviEdge(com.google.security.zynamics.binnavi.yfileswrap.zygraph.NaviEdge) Edge(y.base.Edge) INaviEdge(com.google.security.zynamics.binnavi.disassembly.INaviEdge) NaviEdge(com.google.security.zynamics.binnavi.yfileswrap.zygraph.NaviEdge) INaviEdge(com.google.security.zynamics.binnavi.disassembly.INaviEdge)

Example 17 with Edge

use of y.base.Edge in project binnavi by google.

the class CReilInstructionGraph method createInstructionEdge.

/**
   * Creates an instruction graph edge between the source node and the destination node and returns
   * the resulting yfiles edge.
   * 
   * @param sourceNode The source node of the edge to be created.
   * @param destinationNode The destination node of the edge to be created.
   * @param isTrueEdge Boolean parameter to determine if the edge is a conditional true edge.
   * 
   * @return The yfiles edge which has been created and inserted in the graph.
   */
private Edge createInstructionEdge(final Node sourceNode, final Node destinationNode, final boolean isTrueEdge) {
    final ReilInstruction reilInstruction = m_nodesMap.get(destinationNode).getReilInstruction();
    boolean isExitEdge = false;
    if (reilInstruction != null) {
        final IAddress reilInstructionAddress = reilInstruction.getAddress();
        if ((reilInstructionAddress.toLong() & 0xFF) == 0) {
            isExitEdge = true;
        }
    }
    final Edge edge = m_internalGraph.createEdge(sourceNode, destinationNode);
    m_edgesMap.put(edge, new ReilInstructionGraphEdge(isTrueEdge, isExitEdge));
    return edge;
}
Also used : ReilInstruction(com.google.security.zynamics.reil.ReilInstruction) ReilInstructionGraphEdge(com.google.security.zynamics.reil.algorithms.mono2.common.instructiongraph.ReilInstructionGraphEdge) IInstructionGraphEdge(com.google.security.zynamics.reil.algorithms.mono2.common.instructiongraph.interfaces.IInstructionGraphEdge) Edge(y.base.Edge) ReilEdge(com.google.security.zynamics.reil.ReilEdge) ReilInstructionGraphEdge(com.google.security.zynamics.reil.algorithms.mono2.common.instructiongraph.ReilInstructionGraphEdge) IAddress(com.google.security.zynamics.zylib.disassembly.IAddress)

Example 18 with Edge

use of y.base.Edge in project binnavi by google.

the class CReilInstructionGraph method getOutgoingEdgesForAddress.

/**
   * Convenience method to obtain the edge in the ReilInstructionGraph that corresponds to LEAVING a
   * particular native instruction
   * 
   * @param nativeInstructionAddress The address of the native instruction
   * 
   * @return The edge corresponding to entering the native instruction
   */
public Iterable<IInstructionGraphEdge> getOutgoingEdgesForAddress(final IAddress nativeInstructionAddress) {
    final ArrayList<IInstructionGraphEdge> result = new ArrayList<IInstructionGraphEdge>();
    final EdgeCursor edgeCursor = m_internalGraph.edges();
    while (edgeCursor.ok()) {
        final Edge edge = (Edge) edgeCursor.current();
        final long sourceAddress = m_nodesMap.get(edge.source()).getReilInstruction().getAddress().toLong();
        final long targetAddress = m_nodesMap.get(edge.target()).getReilInstruction().getAddress().toLong();
        if (((targetAddress & 0xFF) == 0) && ((sourceAddress >> 8) == nativeInstructionAddress.toLong())) {
            result.add(m_edgesMap.get(edge));
        }
        edgeCursor.next();
    }
    return result;
}
Also used : IInstructionGraphEdge(com.google.security.zynamics.reil.algorithms.mono2.common.instructiongraph.interfaces.IInstructionGraphEdge) EdgeCursor(y.base.EdgeCursor) ArrayList(java.util.ArrayList) IInstructionGraphEdge(com.google.security.zynamics.reil.algorithms.mono2.common.instructiongraph.interfaces.IInstructionGraphEdge) Edge(y.base.Edge) ReilEdge(com.google.security.zynamics.reil.ReilEdge) ReilInstructionGraphEdge(com.google.security.zynamics.reil.algorithms.mono2.common.instructiongraph.ReilInstructionGraphEdge)

Aggregations

Edge (y.base.Edge)18 Node (y.base.Node)7 EdgeCursor (y.base.EdgeCursor)6 NaviEdge (com.google.security.zynamics.binnavi.yfileswrap.zygraph.NaviEdge)5 INaviEdge (com.google.security.zynamics.binnavi.disassembly.INaviEdge)4 NaviNode (com.google.security.zynamics.binnavi.yfileswrap.zygraph.NaviNode)4 ZyLabelContent (com.google.security.zynamics.zylib.gui.zygraph.realizers.ZyLabelContent)4 ZyEdgeRealizer (com.google.security.zynamics.zylib.yfileswrap.gui.zygraph.realizers.ZyEdgeRealizer)4 ZyGraph (com.google.security.zynamics.binnavi.yfileswrap.zygraph.ZyGraph)3 CAddress (com.google.security.zynamics.zylib.disassembly.CAddress)3 CStateChange (com.google.security.zynamics.zylib.gui.zygraph.editmode.CStateChange)3 ZyGraph2DView (com.google.security.zynamics.zylib.yfileswrap.gui.zygraph.ZyGraph2DView)3 ArrayList (java.util.ArrayList)3 HitInfo (y.view.HitInfo)3 MockDatabase (com.google.security.zynamics.binnavi.Database.MockClasses.MockDatabase)2 MockSqlProvider (com.google.security.zynamics.binnavi.Database.MockClasses.MockSqlProvider)2 ZyGraphViewSettings (com.google.security.zynamics.binnavi.ZyGraph.ZyGraphViewSettings)2 CallGraphSettingsConfigItem (com.google.security.zynamics.binnavi.config.CallGraphSettingsConfigItem)2 CModule (com.google.security.zynamics.binnavi.disassembly.Modules.CModule)2 ReilEdge (com.google.security.zynamics.reil.ReilEdge)2