File size: 877 Bytes
ea7fd90
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
"""
execute_command.py
-------------------
This script handles the execution of commands sent to HarmonyAI.
"""

import requests

def is_safe(command, script):
    # Implement safety checks here
    return True

def send_command_to_server(command, script):
    response = requests.post("http://localhost:5000/execute", json={"command": command, "script": script})
    return response.json()

def execute_command(command, script):
    if is_safe(command, script):
        result = send_command_to_server(command, script)
        print(result)
    else:
        print("Command is not safe to execute.")

# Example usage
command = "Go through my email, find the website I signed up for, and cancel my subscription."
script = """#!/bin/bash
# Script to search emails and cancel subscription
python search_emails.py --action cancel_subscription"""
execute_command(command, script)