encountering errors, debugging from remote machine...

This commit is contained in:
2024-11-27 20:20:22 +01:00
parent 360654501d
commit 6aa590c016
5 changed files with 27 additions and 4 deletions
+1
View File
@@ -1,5 +1,6 @@
*.conf *.conf
venv venv
.vscode
# Byte-compiled / optimized / DLL files # Byte-compiled / optimized / DLL files
__pycache__/ __pycache__/
+17 -1
View File
@@ -9,7 +9,23 @@ And many people will be comfortable with YAML configurations! It's almost like J
The quickest way to start is to grab a template from the templates folder in this repository.<br> The quickest way to start is to grab a template from the templates folder in this repository.<br>
Make sure to correctly pass the MeshCentral websocket API as `wss://<MeshCentral-Host>/control.ashx`.<br> Make sure to correctly pass the MeshCentral websocket API as `wss://<MeshCentral-Host>/control.ashx`.<br>
And make sure to fill in the credentails of an account which has remote commands permissions.<br> And make sure to fill in the credentails of an account which has remote commands permissions.<br>
Then make a yaml with a target and some commands! See below examples as a guideline. And do not forget to look at the bottom's notice. Then make a yaml with a target and some commands! See below examples as a guideline. And do not forget to look at the bottom's notice.<br>
To install, follow the following commands:<br>
```shell
python3 -m venv ./venv
```
```shell
source ./venv/bin/activate
cd ./meshbook
```
```shell
pip3 install -r requirements.txt
```
Then you can use meshbook, for example:
```shell
python3 meshbook.py -pb examples/ping.yaml
```
# Example: # Example:
+4 -1
View File
@@ -3,4 +3,7 @@ name: Ping Multiple Points
company: Temp-Agents company: Temp-Agents
tasks: tasks:
- name: Ping Cloudflare - name: Ping Cloudflare
command: "ping 1.1.1.1 -c 4" command: "ping 1.1.1.1 -c 4"
- name: Ping Google
command: "ping 8.8.8.8 -c 4"
+5 -1
View File
@@ -116,7 +116,10 @@ class MeshcallerWebSocket:
async def ws_handler(self, uri: str, username: str, password: str): async def ws_handler(self, uri: str, username: str, password: str):
"""Main WebSocket connection handler.""" """Main WebSocket connection handler."""
login_string = f'{MeshcallerUtilities.base64_encode(username)},{MeshcallerUtilities.base64_encode(password)}' login_string = f'{MeshcallerUtilities.base64_encode(username)},{MeshcallerUtilities.base64_encode(password)}'
ws_headers = {'User-Agent': 'MeshCentral API client', 'x-meshauth': login_string} ws_headers = {
'User-Agent': 'MeshCentral API client',
'x-meshauth': login_string
}
if not args.silent: if not args.silent:
print("Attempting WebSocket connection...") print("Attempting WebSocket connection...")
@@ -286,6 +289,7 @@ async def main():
processor_task = asyncio.create_task(processor.receive_processor(python_client)) processor_task = asyncio.create_task(processor.receive_processor(python_client))
await MeshcallerActions.process_arguments(python_client, args.playbook) await MeshcallerActions.process_arguments(python_client, args.playbook)
await asyncio.gather(websocket_task, processor_task) await asyncio.gather(websocket_task, processor_task)
except ScriptEndTrigger as e: except ScriptEndTrigger as e:
if not args.silent: if not args.silent:
print(e) print(e)
-1
View File
@@ -1,6 +1,5 @@
asyncio asyncio
argparse argparse
configparser configparser
json
pyyaml pyyaml
websockets websockets