Python application that enables users to remotely create and execute scripts on their machines.
- Python 3+
- pip modules (See
requirements.txt
for list of modules) - Google Account
- Google API Console Service Account
creds/service_account_credentials.json
file (Credentials for Google Service Account)- GitHub Account
- GitHub Repository to store scripts
- GitHub Personal Access Token (Only if using private repository to store scripts)
- Go to Google's API Console and sign in to your google account.
- Create a project.
- Create a service account enabling the Google Sheets API.
- Download the credentials as
service_account_credentials.json
file. - Store the
service_account_credentials.json
file in thecreds/
folder. - Done. Also see Google APIs Terms of Service.
This is essentially a Google Sheets document i.e. a spreadsheet. It acts as a controller containing several parameters used to control the target computer remotely.
To set it up, create a Google Sheets document identical to this copy of my version of Exterior. Make sure you name the spreadsheet as Exterior
. You may store this inside another google drive folder named Exterior, for convenience.
- This repository is for storing the scripts which you want to create and run remotely.
- Currently only .py and .pyw file extensions are supported.
- Steps for creating scripts:
- Create the script inside your chosen repository.
- Create a switch for this script in Exterior.
- Note that all scripts must be stored in a single repository.
- See this sample repository for documented examples.
- If you are using a private repository, you must create a GitHub Personal Access Token. To do this, after logging into your GitHub account, see
Settings
>Developer Settings
>Personal Access Token
.
Download the repository. From the command line, run this in the app's root directory -
pip install -r requirements.txt
To run the app, just click on the file main.pyw
and open it with Python.
Alternatively, if you want to run script-caster from the command line, execute the following code from the app root directory -
pythonw main.pyw
Upon running, the settings menu will automatically pop up, if settings are not already set. Then you'll have to fill in several options including your details for Exterior and GitHub.
Done. Now you'll be able to create and execute scripts remotely.
The program fetches data from Exterior every few seconds. Based on parameter values, it then executes scripts that it scrapes from GitHub.
Example - Copy of Exterior
These parameters have been hard-coded into the main files of the program and are thoroughly involved in the code's execution.
CONTACT_STATUS
- Read only.
- Specifies whether program is able to access Exterior or not.
- The value of this parameter is related to other hard-coded parameters such as
LAST_CONTACT_TIME
,CURRENT_TIME
andTIME_DIFFERENCE
, which are also read-only.
REQUEST_INTERVAL
- Input accepted.
- Specify the interval(in integer seconds) between each fetch request to the spreadsheet
- IMPORTANT: Specifying a very low interval and continuously communicating with the program via Google API can be dangerous. See Google API usage limits. Minimum interval time to avoid rate-limiting is approximately 5 seconds. Recommended interval time is 10-30 seconds.
UPDATE_LOCAL_USER_SCRIPTS
- Input accepted.
- Checkmark this parameter if you've just made changes in your scripts repo, while the app is already running, and want the changes to be downloaded locally. The changes in your repo will only be considered by the app after you've marked this parameter.
- These parameters are used to manage the functioning of scripts.
- To create a switch parameter, set the value of a cell to the script's name. In the cell below this one, you can set it to
ON
orOFF
. Use of conditional formatting and data validation is recommended. - To see the status for the execution of the script, in the same row as the switch parameter, do as follows - Set the value of a cell to
STATUS
. In the cell below this one, the program will automatically set the value as one of the following depending on the script's result -Running
,Done
,Failed
, along with the timestamp. - Note that heading rows and value rows should not conflict.
- In your scripts, you can also make contact with Exterior and fetch/update values. To know more, see gspread documentation. You can also check the sample script repository(linked above) for an importable python file(
lib/exterior_connection.py
) that makes interaction with Exterior easier.
To add a comment that will not be parsed by the program, set the value of a cell to COMMENT
. In the cell below this one, you can set the comment.
- This program is supposed to be able to run on all operating systems, though it has only been tested on Windows.
- Scripts can only be executed on a target computer only after the application has been installed into the target and it is awake, having access to the Internet.
tkthemes/azure-ttk-theme
(Theme style for tkinter window) - https://github.com/rdbende/Azure-ttk-themefavicon.ico
- Flaticon