!C99Shell v. 2.0 [PHP 7 Update] [25.02.2019]!

Software: Apache. PHP/5.6.40 

uname -a: Linux cpanel06wh.bkk1.cloud.z.com 2.6.32-954.3.5.lve1.4.80.el6.x86_64 #1 SMP Thu Sep 24
01:42:00 EDT 2020 x86_64
 

uid=851(cp949260) gid=853(cp949260) groups=853(cp949260) 

Safe-mode: OFF (not secure)

/opt/alt/python37/lib/python3.7/site-packages/clcommon/lib/   drwxr-xr-x
Free 232.98 GB of 981.82 GB (23.73%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Feedback    Self remove    Logout    


Viewing file:     jwt_token.py (2.14 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
# coding=utf-8
#
# Copyright © Cloud Linux GmbH & Cloud Linux Software, Inc 2010-2020 All Rights Reserved
#
# Licensed under CLOUD LINUX LICENSE AGREEMENT
# http://cloudlinux.com/docs/LICENCE.TXT
#

# pylint: disable=no-absolute-import

from jwt import decode, exceptions
from clcommon.lib.consts import DEFAULT_JWT_ES_TOKEN_PATH


def read_jwt(jwt_path):
    with open(jwt_path, mode='rb') as f:
        token_string = f.read().strip()
    return token_string


def decode_jwt(token_string, verify_exp=True):
    jwt_token = decode(token_string, algorithms=['HS256'],
                       options={'require_exp': True, "verify_exp": verify_exp, "verify_iss": True,
                                'verify_signature': False},
                       issuer='CloudLinux')
    if 'exp' not in jwt_token:
        raise exceptions.MissingRequiredClaimError('exp')
    return jwt_token


def jwt_token_check():
    """
    JWT token check
    :return: Tuple: success_flag, error_message, token_string
     success_flag: True/False - OK, JWT is valid/Error, invalid
     error_message: Error message
     token_string: Token string
    """
    success_flag, error_message, token_string = True, "OK", None
    try:
        token_string = read_jwt(DEFAULT_JWT_ES_TOKEN_PATH)
    except (OSError, IOError):
        return False, "JWT file {} read error".format(DEFAULT_JWT_ES_TOKEN_PATH), None
    # JWT read success
    try:
        jwt_token = decode_jwt(token_string)
        if jwt_token.get("cl_plus") is None:
            success_flag, error_message, token_string = False, "JWT token format error", None
        elif not jwt_token.get("cl_plus"):
            success_flag, error_message, token_string = False, "JWT token doesn't have CL+ service", None
    except exceptions.InvalidIssuerError:
        success_flag, error_message, token_string = False, "JWT token issuer is invalid", None
    except exceptions.ExpiredSignatureError:
        success_flag, error_message, token_string = False, "JWT token expired", None
    except exceptions.PyJWTError:
        success_flag, error_message, token_string = False, "JWT token format error", None
    return success_flag, error_message, token_string

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ Read-Only ]

:: Make Dir ::
 
[ Read-Only ]
:: Make File ::
 
[ Read-Only ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v. 2.0 [PHP 7 Update] [25.02.2019] maintained by KaizenLouie | C99Shell Github | Generation time: 0.0384 ]--