Skip to content

Commit

Permalink
fix: use bash shell when started by loader.so
Browse files Browse the repository at this point in the history
since process exe is not emp3r0r itself
  • Loading branch information
jm33-m0 committed Aug 3, 2023
1 parent 3822721 commit d12bda5
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion core/lib/agent/sshd_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,15 @@ func setWinsize(f *os.File, w, h int) {
// SSHD start a ssh server to provide shell access for clients
// the server binds local interface only
func crossPlatformSSHD(shell, port string, args []string) (err error) {
// if we're running from loader, elvsh is not available
run_from_loader := os.Getenv("LD") == "true"
if run_from_loader && shell == "elvsh" {
shell = "bash"
if util.IsCommandExist(shell) {
shell = "sh"
}
}

exe, err := exec.LookPath(shell)
if err != nil && shell != "elvsh" {
res := fmt.Sprintf("%s not found (%v), aborting", shell, err)
Expand All @@ -52,7 +61,6 @@ func crossPlatformSSHD(shell, port string, args []string) (err error) {
}
exe = new_exe
}

cmd := exec.Command(exe, args...)
cmd.Env = os.Environ()

Expand Down

0 comments on commit d12bda5

Please sign in to comment.