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/test_tokeninfo.py
import json
import httpx
from google.oauth2.credentials import Credentials
from google.auth.transport.requests import Request

def test():
    oauth_path = "/opt/Gemini_Swarm_Core/.gemini/oauth_creds.json"
    with open(oauth_path) as f:
        data = json.load(f)

    raw_token = data.get("access_token")
    refresh_token = data.get("refresh_token")

    print("Checking tokeninfo for raw access token from oauth_creds.json:")
    r = httpx.get(f"https://www.googleapis.com/oauth2/v1/tokeninfo?access_token={raw_token}")
    print("Raw token status:", r.status_code)
    if r.status_code == 200:
        print("Raw token info:", json.dumps(r.json(), indent=2))
    else:
        print("Raw token error:", r.text)

    # Now refresh it using python library
    print("\nRefreshing token in Python...")
    creds = Credentials(
        token=raw_token,
        refresh_token=refresh_token,
        token_uri="https://oauth2.googleapis.com/token",
        client_id="681255809395-oo8ft2oprdrnp9e3aqf6av3hmdib135j.apps.googleusercontent.com",
        client_secret="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",
        scopes=data.get("scope", "").split()
    )
    try:
        creds.refresh(Request())
        print("Refreshed tokeninfo:")
        r2 = httpx.get(f"https://www.googleapis.com/oauth2/v1/tokeninfo?access_token={creds.token}")
        print("Refreshed token status:", r2.status_code)
        if r2.status_code == 200:
            print("Refreshed token info:", json.dumps(r2.json(), indent=2))
        else:
            print("Refreshed token error:", r2.text)
    except Exception as e:
        print("Refresh failed:", e)

if __name__ == "__main__":
    test()

Youez - 2016 - github.com/yon3zu
LinuXploit