Python socket.SO_OOBINLINE Examples

The following are 8 code examples of socket.SO_OOBINLINE(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module socket , or try the search function .
Example #1
Source File: ftpserver.py    From script-languages with MIT License 6 votes vote down vote up
def handle_expt(self):
        """Called when there is out of band (OOB) data to be read.
        This might happen in case of such clients strictly following
        the RFC-959 directives of sending Telnet IP and Synch as OOB
        data before issuing ABOR, STAT and QUIT commands.
        It should never be called since the SO_OOBINLINE option is
        enabled except on some systems like FreeBSD where it doesn't
        seem to have effect.
        """
        if hasattr(socket, 'MSG_OOB'):
            try:
                data = self.socket.recv(1024, socket.MSG_OOB)
            except socket.error, err:
                if err.args[0] == errno.EINVAL:
                    return
            else:
                self._in_buffer.append(data)
                return 
Example #2
Source File: test_socket.py    From CTFCrackTools-V2 with GNU General Public License v3.0 6 votes vote down vote up
def testSO_KEEPALIVE(self):
        self.test_tcp_client = 1
        self.test_tcp_server = 1
        self._testOption(socket.SOL_SOCKET, socket.SO_KEEPALIVE, [0, 1])
        self._testInheritedOption(socket.SOL_SOCKET, socket.SO_KEEPALIVE, [0, 1])

    # def testSO_LINGER(self):
    #     self.test_tcp_client = 1
    #     self.test_tcp_server = 1
    #     off = struct.pack('ii', 0, 0)
    #     on_2_seconds = struct.pack('ii', 1, 2)
    #     self._testOption(socket.SOL_SOCKET, socket.SO_LINGER, [off, on_2_seconds])
    #     self._testInheritedOption(socket.SOL_SOCKET, socket.SO_LINGER, [off, on_2_seconds])

    # # WILL NOT FIX
    # def testSO_OOBINLINE(self):
    #     self.test_tcp_client = 1
    #     self.test_tcp_server = 1
    #     self._testOption(socket.SOL_SOCKET, socket.SO_OOBINLINE, [0, 1])
    #     self._testInheritedOption(socket.SOL_SOCKET, socket.SO_OOBINLINE, [0, 1]) 
Example #3
Source File: test_socket.py    From CTFCrackTools with GNU General Public License v3.0 6 votes vote down vote up
def testSO_KEEPALIVE(self):
        self.test_tcp_client = 1
        self.test_tcp_server = 1
        self._testOption(socket.SOL_SOCKET, socket.SO_KEEPALIVE, [0, 1])
        self._testInheritedOption(socket.SOL_SOCKET, socket.SO_KEEPALIVE, [0, 1])

    # def testSO_LINGER(self):
    #     self.test_tcp_client = 1
    #     self.test_tcp_server = 1
    #     off = struct.pack('ii', 0, 0)
    #     on_2_seconds = struct.pack('ii', 1, 2)
    #     self._testOption(socket.SOL_SOCKET, socket.SO_LINGER, [off, on_2_seconds])
    #     self._testInheritedOption(socket.SOL_SOCKET, socket.SO_LINGER, [off, on_2_seconds])

    # # WILL NOT FIX
    # def testSO_OOBINLINE(self):
    #     self.test_tcp_client = 1
    #     self.test_tcp_server = 1
    #     self._testOption(socket.SOL_SOCKET, socket.SO_OOBINLINE, [0, 1])
    #     self._testInheritedOption(socket.SOL_SOCKET, socket.SO_OOBINLINE, [0, 1]) 
Example #4
Source File: test_ftplib.py    From Fluid-Designer with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, conn):
        asynchat.async_chat.__init__(self, conn)
        # tells the socket to handle urgent data inline (ABOR command)
        self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_OOBINLINE, 1)
        self.set_terminator(b"\r\n")
        self.in_buffer = []
        self.dtp = None
        self.last_received_cmd = None
        self.last_received_data = ''
        self.next_response = ''
        self.next_data = None
        self.rest = None
        self.next_retr_data = RETR_DATA
        self.push('220 welcome') 
Example #5
Source File: test_ftplib.py    From ironpython3 with Apache License 2.0 5 votes vote down vote up
def __init__(self, conn):
        asynchat.async_chat.__init__(self, conn)
        # tells the socket to handle urgent data inline (ABOR command)
        self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_OOBINLINE, 1)
        self.set_terminator(b"\r\n")
        self.in_buffer = []
        self.dtp = None
        self.last_received_cmd = None
        self.last_received_data = ''
        self.next_response = ''
        self.next_data = None
        self.rest = None
        self.next_retr_data = RETR_DATA
        self.push('220 welcome') 
Example #6
Source File: test_ftplib.py    From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, conn):
        asynchat.async_chat.__init__(self, conn)
        # tells the socket to handle urgent data inline (ABOR command)
        self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_OOBINLINE, 1)
        self.set_terminator(b"\r\n")
        self.in_buffer = []
        self.dtp = None
        self.last_received_cmd = None
        self.last_received_data = ''
        self.next_response = ''
        self.next_data = None
        self.rest = None
        self.next_retr_data = RETR_DATA
        self.push('220 welcome') 
Example #7
Source File: test_socket.py    From medicare-demo with Apache License 2.0 5 votes vote down vote up
def testSO_OOBINLINE(self):
        self.test_tcp_client = 1
        self._testOption(socket.SOL_SOCKET, socket.SO_OOBINLINE, [0, 1]) 
Example #8
Source File: test_ftplib.py    From android_universal with MIT License 5 votes vote down vote up
def __init__(self, conn):
        asynchat.async_chat.__init__(self, conn)
        # tells the socket to handle urgent data inline (ABOR command)
        self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_OOBINLINE, 1)
        self.set_terminator(b"\r\n")
        self.in_buffer = []
        self.dtp = None
        self.last_received_cmd = None
        self.last_received_data = ''
        self.next_response = ''
        self.next_data = None
        self.rest = None
        self.next_retr_data = RETR_DATA
        self.push('220 welcome')