⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.231
Server IP:
97.74.87.16
Server:
Linux 16.87.74.97.host.secureserver.net 5.14.0-503.38.1.el9_5.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Apr 18 08:52:10 EDT 2025 x86_64
Server Software:
Apache
PHP Version:
8.2.28
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
var
/
opt
/
nydus
/
ops
/
asn1crypto
/
__pycache__
/
View File Name :
parser.cpython-39.pyc
a ���g�# � @ s� d Z ddlmZmZmZmZ ddlZddlmZm Z m Z ddlmZm Z ejdkZdZd Zd d� Zdd d�Zdd� Zddd�Zdd� ZdS )z� Functions for parsing and dumping using the ASN.1 DER encoding. Exports the following items: - emit() - parse() - peek() Other type classes are defined that help compose the types listed above. � )�unicode_literals�division�absolute_import�print_functionN� )�byte_cls�chr_cls� type_name)�int_from_bytes�int_to_bytes)� z<Insufficient data - %s bytes requested but only %s available� c C s� t | t�stdt| � ��| dk s*| dkr6td| ��t |t�sPtdt|� ��|dk s`|dkrltd| ��t |t�s�tdt|� ��|dk r�td | ��t |t�s�td t|� ��t| |||�| S )a� Constructs a byte string of an ASN.1 DER-encoded value This is typically not useful. Instead, use one of the standard classes from asn1crypto.core, or construct a new class with specific fields, and call the .dump() method. :param class_: An integer ASN.1 class value: 0 (universal), 1 (application), 2 (context), 3 (private) :param method: An integer ASN.1 method value: 0 (primitive), 1 (constructed) :param tag: An integer ASN.1 tag value :param contents: A byte string of the encoded byte contents :return: A byte string of the ASN.1 DER value (header and contents) z!class_ must be an integer, not %sr r z*class_ must be one of 0, 1, 2 or 3, not %sz!method must be an integer, not %sr zmethod must be 0 or 1, not %sztag must be an integer, not %sz%tag must be greater than zero, not %s�&contents must be a byte string, not %s)� isinstance�int� TypeErrorr � ValueErrorr �_dump_header)�class_�method�tag�contents� r �B/opt/nydus/tmp/pip-target-mke_irhy/lib/python/asn1crypto/parser.py�emit s r Fc C sP t | t�stdt| � ��t| �}t| |�\}}|rL||krLtd|| ��|S )al Parses a byte string of ASN.1 BER/DER-encoded data. This is typically not useful. Instead, use one of the standard classes from asn1crypto.core, or construct a new class with specific fields, and call the .load() class method. :param contents: A byte string of BER/DER-encoded data :param strict: A boolean indicating if trailing data should be forbidden - if so, a ValueError will be raised when trailing data exists :raises: ValueError - when the contents do not contain an ASN.1 header or are truncated in some way TypeError - when contents is not a byte string :return: A 6-element tuple: - 0: integer class (0 to 3) - 1: integer method - 2: integer tag - 3: byte string header - 4: byte string content - 5: byte string trailer r z4Extra data - %d bytes of trailing data were provided)r r r r �len�_parser )r �strictZcontents_len�info�consumedr r r �parseK s r c C s0 t | t�stdt| � ��t| t| ��\}}|S )aW Parses a byte string of ASN.1 BER/DER-encoded data to find the length This is typically used to look into an encoded value to see how long the next chunk of ASN.1-encoded data is. Primarily it is useful when a value is a concatenation of multiple values. :param contents: A byte string of BER/DER-encoded data :raises: ValueError - when the contents do not contain an ASN.1 header or are truncated in some way TypeError - when contents is not a byte string :return: An integer with the number of bytes occupied by the ASN.1 value r )r r r r r r )r r r r r r �peekr s r! c C s~ |t krtd��|}||d k r4ttd|| f ��trDt| | �n| | }|d7 }|d@ }|d? d@ }|dk�rd}||d k r�ttd|| f ��tr�t| | �n| | } |d7 }| dkr�|dkr�td��|d9 }|| d@ 7 }| d ? dkrvq�qv|dk �rtd��||d k �r&ttd|| f ��t�r8t| | �n| | } |d7 }d }| d ? dk�rh|| d@ }n�| d@ } | �r�||| k �r�tt| || f ��|| 7 }|t| || |� dd� }n`|�s�td ��|}||d k �s�| ||d � dk�rt| ||d|d d�\}}�q�|d7 }d}||k�r@tt|| || f ��|�rN||fS |d? ||| ||� | ||t|� � |f|fS )a� Parses a byte string into component parts :param encoded_data: A byte string that contains BER-encoded data :param data_len: The integer length of the encoded data :param pointer: The index in the byte string to parse from :param lengths_only: A boolean to cause the call to return a 2-element tuple of the integer number of bytes in the header and the integer number of bytes in the contents. Internal use only. :param depth: The recursion depth when evaluating indefinite-length encoding. :return: A 2-element tuple: - 0: A tuple of (class_, method, tag, header, content, trailer) - 1: An integer indicating how many bytes were consumed z*Indefinite-length recursion limit exceededr � � r � zNon-minimal tag encoding� � � F)�signedz-Indefinite-length element must be constructed� s T)�lengths_only�depth� )� _MAX_DEPTHr �_INSUFFICIENT_DATA_MESSAGE�_PY2�ordr r r )Zencoded_data�data_len�pointerr* r+ �startZfirst_octetr Zconstructed�numZlength_octet�trailerZcontents_endZ length_octets�_r r r r � sp $ ��r c C s� d}d}|| d>