A python package that allows connecting and sending commands direcly to a proxmox node/lxc via vnc websocket.
Project description
ProxVNC allows connecting and executing arbitrary commands directly on a Proxmox node/LXC via VNC WebSocket.
Installation
This package can be installed via PyPI:
pip install ProxVNC
Usage information
See the Examples folder for additional working examples.
Connecting via proxmoxer package:
First, create an object to connect to your Proxmox server. For more info read PROXMOXER documentation. All authentication methods are supported.. If you use an Api token you must set the permission to [Sys.console]
from ProxVNC.proxmoxer import ProxmoxAPI
from ProxVNC import ProxVNC
proxmox = ProxmoxAPI(host="<proxmox_host:port>", # ex: 10.0.0.1:8006
user="<username@realm>", # ex: "root@pam"
password="<password>",
otp=input("OTP: "),
verify_ssl=False)
Create a ProxVNC object and pass the proxmoxer connection via the api parameter.
Optionally, specify which node to connect to.
client = ProxVNC(api=proxmox, node="pve") # specify node if needed, otherwise first node is used by default
client.connect()
You are now connected! Here is a simple example of interacting with the terminal:
print(client.readTerm())
# --- Interact with terminal ---
while True:
cmd = input("Enter a command: ")
if cmd.lower() in ["exit", "quit"]: # Keywords to exit
break
client.execCommand(cmd) # Execute the command
print(client.readTerm()) # Read the terminal
client.disconnect() # Don't forget to disconnect when you're done
Use execCommandAsB64(command: str, wait_time=0.5) instead of execCommand() for complex or large commands. It encodes the command in Base64 and sends it with an optional delay to ensure reliable execution.
Connecting direcly with a shell ticket:
You can also connect to the VNC terminal directly by POSTing to the Proxmox termproxy endpoint
In this example, PROXMOXER is used to call Proxmox API endpoints, but you can use requests or another package.
proxmox = ProxmoxAPI(host="<proxmox_host:port>", # ex: 10.0.0.1:8006
user="", # ex: "root@pam"
password="<password>",
otp=input("OTP: "),
verify_ssl=False)
termproxy = proxmox.nodes("pve").termproxy.post() # POST to termproxy with the node you want to connect to
# Get shell ticket and port
shell_ticket = termproxy["ticket"]
shell_port = termproxy["port"]
pve_cookie, _ = proxmox.get_tokens() # Get cookie token
Once you have the required data, create the ProxVNC object manually:
client = ProxVNC(
url="https://<proxmox_host:port>",
node="pve",
user="<username@realm>",
shell_port=shell_port,
shell_ticket=shell_ticket,
pve_auth_cookie=pve_cookie
)
client.connect()
You can now start sending and receiving commands.
Sending files:
Using the sendFile(local_path: str, remote_path: str, wait_time=0.5) method, you can upload files to a specific location on your Proxmox node or LXC container.
client.sendFile("testSend.txt", "/root/testReceive.txt")
Contributing
We welcome contributions! Here’s how you can help:
- Fork the repository and create a new branch for your feature or bug fix.
- Make your changes and ensure the code is clean and well-documented.
- Test your changes thoroughly before submitting.
- Open a pull request with a clear description of your changes.
Please follow PEP8 coding style and include examples if applicable.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file proxvnc-1.2.1.tar.gz.
File metadata
- Download URL: proxvnc-1.2.1.tar.gz
- Upload date:
- Size: 20.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
81f52244675f9e447af6010a213a14d2d69ce76704f422eb644a6c4815db0ae8
|
|
| MD5 |
861bb741e1c1a47ff43cbaaab49ba893
|
|
| BLAKE2b-256 |
aa0faa7bed899f99aca66e3f7df908c5054b2e6e6364e0b60c7243b23fc4d76d
|
Provenance
The following attestation bundles were made for proxvnc-1.2.1.tar.gz:
Publisher:
python-publish.yml on xgiralt64/ProxVNC
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
proxvnc-1.2.1.tar.gz -
Subject digest:
81f52244675f9e447af6010a213a14d2d69ce76704f422eb644a6c4815db0ae8 - Sigstore transparency entry: 749001702
- Sigstore integration time:
-
Permalink:
xgiralt64/ProxVNC@63577f957cd9eddebdfce4d4caf9f1ad5247966c -
Branch / Tag:
refs/tags/v1.2.1 - Owner: https://github.com/xgiralt64
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@63577f957cd9eddebdfce4d4caf9f1ad5247966c -
Trigger Event:
release
-
Statement type:
File details
Details for the file proxvnc-1.2.1-py3-none-any.whl.
File metadata
- Download URL: proxvnc-1.2.1-py3-none-any.whl
- Upload date:
- Size: 24.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fa65f9522accd7f54b671fd48104d4b7fe6dfc13c61aea50025dca54ac72f610
|
|
| MD5 |
54278108949af1cb85009f354f5ee8ac
|
|
| BLAKE2b-256 |
7dbf0a2416111640efc738c14eabd41663c1424f9c7a1fd2b3a2519cf33f6260
|
Provenance
The following attestation bundles were made for proxvnc-1.2.1-py3-none-any.whl:
Publisher:
python-publish.yml on xgiralt64/ProxVNC
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
proxvnc-1.2.1-py3-none-any.whl -
Subject digest:
fa65f9522accd7f54b671fd48104d4b7fe6dfc13c61aea50025dca54ac72f610 - Sigstore transparency entry: 749001712
- Sigstore integration time:
-
Permalink:
xgiralt64/ProxVNC@63577f957cd9eddebdfce4d4caf9f1ad5247966c -
Branch / Tag:
refs/tags/v1.2.1 - Owner: https://github.com/xgiralt64
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@63577f957cd9eddebdfce4d4caf9f1ad5247966c -
Trigger Event:
release
-
Statement type: