Files
CyberPanel/install/safe-move-path

25 lines
665 B
Plaintext
Raw Normal View History

#!/usr/bin/env python3
"""Helper script for CyberPanel File Manager: move src to dest by base64-encoded paths.
Invoked by lscpd as root. Exits 0 on success, 1 on failure."""
import sys
import os
import base64
import shutil
def main():
if len(sys.argv) < 3:
sys.exit(1)
try:
s_b64, d_b64 = sys.argv[1], sys.argv[2]
src = base64.b64decode(s_b64).decode('utf-8')
dest = base64.b64decode(d_b64).decode('utf-8')
if not src or not dest or not os.path.isabs(src):
sys.exit(1)
shutil.move(src, dest)
sys.exit(0)
except Exception:
sys.exit(1)
if __name__ == '__main__':
main()