Lucene search
K

Generic Payload Handler

🗓️ 22 Jun 2010 19:11:05Reported by hdm <[email protected]>, bcook-r7Type 
metasploit
 metasploit
🔗 www.rapid7.com👁 21 Views

Generic Payload Handler module provides Metasploit payload system features to exploits launched outside the framewor

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

class MetasploitModule < Msf::Exploit::Remote
  Rank = ManualRanking

  #
  # This module does basically nothing
  # NOTE: Because of this it's missing a disclosure date that makes msftidy angry.
  #

  def initialize(info = {})
    super(
      update_info(
        info,
        'Name'           => 'Generic Payload Handler',
        'Description'    => %q(
          This module is a stub that provides all of the
          features of the Metasploit payload system to exploits
          that have been launched outside of the framework.
        ),
        'License'        => MSF_LICENSE,
        'Author'         =>  [ 'hdm', 'bcook-r7' ],
        'References'     =>  [ ],
        'Payload'        =>
          {
            'Space'       => 10000000,
            'BadChars'    => '',
            'DisableNops' => true
          },
        'Platform'       => %w[android apple_ios bsd java js linux osx nodejs php python ruby solaris unix win mainframe multi],
        'Arch'           => ARCH_ALL,
        'Targets'        => [ [ 'Wildcard Target', {} ] ],
        'DefaultTarget'  => 0,
        'DefaultOptions' => { 'PAYLOAD' => 'generic/shell_reverse_tcp' }
      )
    )

    register_advanced_options(
      [
        OptBool.new(
          "ExitOnSession",
          [ true, "Return from the exploit after a session has been created", true ]
        ),
        OptInt.new(
          "ListenerTimeout",
          [ false, "The maximum number of seconds to wait for new sessions", 0 ]
        )
      ]
    )
  end

  def exploit
    if datastore['DisablePayloadHandler']
      print_error "DisablePayloadHandler is enabled, so there is nothing to do. Exiting!"
      return
    end

    stime = Time.now.to_f
    timeout = datastore['ListenerTimeout'].to_i
    loop do
      break if session_created? && datastore['ExitOnSession']
      break if timeout > 0 && (stime + timeout < Time.now.to_f)
      Rex::ThreadSafe.sleep(1)
    end
  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