Module: Ronin::Payloads::Mixins::ReverseShell
- Includes:
- PostEx
- Included in:
- Bin::UNIX::ReverseShell, Bin::Windows::ReverseShell, CMD::Awk::ReverseShell, CMD::Bash::ReverseShell, CMD::Lua::ReverseShell, CMD::Node::ReverseShell, CMD::OpenSSL::ReverseShell, CMD::PHP::ReverseShell, CMD::Perl::ReverseShell, CMD::PowerShell::ReverseShell, CMD::Python::ReverseShell, CMD::Ruby::ReverseShell, CMD::Zsh::ReverseShell, Groovy::ReverseShell, JS::Nashorn::ReverseShell, JS::Node::ReverseShell, Java::ReverseShell, Shellcode::ReverseShellPayload
- Defined in:
- lib/ronin/payloads/mixins/reverse_shell.rb
Overview
Common params and methods for reverse shell payloads.
Instance Attribute Summary
Attributes included from PostEx
Class Method Summary collapse
-
.included(payload) ⇒ Object
private
Adds the
host
andport
required options to the payload.
Instance Method Summary collapse
-
#host ⇒ String
The host param value.
-
#perform_cleanup ⇒ Object
Performs additional cleanup steps, then closes any connections and the server socket.
- #perform_postlaunch ⇒ Object
- #perform_prelaunch ⇒ Object
-
#port ⇒ Integer
The port param value.
Class Method Details
.included(payload) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Adds the host
and port
required options to the payload.
45 46 47 48 49 50 51 52 53 |
# File 'lib/ronin/payloads/mixins/reverse_shell.rb', line 45 def self.included(payload) payload.param :host, String, required: true, default: '0.0.0.0', desc: 'The host to connect back to' payload.param :port, Integer, required: true, default: 4444, desc: 'The port to connect back to' end |
Instance Method Details
#host ⇒ String
The host param value.
60 61 62 |
# File 'lib/ronin/payloads/mixins/reverse_shell.rb', line 60 def host params[:host] end |
#perform_cleanup ⇒ Object
Performs additional cleanup steps, then closes any connections and the server socket.
100 101 102 103 104 105 106 107 |
# File 'lib/ronin/payloads/mixins/reverse_shell.rb', line 100 def perform_cleanup super if @server @server.close @server = nil end end |
#perform_postlaunch ⇒ Object
88 89 90 91 92 93 94 |
# File 'lib/ronin/payloads/mixins/reverse_shell.rb', line 88 def perform_postlaunch print_info "Waiting for connection on #{host}:#{port} ..." @session = Ronin::PostEx::Sessions::ReverseShell.new(@server.accept) print_info "Accepted connection from #{@session.name}!" super end |
#perform_prelaunch ⇒ Object
77 78 79 80 81 82 |
# File 'lib/ronin/payloads/mixins/reverse_shell.rb', line 77 def perform_prelaunch @server = TCPServer.new(host,port) @server.listen(1) super end |
#port ⇒ Integer
The port param value.
69 70 71 |
# File 'lib/ronin/payloads/mixins/reverse_shell.rb', line 69 def port params[:port] end |