403Webshell
Server IP : 192.158.238.246  /  Your IP : 3.145.38.251
Web Server : LiteSpeed
System : Linux uniform.iwebfusion.net 4.18.0-553.27.1.lve.1.el8.x86_64 #1 SMP Wed Nov 20 15:58:00 UTC 2024 x86_64
User : jenniferflocom ( 1321)
PHP Version : 8.1.32
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /opt/alt/python37/lib/python3.7/site-packages/asn1crypto/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /opt/alt/python37/lib/python3.7/site-packages/asn1crypto/__pycache__/util.cpython-37.pyc
B

�ґX{F�
@sXdZddlmZmZmZmZddlZddlZddlmZm	Z	m
Z
ddlmZddl
mZmZddlmZdd	lmZejd
kr�ddlmZmZnddlmZmZejdkr�dd
lmZmZdZd#dd�Zd$dd�ZGdd�de�ZGdd�d�Z n$ddlm Z dZd%dd�Zd&dd�Zddddddddddddd�Z!Gdd �d e"�Z#Gd!d"�d"e"�Z$dS)'a
Miscellaneous data helpers, including functions for converting integers to and
from bytes and UTC timezone. Exports the following items:

 - OrderedDict()
 - int_from_bytes()
 - int_to_bytes()
 - timezone.utc
 - inet_ntop()
 - inet_pton()
 - uri_to_iri()
 - iri_to_uri()
�)�unicode_literals�division�absolute_import�print_functionN)�datetime�date�time�)�unwrap)�
iri_to_uri�
uri_to_iri)�OrderedDict)�	type_name�win32)�	inet_ntop�	inet_pton)�)�	timedelta�tzinfoTFcCs�d}|rJ|dkrJd}tt�tdt|��d�d�}|d|>d|>}d|}t|�d@rfd|}|�d	�}|r�|s�t|dd��d
@r�d|}|dk	r�|r�d
}nd}||t|�|}n$|r�t|dd��d
@dkr�d
|}|S)au
        Converts an integer to a byte string

        :param value:
            The integer to convert

        :param signed:
            If the byte string should be encoded using two's complement

        :param width:
            None == auto, otherwise an integer of the byte width for the return
            value

        :return:
            A byte string
        FrTz%xg@�r	�0�hex��N��)�int�math�ceil�len�abs�decode�ord)�value�signed�widthZis_neg�bitsZhex_str�outputZpad_char�r'�@/opt/alt/python37/lib/python3.7/site-packages/asn1crypto/util.py�int_to_bytes)s&"
r)cCsT|dkrdSt|�d�d�}|s$|St|dd��d@rPt|�d}|d|>S|S)a
        Converts a byte string to an integer

        :param value:
            The byte string to convert

        :param signed:
            If the byte string should be interpreted using two's complement

        :return:
            An integer
        �rr�r	rr)�long�encoder!r)r"r#�numZbit_lenr'r'r(�int_from_bytesVsr/c@s$eZdZdd�Zdd�Zdd�ZdS)�utccCsdS)Ns	UTC+00:00r')�self�_r'r'r(�tznameusz
utc.tznamecCstd�S)Nr)r)r1r2r'r'r(�	utcoffsetxsz
utc.utcoffsetcCstd�S)Nr)r)r1r2r'r'r(�dst{szutc.dstN)�__name__�
__module__�__qualname__r3r4r5r'r'r'r(r0ssr0c@seZdZe�ZdS)�timezoneN)r6r7r8r0r'r'r'r(r9~sr9)r9cCsn|dkr^|rD|dkr&t|d���}n|��}|ddkrL|d7}n|��}t�|d�p\d}|j|d|d�S)au
        Converts an integer to a byte string

        :param value:
            The integer to convert

        :param signed:
            If the byte string should be encoded using two's complement

        :param width:
            None == auto, otherwise an integer of the byte width for the return
            value

        :return:
            A byte string
        Nrr	r�big)�	byteorderr#)r�
bit_lengthrr�to_bytes)r"r#r$Z
bits_requiredr'r'r(r)�s
cCstj|d|d�S)a
        Converts a byte string to an integer

        :param value:
            The byte string to convert

        :param signed:
            If the byte string should be interpreted using two's complement

        :return:
            An integer
        r:)r#)r�
from_bytes)r"r#r'r'r(r/�s���)r	�r����r�	�
��c@s�eZdZdZdZdZdZdd�Zdd�Zdd�Z	d	d
�Z
d#dd�Zd
d�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd �Zd!d"�ZdS)$�
extended_datez�
    A datetime.date-like object that can represent the year 0. This is just
    to handle 0000-01-01 found in some certificates.
    NcCsZ|dkrtd��|dks |dkr(td��|dks<|t|krDtd��||_||_||_dS)z�
        :param year:
            The integer 0

        :param month:
            An integer from 1 to 12

        :param day:
            An integer from 1 to 31
        rzyear must be 0r	rJzmonth is out of rangezday is out of rangeN)�
ValueError�_DAYS_PER_MONTH_YEAR_0�year�month�day)r1rNrOrPr'r'r(�__init__�szextended_date.__init__cCs�|�dd�}td|j|j�}d|krR|�d�}|�dd�}|�dd�}|�d|�}d|kr�|�d�}|�dd�}|�dd�}|�d|�}|�|�S)	z�
        Performs strftime(), always returning a unicode string

        :param format:
            A strftime() format string

        :return:
            A unicode string of the formatted date
        z%Y�0000i�z%c�2000�%z%%z%x)�replacerrOrP�strftime)r1�format�temp�c_out�x_outr'r'r(�_format�s

zextended_date._formatcCs
|�d�S)z�
        Formats the date as %Y-%m-%d

        :return:
            The date formatted to %Y-%m-%d as a unicode string in Python 3
            and a byte string in Python 2
        z
0000-%m-%d)rV)r1r'r'r(�	isoformats	zextended_date.isoformatcCs|�|�}tr|�d�S|S)z�
        Formats the date using strftime()

        :param format:
            The strftime() format string

        :return:
            The formatted date as a unicode string in Python 3 and a byte
            string in Python 2
        zutf-8)r[�py2r-)r1rWr&r'r'r(rVs

zextended_date.strftimecCsH|dkr|j}|dkr|j}|dkr*|j}|dkr8t}nt}||||�S)z�
        Returns a new datetime.date or asn1crypto.util.extended_date
        object with the specified components replaced

        :return:
            A datetime.date or asn1crypto.util.extended_date object
        Nr)rNrOrPrrK)r1rNrOrP�clsr'r'r(rU's	zextended_date.replacecCstr|��S|��SdS)N)r]�	__bytes__�__unicode__)r1r'r'r(�__str__Bszextended_date.__str__cCs|���d�S)Nzutf-8)r`r-)r1r'r'r(r_Hszextended_date.__bytes__cCs
|�d�S)Nz%Y-%m-%d)r[)r1r'r'r(r`Kszextended_date.__unicode__cCst||j�sdS|�|�dkS)NFr)�
isinstance�	__class__�__cmp__)r1�otherr'r'r(�__eq__Nszextended_date.__eq__cCs|�|�S)N)rf)r1rer'r'r(�__ne__Sszextended_date.__ne__cCsttdt|����dS)Nz�
            An asn1crypto.util.extended_date object can only be compared to
            an asn1crypto.util.extended_date or datetime.date object, not %s
            )�	TypeErrorr
r)r1rer'r'r(�_comparison_errorVszextended_date._comparison_errorcCs`t|t�rdSt||j�s$|�|�|j|j|jf}|j|j|jf}||krPdS||kr\dSdS)N���r	r)rbrrcrirNrOrP)r1re�st�otr'r'r(rd_s

zextended_date.__cmp__cCs|�|�dkS)Nr)rd)r1rer'r'r(�__lt__wszextended_date.__lt__cCs|�|�dkS)Nr)rd)r1rer'r'r(�__le__zszextended_date.__le__cCs|�|�dkS)Nr)rd)r1rer'r'r(�__gt__}szextended_date.__gt__cCs|�|�dkS)Nr)rd)r1rer'r'r(�__ge__�szextended_date.__ge__)NNN)r6r7r8�__doc__rNrOrPrQr[r\rVrUrar_r`rfrgrirdrmrnrorpr'r'r'r(rK�s(
	rKc@s�eZdZdZdZdZdZdZdZdZ	dZ
dZd/dd�Zdd�Z
dd	�Zd
d�Zdd
�Zdd�Zdd�Zd0dd�Zdd�Zd1dd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zd-d.�Z dS)2�extended_datetimez�
    A datetime.datetime-like object that can represent the year 0. This is just
    to handle 0000-01-01 found in some certificates.
    Nrc		Cs�|dkrtd��|dks |dkr(td��|dks<|t|krDtd��|dksT|dkr\td��|dksl|d	krttd
��|dks�|d	kr�td��|dks�|dkr�td
��||_||_||_||_||_||_||_||_	dS)a�
        :param year:
            The integer 0

        :param month:
            An integer from 1 to 12

        :param day:
            An integer from 1 to 31

        :param hour:
            An integer from 0 to 23

        :param minute:
            An integer from 0 to 59

        :param second:
            An integer from 0 to 59

        :param microsecond:
            An integer from 0 to 999999
        rzyear must be 0r	rJzmonth is out of rangezday is out of range�zhour is out of range�;zminute is out of rangezsecond is out of rangei?Bzmicrosecond is out of rangeN)
rLrMrNrOrP�hour�minute�second�microsecondr)	r1rNrOrPrurvrwrxrr'r'r(rQ�s,zextended_datetime.__init__cCst|j|j|j�S)zS
        :return:
            An asn1crypto.util.extended_date of the date
        )rKrNrOrP)r1r'r'r(r�szextended_datetime.datecCst|j|j|j|j|j�S)zI
        :return:
            A datetime.time object of the time
        )rrurvrwrxr)r1r'r'r(r�szextended_datetime.timecCs"|jdkrdS|j�|jdd��S)z\
        :return:
            None or a datetime.timedelta() of the offset from UTC
        Ni�)rN)rr4rU)r1r'r'r(r4�s
zextended_datetime.utcoffsetcCs"|jdkrdS|j�|jdd��S)zi
        :return:
            None or a datetime.timedelta() of the daylight savings time offset
        Ni�)rN)rr5rU)r1r'r'r(r5�s
zextended_datetime.dstcCs"|jdkrdS|j�|jdd��S)z�
        :return:
            None or the name of the timezone as a unicode string in Python 3
            and a byte string in Python 2
        Ni�)rN)rr3rU)r1r'r'r(r3�s
zextended_datetime.tznamec	Cs�|�dd�}td|j|j|j|j|j|j|j�}d|krf|�	d�}|�dd�}|�dd�}|�d|�}d|kr�|�	d�}|�dd�}|�dd�}|�d|�}|�	|�S)	z�
        Performs strftime(), always returning a unicode string

        :param format:
            A strftime() format string

        :return:
            A unicode string of the formatted datetime
        z%YrRi�z%crSrTz%%z%x)
rUrrOrPrurvrwrxrrV)r1rWrXrYrZr'r'r(r[�s*

zextended_datetime._format�TcCs&|jdkr|�d|�S|�d|�S)aj
        Formats the date as "%Y-%m-%d %H:%M:%S" with the sep param between the
        date and time portions

        :param set:
            A single character of the separator to place between the date and
            time

        :return:
            The formatted datetime as a unicode string in Python 3 and a byte
            string in Python 2
        rz0000-%%m-%%d%s%%H:%%M:%%Sz0000-%%m-%%d%s%%H:%%M:%%S.%%f)rxrV)r1�sepr'r'r(r\s
zextended_datetime.isoformatcCs|�|�}tr|�d�S|S)z�
        Formats the date using strftime()

        :param format:
            The strftime() format string

        :return:
            The formatted date as a unicode string in Python 3 and a byte
            string in Python 2
        zutf-8)r[r]r-)r1rWr&r'r'r(rV1s

zextended_datetime.strftimec	
	Cs�|dkr|j}|dkr|j}|dkr*|j}|dkr8|j}|dkrF|j}|dkrT|j}|dkrb|j}|dkrp|j}|dkr~t}	nt	}	|	||||||||�S)z�
        Returns a new datetime.datetime or asn1crypto.util.extended_datetime
        object with the specified components replaced

        :return:
            A datetime.datetime or asn1crypto.util.extended_datetime object
        Nr)
rNrOrPrurvrwrxrrrr)
r1rNrOrPrurvrwrxrr^r'r'r(rUBs8
zextended_datetime.replacecCstr|��S|��SdS)N)r]r_r`)r1r'r'r(ramszextended_datetime.__str__cCs|���d�S)Nzutf-8)r`r-)r1r'r'r(r_sszextended_datetime.__bytes__cCs d}|jdkr|d7}|�|�S)Nz%Y-%m-%d %H:%M:%Srz.%f)rxr[)r1rWr'r'r(r`vs
zextended_datetime.__unicode__cCst||j�sdS|�|�dkS)NFr)rbrcrd)r1rer'r'r(rf|szextended_datetime.__eq__cCs|�|�S)N)rf)r1rer'r'r(rg�szextended_datetime.__ne__cCsttdt|����dS)z�
        Raises a TypeError about the other object not being suitable for
        comparison

        :param other:
            The object being compared to
        z�
            An asn1crypto.util.extended_datetime object can only be compared to
            an asn1crypto.util.extended_datetime or datetime.datetime object,
            not %s
            N)rhr
r)r1rer'r'r(ri�s	z#extended_datetime._comparison_errorcCs�|��}|��}|dk	r |dks0|dkr8|dk	r8td��t|t�rFdSt||j�s\|�|�|j|j|j|j	|j
|j|j|f}|j|j|j|j	|j
|j|j|f}||kr�dS||kr�dSdS)Nz5can't compare offset-naive and offset-aware datetimesrjr	r)
r4rhrbrrcrirNrOrPrurvrwrx)r1re�soZoorkrlr'r'r(rd�s: 

zextended_datetime.__cmp__cCs|�|�dkS)Nr)rd)r1rer'r'r(rm�szextended_datetime.__lt__cCs|�|�dkS)Nr)rd)r1rer'r'r(rn�szextended_datetime.__le__cCs|�|�dkS)Nr)rd)r1rer'r'r(ro�szextended_datetime.__gt__cCs|�|�dkS)Nr)rd)r1rer'r'r(rp�szextended_datetime.__ge__)rrrrN)ry)NNNNNNNN)!r6r7r8rqrNrOrPrurvrwrxrrQrrr4r5r3r[r\rVrUrar_r`rfrgrirdrmrnrorpr'r'r'r(rr�s>
6

'

*(rr)FN)F)FN)F)%rq�
__future__rrrrr�sysrrrZ_errorsr
Z_irirrZ_ordereddictr
�_typesr�platformZ_inetrr�socket�version_inforrr]r)r/r0r9rM�objectrKrrr'r'r'r(�<module>sJ


-


;

Youez - 2016 - github.com/yon3zu
LinuXploit