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.
44 45 46 47 48 49 50 51 52 |
# File 'lib/ronin/payloads/mixins/reverse_shell.rb', line 44 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.
59 60 61 |
# File 'lib/ronin/payloads/mixins/reverse_shell.rb', line 59 def host params[:host] end |
#perform_cleanup ⇒ Object
Performs additional cleanup steps, then closes any connections and the server socket.
99 100 101 102 103 104 105 106 |
# File 'lib/ronin/payloads/mixins/reverse_shell.rb', line 99 def perform_cleanup super if @server @server.close @server = nil end end |
#perform_postlaunch ⇒ Object
87 88 89 90 91 92 93 |
# File 'lib/ronin/payloads/mixins/reverse_shell.rb', line 87 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
76 77 78 79 80 81 |
# File 'lib/ronin/payloads/mixins/reverse_shell.rb', line 76 def perform_prelaunch @server = TCPServer.new(host,port) @server.listen(1) super end |
#port ⇒ Integer
The port param value.
68 69 70 |
# File 'lib/ronin/payloads/mixins/reverse_shell.rb', line 68 def port params[:port] end |