!C99Shell v. 2.5 [PHP 8 Update] [24.05.2025]!

Software: Apache/2.4.41 (Ubuntu). PHP/8.0.30 

uname -a: Linux apirnd 5.4.0-204-generic #224-Ubuntu SMP Thu Dec 5 13:38:28 UTC 2024 x86_64 

uid=33(www-data) gid=33(www-data) groups=33(www-data) 

Safe-mode: OFF (not secure)

/usr/lib/python3/dist-packages/twisted/protocols/haproxy/test/   drwxr-xr-x
Free 13.12 GB of 57.97 GB (22.63%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Self remove    Logout    


Viewing file:     test_v1parser.py (4.58 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.

"""
Test cases for L{twisted.protocols.haproxy.V1Parser}.
"""

from twisted.trial import unittest
from twisted.internet import address

from .._exceptions import (
    InvalidProxyHeader, InvalidNetworkProtocol, MissingAddressData
)
from .. import _v1parser


class V1ParserTests(unittest.TestCase):
    """
    Test L{twisted.protocols.haproxy.V1Parser} behaviour.
    """

    def test_missingPROXYHeaderValue(self):
        """
        Test that an exception is raised when the PROXY header is missing.
        """
        self.assertRaises(
            InvalidProxyHeader,
            _v1parser.V1Parser.parse,
            b'NOTPROXY ',
        )


    def test_invalidNetworkProtocol(self):
        """
        Test that an exception is raised when the proto is not TCP or UNKNOWN.
        """
        self.assertRaises(
            InvalidNetworkProtocol,
            _v1parser.V1Parser.parse,
            b'PROXY WUTPROTO ',
        )


    def test_missingSourceData(self):
        """
        Test that an exception is raised when the proto has no source data.
        """
        self.assertRaises(
            MissingAddressData,
            _v1parser.V1Parser.parse,
            b'PROXY TCP4 ',
        )


    def test_missingDestData(self):
        """
        Test that an exception is raised when the proto has no destination.
        """
        self.assertRaises(
            MissingAddressData,
            _v1parser.V1Parser.parse,
            b'PROXY TCP4 127.0.0.1 8080 8888',
        )


    def test_fullParsingSuccess(self):
        """
        Test that parsing is successful for a PROXY header.
        """
        info = _v1parser.V1Parser.parse(
            b'PROXY TCP4 127.0.0.1 127.0.0.1 8080 8888',
        )
        self.assertIsInstance(info.source, address.IPv4Address)
        self.assertEqual(info.source.host, b'127.0.0.1')
        self.assertEqual(info.source.port, 8080)
        self.assertEqual(info.destination.host, b'127.0.0.1')
        self.assertEqual(info.destination.port, 8888)


    def test_fullParsingSuccess_IPv6(self):
        """
        Test that parsing is successful for an IPv6 PROXY header.
        """
        info = _v1parser.V1Parser.parse(
            b'PROXY TCP6 ::1 ::1 8080 8888',
        )
        self.assertIsInstance(info.source, address.IPv6Address)
        self.assertEqual(info.source.host, b'::1')
        self.assertEqual(info.source.port, 8080)
        self.assertEqual(info.destination.host, b'::1')
        self.assertEqual(info.destination.port, 8888)


    def test_fullParsingSuccess_UNKNOWN(self):
        """
        Test that parsing is successful for a UNKNOWN PROXY header.
        """
        info = _v1parser.V1Parser.parse(
            b'PROXY UNKNOWN anything could go here',
        )
        self.assertIsNone(info.source)
        self.assertIsNone(info.destination)


    def test_feedParsing(self):
        """
        Test that parsing happens when fed a complete line.
        """
        parser = _v1parser.V1Parser()
        info, remaining = parser.feed(b'PROXY TCP4 127.0.0.1 127.0.0.1 ')
        self.assertFalse(info)
        self.assertFalse(remaining)
        info, remaining = parser.feed(b'8080 8888')
        self.assertFalse(info)
        self.assertFalse(remaining)
        info, remaining = parser.feed(b'\r\n')
        self.assertFalse(remaining)
        self.assertIsInstance(info.source, address.IPv4Address)
        self.assertEqual(info.source.host, b'127.0.0.1')
        self.assertEqual(info.source.port, 8080)
        self.assertEqual(info.destination.host, b'127.0.0.1')
        self.assertEqual(info.destination.port, 8888)


    def test_feedParsingTooLong(self):
        """
        Test that parsing fails if no newline is found in 108 bytes.
        """
        parser = _v1parser.V1Parser()
        info, remaining = parser.feed(b'PROXY TCP4 127.0.0.1 127.0.0.1 ')
        self.assertFalse(info)
        self.assertFalse(remaining)
        info, remaining = parser.feed(b'8080 8888')
        self.assertFalse(info)
        self.assertFalse(remaining)
        self.assertRaises(
            InvalidProxyHeader,
            parser.feed,
            b' ' * 100,
        )


    def test_feedParsingOverflow(self):
        """
        Test that parsing leaves overflow bytes in the buffer.
        """
        parser = _v1parser.V1Parser()
        info, remaining = parser.feed(
            b'PROXY TCP4 127.0.0.1 127.0.0.1 8080 8888\r\nHTTP/1.1 GET /\r\n',
        )
        self.assertTrue(info)
        self.assertEqual(remaining, b'HTTP/1.1 GET /\r\n')
        self.assertFalse(parser.buffer)

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ Read-Only ]

:: Make Dir ::
 
[ Read-Only ]
:: Make File ::
 
[ Read-Only ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0101 ]--