Uname:Linux antigravity-cli 6.8.0-31-generic #31-Ubuntu SMP PREEMPT_DYNAMIC Sat Apr 20 00:40:06 UTC 2024 x86_64

Base Dir : /var/www/moonbloom

User : wp-moonbloom


403WebShell
403Webshell
Server IP : 85.155.190.233  /  Your IP : 216.73.216.103
Web Server : nginx/1.24.0
System : Linux antigravity-cli 6.8.0-31-generic #31-Ubuntu SMP PREEMPT_DYNAMIC Sat Apr 20 00:40:06 UTC 2024 x86_64
User : wp-moonbloom ( 1001)
PHP Version : 8.3.6
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /opt/Gemini_Swarm_Core/scripts/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /opt/Gemini_Swarm_Core/scripts/deploy_gemini_creds.py
import os
import sys

sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
from _ssh import connect, run_cmd, safe_print, VPS_IP, VPS_PORT

LOCAL_GEMINI_DIR = os.path.expanduser("~/.gemini")
REMOTE_GEMINI_DIR = "/opt/Gemini_Swarm_Core/.gemini"
CREDENTIAL_FILES = ("settings.json", "oauth_creds.json", "google_accounts.json")


def deploy() -> None:
    safe_print(f"Connecting to {VPS_IP}:{VPS_PORT}...")
    try:
        client = connect()
    except Exception as e:
        safe_print(f"Connection failed: {e}")
        return

    sftp = client.open_sftp()

    try:
        sftp.mkdir(REMOTE_GEMINI_DIR)
    except IOError:
        pass

    for fname in CREDENTIAL_FILES:
        local_path = os.path.join(LOCAL_GEMINI_DIR, fname)
        remote_path = f"{REMOTE_GEMINI_DIR}/{fname}"
        if os.path.exists(local_path):
            safe_print(f"Uploading {fname}...")
            sftp.put(local_path, remote_path)
            sftp.chmod(remote_path, 0o600)
        else:
            safe_print(f"Warning: {local_path} not found, skipping.")

    sftp.close()

    safe_print("Setting credentials ownership to swarm user...")
    run_cmd(client, "chown -R swarm:swarm /opt/Gemini_Swarm_Core/.gemini")

    safe_print("Testing gemini CLI on remote VPS (as swarm user)...")
    code, out, err = run_cmd(client, "runuser -u swarm -- env HOME=/opt/Gemini_Swarm_Core gemini run --help")
    if code == 0:
        safe_print("Gemini CLI authenticated and working as swarm user.")
    else:
        safe_print(f"Gemini CLI test failed (exit {code}).\n{err}")

    client.close()


if __name__ == "__main__":
    deploy()

Youez - 2016 - github.com/yon3zu
LinuXploit