Dre4m Shell
Server IP : 127.0.0.2  /  Your IP : 18.217.0.242
Web Server : Apache/2.4.18 (Ubuntu)
System :
User : www-data ( )
PHP Version : 7.0.33-0ubuntu0.16.04.16
Disable Function : disk_free_space,disk_total_space,diskfreespace,dl,exec,fpaththru,getmyuid,getmypid,highlight_file,ignore_user_abord,leak,listen,link,opcache_get_configuration,opcache_get_status,passthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,php_uname,phpinfo,posix_ctermid,posix_getcwd,posix_getegid,posix_geteuid,posix_getgid,posix_getgrgid,posix_getgrnam,posix_getgroups,posix_getlogin,posix_getpgid,posix_getpgrp,posix_getpid,posix,_getppid,posix_getpwnam,posix_getpwuid,posix_getrlimit,posix_getsid,posix_getuid,posix_isatty,posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid,posix_setpgid,posix_setsid,posix_setuid,posix_times,posix_ttyname,posix_uname,pclose,popen,proc_open,proc_close,proc_get_status,proc_nice,proc_terminate,shell_exec,source,show_source,system,virtual
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /usr/lib/python2.7/dist-packages/keyring/util/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME SHELL ]     

Current File : /usr/lib/python2.7/dist-packages/keyring/util/escape.py
"""
escape/unescape routines available for backends which need
alphanumeric usernames, services, or other values
"""

import re
import string
import sys

# True if we are running on Python 3.
# taken from six.py
PY3 = sys.version_info[0] == 3

# allow use of unicode literals
if PY3:
    def u(s):
        return s
    def _unichr(c):
        return chr(c)
else:
    def u(s):
        return unicode(s, "unicode_escape")
    def _unichr(c):
        return unichr(c)

LEGAL_CHARS = (
    getattr(string, 'letters', None)  # Python 2
    or getattr(string, 'ascii_letters')  # Python 3
) + string.digits

ESCAPE_FMT = "_%02X"

def _escape_char(c):
    "Single char escape. Return the char, escaped if not already legal"
    if isinstance(c, int):
        c = _unichr(c)
    return c if c in LEGAL_CHARS else ESCAPE_FMT % ord(c)

def escape(value):
    """
    Escapes given string so the result consists of alphanumeric chars and
    underscore only.
    """
    return "".join(_escape_char(c) for c in value.encode('utf-8'))

def _unescape_code(regex_match):
    ordinal = int(regex_match.group('code'), 16)
    if sys.version_info >= (3,):
        return bytes([ordinal])
    return chr(ordinal)

def unescape(value):
    """
    Inverse of escape.
    """
    re_esc = re.compile(
        # the pattern must be bytes to operate on bytes
        ESCAPE_FMT.replace('%02X', '(?P<code>[0-9A-F]{2})').encode('ascii')
    )
    return re_esc.sub(_unescape_code, value.encode('ascii')).decode('utf-8')

Anon7 - 2022
AnonSec Team