aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoe <rbo@gmx.us>2024-04-24 20:20:20 +0200
committerJoe <rbo@gmx.us>2024-04-24 20:20:20 +0200
commit908b4ccc0d2f85898e94feda77dae2fe25782544 (patch)
treea2225982cfa3b45e9f052dd3c481feaf53f6fac8
parentup (diff)
downloadhardflip-908b4ccc0d2f85898e94feda77dae2fe25782544.tar.gz
hardflip-908b4ccc0d2f85898e94feda77dae2fe25782544.tar.bz2
hardflip-908b4ccc0d2f85898e94feda77dae2fe25782544.tar.xz
hardflip-908b4ccc0d2f85898e94feda77dae2fe25782544.tar.zst
hardflip-908b4ccc0d2f85898e94feda77dae2fe25782544.zip
jump
-rw-r--r--ROADMAP.md2
-rw-r--r--src/c_exec.go4
-rw-r--r--src/i_info.go47
3 files changed, 50 insertions, 3 deletions
diff --git a/ROADMAP.md b/ROADMAP.md
index f4e96ed..1a7d380 100644
--- a/ROADMAP.md
+++ b/ROADMAP.md
@@ -32,7 +32,7 @@
- [x] reload keep position
- [x] add
- [ ] clone
-- [ ] ssh jump for rdp
+- [ ] ssh jump for rdp - working but missing in add menu
- [ ] edit
- [ ] move
- [ ] rename
diff --git a/src/c_exec.go b/src/c_exec.go
index b9990d9..d36951b 100644
--- a/src/c_exec.go
+++ b/src/c_exec.go
@@ -53,6 +53,7 @@ package main
import (
"bytes"
+ // "fmt"
"math/rand/v2"
"os"
"os/exec"
@@ -243,7 +244,7 @@ func c_redirect_ssh(host *HostNode, local_port uint16) error {
rdr_fmt = append(rdr_fmt, "-p", strconv.Itoa(int(host.Jump.Port)))
}
rdr_fmt = append(rdr_fmt, host.Jump.User + "@" + host.Jump.Host,
- "-", "sleep", "5")
+ "sleep", "5")
if err := exec.Command(rdr_fmt[0], rdr_fmt[1:]...).Run(); err != nil {
return err
}
@@ -258,7 +259,6 @@ func c_exec(host *HostNode, opts HardOpts, ui *HardUI) {
if host.Protocol == PROTOCOL_RDP && len(host.Jump.Host) != 0 {
local_host := "127.0.0.1"
local_port := uint16(rand.IntN(40000) + 4389)
- ui.s.Fini()
if err := c_redirect_ssh(host, local_port); err != nil {
c_error_mode("ssh tunneling", err, ui)
return
diff --git a/src/i_info.go b/src/i_info.go
index dc1d70b..a5860f3 100644
--- a/src/i_info.go
+++ b/src/i_info.go
@@ -295,6 +295,53 @@ func i_info_rdp(ui HardUI, host *HostNode, line int) int {
}
if line += 1; line > ui.dim[H] - 3 { return line }
}
+ // jump
+ if len(host.Jump.Host) > 0 {
+ i_draw_text(ui.s,
+ (ui.dim[W] / 3) + 3, line, ui.dim[W] - 2, line,
+ ui.style[TITLE_STYLE], "Jump settings: ")
+ if line += 1; line > ui.dim[H] - 3 { return line }
+ i_draw_text(ui.s,
+ (ui.dim[W] / 3) + 4, line, ui.dim[W] - 2, line,
+ ui.style[TITLE_STYLE], "Host: ")
+ i_draw_text(ui.s,
+ (ui.dim[W] / 3) + 10, line, ui.dim[W] - 2, line,
+ ui.style[DEF_STYLE], host.Jump.Host)
+ if line += 1; line > ui.dim[H] - 3 { return line }
+ i_draw_text(ui.s,
+ (ui.dim[W] / 3) + 4, line, ui.dim[W] - 2, line,
+ ui.style[TITLE_STYLE], "Port: ")
+ i_draw_text(ui.s,
+ (ui.dim[W] / 3) + 10, line, ui.dim[W] - 2, line,
+ ui.style[DEF_STYLE], strconv.Itoa(int(host.Jump.Port)))
+ if line += 1; line > ui.dim[H] - 3 { return line }
+ i_draw_text(ui.s,
+ (ui.dim[W] / 3) + 4, line, ui.dim[W] - 2, line,
+ ui.style[TITLE_STYLE], "User: ")
+ i_draw_text(ui.s,
+ (ui.dim[W] / 3) + 10, line, ui.dim[W] - 2, line,
+ ui.style[DEF_STYLE], host.Jump.User)
+ if line += 1; line > ui.dim[H] - 3 { return line }
+ if len(host.Jump.Pass) > 0 {
+ i_draw_text(ui.s,
+ (ui.dim[W] / 3) + 4, line, ui.dim[W] - 2, line,
+ ui.style[TITLE_STYLE], "Pass: ")
+ i_draw_text(ui.s,
+ (ui.dim[W] / 3) + 10, line, ui.dim[W] - 2, line,
+ ui.style[DEF_STYLE], "***")
+ if line += 1; line > ui.dim[H] - 3 { return line }
+ }
+ if len(host.Jump.Priv) > 0 {
+ i_draw_text(ui.s,
+ (ui.dim[W] / 3) + 4, line, ui.dim[W] - 2, line,
+ ui.style[TITLE_STYLE], "Privkey: ")
+ i_draw_text(ui.s,
+ (ui.dim[W] / 3) + 13, line, ui.dim[W] - 2, line,
+ ui.style[DEF_STYLE], host.Jump.Priv)
+ if line += 1; line > ui.dim[H] - 3 { return line }
+ }
+ if line += 1; line > ui.dim[H] - 3 { return line }
+ }
return line
}