404

[ Avaa Bypassed ]




Upload:

Command:

elspacio@3.133.108.155: ~ $
from base64 import b64encode

import requests.auth

from .base import AuthPlugin


# noinspection PyAbstractClass
class BuiltinAuthPlugin(AuthPlugin):
    package_name = '(builtin)'


class HTTPBasicAuth(requests.auth.HTTPBasicAuth):

    def __call__(
        self,
        request: requests.PreparedRequest
    ) -> requests.PreparedRequest:
        """
        Override username/password serialization to allow unicode.

        See https://github.com/httpie/httpie/issues/212

        """
        # noinspection PyTypeChecker
        request.headers['Authorization'] = type(self).make_header(
            self.username, self.password).encode('latin1')
        return request

    @staticmethod
    def make_header(username: str, password: str) -> str:
        credentials = f'{username}:{password}'
        token = b64encode(credentials.encode()).strip().decode('latin1')
        return f'Basic {token}'


class BasicAuthPlugin(BuiltinAuthPlugin):
    name = 'Basic HTTP auth'
    auth_type = 'basic'
    netrc_parse = True

    # noinspection PyMethodOverriding
    def get_auth(self, username: str, password: str) -> HTTPBasicAuth:
        return HTTPBasicAuth(username, password)


class DigestAuthPlugin(BuiltinAuthPlugin):
    name = 'Digest HTTP auth'
    auth_type = 'digest'
    netrc_parse = True

    # noinspection PyMethodOverriding
    def get_auth(
        self,
        username: str,
        password: str
    ) -> requests.auth.HTTPDigestAuth:
        return requests.auth.HTTPDigestAuth(username, password)

Filemanager

Name Type Size Permission Actions
__pycache__ Folder 0755
__init__.py File 299 B 0644
base.py File 4.25 KB 0644
builtin.py File 1.49 KB 0644
manager.py File 2.4 KB 0644
registry.py File 520 B 0644