Skip to content

Commit

Permalink
Add support to Linux/Unix in general.
Browse files Browse the repository at this point in the history
  • Loading branch information
jsastriawan committed Apr 16, 2021
1 parent a4b0496 commit 0a510c5
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 3 deletions.
8 changes: 8 additions & 0 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

An ElectronJS + Photonkit application to ease certain application tunneling via [Meshcentral 2](https://github.com/Ylianst/MeshCentral).
## Dependencies
Client software:
- Putty
- FileZilla
- Microsoft Remote Desktop Client or rdesktop on Linux

ElectronJS should be installed.
```
npm i -g electron@latest
Expand Down Expand Up @@ -30,6 +35,7 @@ Create config.json file to store your configuration.
}

```
For Unix/Linux, please see config_template_linux.json.

## How to run
```
Expand All @@ -51,6 +57,8 @@ For more custom application tunneling, new command list JSON is added to add mul
]
}
```
For Linux, see cmds-linux.json

Each entry need to have:
* label: This will be used as the title
* cmdexec: The path to binary/script to execute
Expand Down
15 changes: 13 additions & 2 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,13 @@ function setPanel(number) {

function loadCmds() {
try {
var temp_obj = JSON.parse(fs.readFileSync("cmds.json"));
var platform = process.platform;
var temp_obj = {}
if (fs.existsSync("cmds-"+platform+".json")) {
temp_obj = JSON.parse(fs.readFileSync("cmds-"+platform+".json"));
} else {
temp_obj = JSON.parse(fs.readFileSync("cmds.json"));
}
if (temp_obj != null && temp_obj.cmds != null && temp_obj.cmds.length != null) {
cmds = {};
for (var j = 0; j < temp_obj.cmds.length; j++) {
Expand Down Expand Up @@ -840,7 +846,12 @@ function sftpClicked() {
function rdpClicked() {
var data = readForm();
var exepath = data['rdp'];
var args = ['/v:127.0.0.1:lport'];
var args = []
if (process.platform == 'linux') {
args = ['127.0.0.1:lport'];
} else {
args = ['/v:127.0.0.1:lport'];
}
var tunnelcfg = {
nodeid: data["nodeidhex"],
port: 3389
Expand Down
9 changes: 9 additions & 0 deletions cmds-linux.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"cmds" :
[
{ "id": 1, "label": "VNC to port 5901", "cmdexec": "/usr/bin/vncviewer", "cmdargs" : "127.0.0.1::lport","cmdport":"5901"},
{ "id": 2, "label": "VNC to port 5902", "cmdexec": "/usr/bin/vncviewer", "cmdargs" : "127.0.0.1::lport","cmdport":"5902"},
{ "id": 3, "label": "VNC to port 5903", "cmdexec": "/usr/bin/vncviewer", "cmdargs" : "127.0.0.1::lport","cmdport":"5903"},
{ "id": 4, "label": "SSH to port 22", "cmdexec": "/usr/bin/putty", "cmdargs" : "-ssh 127.0.0.1 -P lport","cmdport":"22"}
]
}
12 changes: 12 additions & 0 deletions config_template_linux.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"mesh_url": "https://meshcentral.com/",
"mesh_username": "mesh_username",
"save_password": true,
"ssh": "/usr/bin/putty",
"sftp": "/usr/bin/filezilla",
"rdp": "/usr/bin/rdesktop",
"use_proxy": true,
"proxy_type": "socks",
"proxy_host": "10.1.192.48",
"proxy_port": "1080",
"mesh_passwordb64": "bWVzaF9wYXNzd29yZA=="
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ <h1 class="text-center">Settings</h1>
<td><input type="button" value="..." onClick="Q('sftp_file').click();"></td>
</tr>
<tr>
<td>RDP (MSTSC)</td>
<td>RDP (MSTSC/rdesktop)</td>
<td><input type="input" name="rdp" size='25' readonly><input type='file' name='rdp_file' id='rdp_file' onchange="updateRdpInput()" style="display:none;"></td>
<td><input type="button" value="..." onClick="Q('rdp_file').click();"></td>
</tr>
Expand Down

0 comments on commit 0a510c5

Please sign in to comment.