NetRelay is a simple network relay tool forwarding the shell command to the destination terminal.
For relay terminal
python3 relay.py --src=<sourceAddr>
For client terminal
python3 client.py --dst=<destinationAddr>[ --error]
--error
will displaystderr
message on the screen.
For API use
import netrelay.client as nr_client
-
Use
nr_client.start(<ipPortAddr>)
andnr_client.close()
to start the connection to the relay server and close the connection to the relay server.start
will return two valuess, id
representing the remote relay server<server>
and the index of the current client on the remote relay server. -
Use
nr_client.exec_cmd(<server>, <command>)
to execute the<command>
remotely on relay server<server>
.exec_cmd
will return two valuesres, err
representing the result of the execution and the error message of the execution respectively. -
Use
nr_client.exec_cmd_and_save(<server>, <command>, <resultDir>[, <errorMessageDir>])
to execute the<command>
remotely on relay server<server>
, and save the result in<resultDir>
, save the error message in<errorMessageDir>
.
Here is an example.
import netrelay.client as nr_client
s, id = nr_client.start(('127.0.0.1', 2333))
res, err = nr_client.exec_cmd(s, 'curl -L www.linux.com')
nr_client.exec_cmd_and_save(s, 'curl -L www.linux.com', 'linux.html')
nr_client.close()
We modified the project to adapt to the PST REST API, and this tools enable users to call the PST REST API on a Windows PST-installed computer from a remote computer (for example, a Linux client which does not have PST support). See PST SDK Documentation for details about the PST REST API. Since the PST REST API includes streaming output, we use pycurl
to re-implement the relay server. The client remains the same.
For relay terminal
python3 relay_pstrest.py --src=<sourceAddr>
For client terminal
python3 client_pstrest.py --dst=<destinationAddr>[ --error]
You will be asked to input the filename that stores the result. Since this tool is designed for PST SDK REST API, the result will be saved in result
directory with a .json
format.
Note. This tool only supports PST REST API currently, but may not support other curl
-based APIs.
- mini-shell client
- client API support
- Support PST SDK REST API
- Support full
curl
method