Did I find the right examples for you? yes no

All Samples(4)  |  Call(3)  |  Derive(0)  |  Import(1)

src/p/y/pystack-1.0.0/pystack/layers/tcp_session.py   pystack(Download)
 
from pystack.layers.layer import Layer
from pystack.kernel_filter import block_outgoing_packets, unblock_outgoing_packets
from pystack.layers.tcp_application import TCPApplication
import transversal_layer_access
 
            #starting from here remoteIP contains the destination IP not DN or whatever
            block_outgoing_packets('tcp', None, None, self.remoteIP, port)
            self.connectionID = (self.remoteIP, self.remotePort, self.localIP, self.localPort)  #Switch order because we are interested in receiving incoming packet so src dst is switch
            self.lowerLayers["default"].register_upper_layer(self.connectionID, self)
        self.newinstance = newinstance
        self.localPort = port
        block_outgoing_packets("tcp", self.localIP, self.localPort, None, None)
        self.connectionID = (self.localIP, self.localPort)
        self.lowerLayers['default'].register_upper_layer(self.connectionID, self)
            session.remotePort = packet.sport
 
            block_outgoing_packets('tcp', None, None, session.remoteIP, session.remotePort)
 
            connID = (session.remoteIP, session.remotePort, session.localIP, session.localPort)