0xmachos / mOrc

mOrc is a post-exploitation framework for macOS written in Bash
MIT License
18 stars 2 forks source link

Convert to Zsh #5

Open 0xmachos opened 3 years ago

0xmachos commented 3 years ago

As suggested by @0x27 here convert to /bin/zsh instead of /bin/sh.

Unsure if this is possible at present.

Can't get Zsh to replicate the ability to load an ENV script into an interactive shell.

0xmachos commented 3 years ago

@bruienne pointed me to the Zsh manual page Parameters-Used-By-The-Shell.

ENV If the ENV environment variable is set when zsh is invoked as sh or ksh, $ENV is sourced after the profile scripts. The value of ENV is subjected to parameter expansion, command substitution, and arithmetic expansion before being interpreted as a pathname. Note that ENV is not used unless the shell is interactive and zsh is emulating sh or ksh.

After playing with emulate I think the best solution is to source mo.rc while running in a Zsh session.

source mo.rc

The only thing I can see that needs changed at this point is the prompt (PS1).

$ source mo.rc
...
=== Welcome to mOrc Shell ===
Run gethelp to see a list of commands.
/Users/mikey should be deleted upon exit.
\[\033]0;\007\]\u on \h in \w \n$    

Needs to be rewritten with the variables that Zsh recognises.