Run Remote Windows Executables
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
test_executables
test_executables_2
wrun
.gitignore
LICENSE
README.md
setup.py
test.py
wrun_service.py

README.md

wrun

Run Remote Windows Executables

Installation

Install from pypi

pip install wrun

To use "Windows Service" on Windows

Install the last PyWin32 package https://sourceforge.net/projects/pywin32/files/pywin32/

Usage

You can create a Windows Service and use it via wrun.Proxy

Service Configuration

Create a configuration file with python syntax. Example settings.py:

EXECUTABLE_PATH = "C:\remote_activation"
LOG_PATH = "C:\remote_activation\wrun.log"
PORT = 3333

Mandatory settings:

  • EXECUTABLE_PATH: absolute path of the executables directory
  • LOG_PATH/LOG_FILECONFIG/LOG_DICTCONFIG: log path and configuration
  • PORT: daemon listening port

Optional settings:

  • HOST: host name or IP address (default: localhost)
  • COLLECT_STDERR: response results contains stderr too (default: False)

Advanced Logging

You must specify one and only one of the following settings:

Service Management

Create the Windows Service:

wrun_service.py <service-name> <absolute-path-to-settings-file>

(wrun_service.py is a utility script installed alongside with wrun)

Start/Stop/Delete the service:

sc start|stop|delete <service-name>

Client

Sample code:

import wrun

client = wrun.Proxy("localhost", 3333)
result = client.run("sample.exe", ["first-param", "second-param"])
print(result)
# {"stdout": "OUTPUT", "returncode": 0}

General form:

import wrun

client = wrun.Proxy(<server>, <port>)
result = client.run(<executable_name>, <params>, <input_stdin>="")

Some constraints:

  • server, port: connection parameters for daemon
  • executable_name: name of exe or script available in the EXECUTABLE_PATH of the daemon
  • params: list (can be empty) of command line arguments to pass to executable
  • input_stdin: if specified is passed as stdin to the process
  • result: dictionary with collected stdout and returncode

The client does not need PyWin32

Disclaimer

USE IT AT YOUR OWN RISK!

This piece of software enables the execution of code on a remote host without any authentication. This behaviour is "by definition" a "security hole". So you should use "wrun" only on a very reliable environment! (ex. completely disconnected LAN ... and a "completely connected brain" (cit c8e)! )

Tests

To run the test cases:

git clone https://github.com/depaolim/wrun
cd wrun
python test.py

Some tests will be skipped if PyWin32 is not installed

TODO

  • Travis-CI
  • hmac