Lucene search
K

Custom Payload

🗓️ 29 Jun 2011 01:26:24Reported by scriptjunkie <[email protected]>Type 
metasploit
 metasploit
🔗 www.rapid7.com👁 36 Views

This module allows the use of custom string or file as payload with options for payload file or string

Code
##
# This module requires Metasploit: https://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##


module MetasploitModule

  CachedSize = 0

  include Msf::Payload::Single
  include Msf::Payload::Generic

  def initialize(info = {})
    super(merge_info(info,
      'Name'          => 'Custom Payload',
      'Description'   => 'Use custom string or file as payload. Set either PAYLOADFILE or
                PAYLOADSTR.',
      'Author'        => 'scriptjunkie <scriptjunkie[at]scriptjunkie.us>',
      'License'       => MSF_LICENSE,
      'Payload'	    =>
        {
          'Payload' => "" # not really
        }
      ))

    # Register options
    register_options(
      [
        OptString.new('PAYLOADFILE', [ false, "The file to read the payload from" ] ),
        OptString.new('PAYLOADSTR', [ false, "The string to use as a payload" ] )
      ])
  end

  #
  # Construct the payload
  #
  def generate(_opts = {})
    if datastore['ARCH']
      self.arch = actual_arch
    end

    if datastore['PAYLOADSTR']
      datastore['PAYLOADSTR']
    elsif datastore['PAYLOADFILE']
      File.binread(datastore['PAYLOADFILE'])
    else
      ''
    end
  end

  # Only accept the "none" encoder
  def compatible_encoders
    encoders = super()
    encoders2 = []
    encoders.each do |encname, encmod|
      encoders2 << [encname, encmod] if encname.include? 'none'
    end

    return encoders2
  end
end

Data

Build on a solid foundation with Vulners data

We provide the essential building blocks for cybersecurity solutions with comprehensive, structured, and constantly updated vulnerability and exploits data

Api

Power your application with Vulners API

The Vulners REST API offers reliable, high-performance access to vulnerability intelligence, with 99.9% SLA uptime and CDN-backed data delivery for seamless global access

App

Assess and manage vulnerabilities with Vulners tools

Built on top of Vulners' database and SDK, end-user solutions give security professionals and developers lightweight and powerful tools for vulnerability remediation