AnonSec Shell
Server IP : 92.204.138.22  /  Your IP : 3.129.20.163
Web Server : Apache
System : Linux ns1009439.ip-92-204-138.us 4.18.0-553.8.1.el8_10.x86_64 #1 SMP Tue Jul 2 07:26:33 EDT 2024 x86_64
User : internationaljou ( 1019)
PHP Version : 7.4.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /proc/self/root/var/opt/nydus/ops/customer_local_ops/util/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     

Current File : /proc/self/root/var/opt/nydus/ops/customer_local_ops/util/__init__.py
from base64 import b64encode
import functools
import random
import string


def b64str(s: str) -> str:
    """Return `s` base64-encoded.

    :param s: string to encode
    """
    return b64encode(s.encode()).decode()


def fmap(func, obj):
    "Homomorphic mapping of a function"
    # strings are specifically not fmap-able because that invites
    # consideration as byte characters, not unicode
    if isinstance(obj, tuple):
        return tuple(map(functools.partial(fmap, func), obj))
    iterableitems = isinstance(obj, (list, dict))
    if not iterableitems:
        try:
            iterableitems = isinstance(obj, (filter, map, zip, range))
        except TypeError:  # pragma: nocover
            # Python2 doesn't have objects like the above
            # The corresponding operations just result in lists
            # which is already covered
            pass
    if iterableitems:
        if hasattr(obj, 'items'):
            return dict(map(functools.partial(fmap, func), obj.items()))
        return list(map(functools.partial(fmap, func), obj))
    if hasattr(obj, 'fmap'):
        return obj.fmap(func)
    return func(obj)


def random_password(length: int = None) -> str:
    """Create a random password.

    :param length: An int specifying password length
    :returns: the password, in cleartext
    """
    if not length:
        length = random.randint(10, 23)
    edited_punctuation = string.punctuation.replace('"', '').replace("'", "").replace("\\", "")
    return ''.join([random.choice(string.digits + string.ascii_letters + edited_punctuation)
                    for X in range(length)])

Anon7 - 2022
AnonSec Team