Did I find the right examples for you? yes no

All Samples(6)  |  Call(5)  |  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
 
            #We have not received syn/ack so rollback connection
            unblock_outgoing_packets('tcp', None, None, self.remoteIP, port)
            self.lowerLayers["default"].unregister_upper_layer(self.connectionID)
            return False #No connection can occur if port is not open, arp request failed..
                    session._send_FIN()
                    session.switch_state(State_FIN_WAIT_1(session))
            unblock_outgoing_packets('tcp', self.localIP, self.localPort, None, None)
            self.unregister_upper_layer(self.connectionID)
            self._unregister_app_layer(self.connectionID)
            self.session.switch_state(State_TIME_WAIT(self.session))#??
            #Directly remove the session do not switch to closed
            unblock_outgoing_packets('tcp', None, None, self.session.remoteIP, self.session.remotePort)
            self.session.unregister_upper_layer(self.session.connectionID)
            self.session._unregister_app_layer(self.session.connectionID)
    def packet_received(self, packet, **kwargs):
        if packet.flags == FIN:
            self.session.switch_state(State_TIME_WAIT(self.session)) #??
            #Directly remove the session do not switch to closed
            unblock_outgoing_packets('tcp', None, None, self.remoteIP, self.remotePort)