Class: Ronin::PostEx::Sessions::ReverseShell

Inherits:
RemoteShellSession show all
Defined in:
lib/ronin/post_ex/sessions/reverse_shell.rb

Overview

Session class for interacting with reverse shells.

Examples

session = Ronin::PostEx::Sessions::ReverseShell.listen(host,port)
system  = session.system

system.shell.ls('/')
# => "..."

Constant Summary

Constants inherited from ShellSession

ShellSession::DELIMINATOR

Instance Attribute Summary

Attributes inherited from ShellSession

#io

Class Method Summary collapse

Methods inherited from RemoteShellSession

#initialize

Methods inherited from ShellSession

#close, #command_exec, #command_join, #fs_chdir, #fs_chgrp, #fs_chmod, #fs_chown, #fs_copy, #fs_getcwd, #fs_glob, #fs_link, #fs_mkdir, #fs_mktemp, #fs_move, #fs_readdir, #fs_readfile, #fs_readlink, #fs_rmdir, #fs_stat, #fs_unlink, #initialize, #process_environ, #process_exit, #process_getenv, #process_getgid, #process_getpid, #process_getppid, #process_getuid, #process_kill, #process_setenv, #process_spawn, #process_unsetenv, #shell_exec, #shell_gets, #shell_puts, #sys_hostname, #sys_time

Methods inherited from Session

#close, #name, #system, #to_s

Constructor Details

This class inherits a constructor from Ronin::PostEx::Sessions::RemoteShellSession

Class Method Details

.listen(host = nil, port) ⇒ ReverseShell

Listens for and accepts a reverse shell connection.

Parameters:

  • host (String, nil) (defaults to: nil)

    The host to connect to.

  • port (Integer)

    The port to connect to.

Returns:



53
54
55
56
57
58
59
60
61
62
# File 'lib/ronin/post_ex/sessions/reverse_shell.rb', line 53

def self.listen(host=nil,port)
  server_socket = TCPServer.new(port,host)
  server_socket.listen(1)

  begin
    new(server_socket.accept)
  ensure
    server_socket.close
  end
end