Mini Shell

Direktori : /proc/thread-self/root/proc/self/root/opt/tier1adv/bin/
Upload File :
Current File : //proc/thread-self/root/proc/self/root/opt/tier1adv/bin/usernano

#!/opt/imh-python/bin/python3
"""Nano wrapper for editing /var/cpanel/users files"""
import os
import select
import argparse
import sys

sys.path.insert(0, '/opt/support/lib')
from arg_types import cpuser_safe_arg


def parse_args() -> str:
    """Parses command line arguments"""
    parser = argparse.ArgumentParser(description=__doc__)
    parser.add_argument('user', type=cpuser_safe_arg, help="user to edit")
    return parser.parse_args().user


def main():
    if select.select([sys.stdin], [], [], 0.0)[0]:
        sys.exit("Cannot have stdin")
    user = parse_args()
    cmd = [
        "/usr/bin/nano",
        '-o',
        '/var/cpanel/users/',
        '-l',
        f'/var/cpanel/users/{user}',
    ]
    os.execv(cmd[0], cmd)


if __name__ == "__main__":
    main()

Zerion Mini Shell 1.0