Server IP : 15.235.198.142 / Your IP : 216.73.216.0 Web Server : Apache/2.4.58 (Ubuntu) System : Linux ballsack 6.8.0-45-generic #45-Ubuntu SMP PREEMPT_DYNAMIC Fri Aug 30 12:02:04 UTC 2024 x86_64 User : www-data ( 33) PHP Version : 8.3.6 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /lib/python3/dist-packages/twisted/web/test/__pycache__/ |
Upload File : |
� Ϫ�f� � � � d Z ddlZ e edd� � e eej d� � z Z e edd� � Z G d� d� Z G d� d � Z y) zF Helpers for URI and method injection tests. @see: U{CVE-2019-12387} � N� �ascii� c �( � e Zd ZdZd� Zd� Zd� Zd� Zy)�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} c � � 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�methods �C/usr/lib/python3/dist-packages/twisted/web/test/injectionhelpers.py�!attemptRequestWithMaliciousMethodz;MethodInjectionTestsMixin.attemptRequestWithMaliciousMethod s � � "�#�#� c �� � | j t � 5 }d}| j |� ddd� | j t j � d� y# 1 sw Y �/xY w)z� Issuing a request with a method that contains a carriage return and line feed fails with a L{ValueError}. s GET X-Injected-Header: valueN�^Invalid method)�assertRaises� ValueErrorr �assertRegex�str� exception)r �cmr s r �test_methodWithCLRFRejectedz5MethodInjectionTestsMixin.test_methodWithCLRFRejected( sX � � � � �z� *� ;�b�7�F��2�2�6�:� ;� ����R�\�\�*�,=�>� ;� ;�� �A�A!c � � t D ]f }dt |g� fz }| j t � 5 }| j |� ddd� | j t j � d� �h y# 1 sw Y �1xY w)z� Issuing a request with a method that contains unprintable ASCII characters fails with a L{ValueError}. � GET%sNr )�UNPRINTABLE_ASCII� bytearrayr r r r r r �r �cr r s r �'test_methodWithUnprintableASCIIRejectedzAMethodInjectionTestsMixin.test_methodWithUnprintableASCIIRejected2 su � � #� C�A���A�3�� 1�1�F��"�"�:�.� ?�"��6�6�v�>� ?����S����.�0A�B� C� ?� ?�� �A1�1A: c � � t D ]f }dt |g� fz }| j t � 5 }| j |� ddd� | j t j � d� �h y# 1 sw Y �1xY w)zx Issuing a request with a method that contains non-ASCII characters fails with a L{ValueError}. r Nr )�NONASCIIr r r r r r r r s r �test_methodWithNonASCIIRejectedz9MethodInjectionTestsMixin.test_methodWithNonASCIIRejected= su � � � C�A���A�3�� 1�1�F��"�"�:�.� ?�"��6�6�v�>� ?����S����.�0A�B� C� ?� ?�r"