Class: Rex::Proto::Http::Handler::Proc
- Inherits:
-
Rex::Proto::Http::Handler
- Object
- Rex::Proto::Http::Handler
- Rex::Proto::Http::Handler::Proc
- Defined in:
- lib/rex/proto/http/handler/proc.rb
Overview
This class is used to wrapper the calling of a procedure when a request arrives.
Instance Attribute Summary collapse
-
#procedure ⇒ Object
protected
:nodoc:.
-
#virt_dir ⇒ Object
protected
:nodoc:.
Attributes inherited from Rex::Proto::Http::Handler
Instance Method Summary collapse
-
#initialize(server, procedure, virt_dir = false) ⇒ Proc
constructor
Initializes the proc handler with the supplied procedure.
-
#on_request(cli, req) ⇒ Object
Called when a request arrives.
-
#relative_resource_required? ⇒ Boolean
Returns true if the procedure is representing a virtual directory.
Methods inherited from Rex::Proto::Http::Handler
Constructor Details
#initialize(server, procedure, virt_dir = false) ⇒ Proc
Initializes the proc handler with the supplied procedure
19 20 21 22 23 24 |
# File 'lib/rex/proto/http/handler/proc.rb', line 19 def initialize(server, procedure, virt_dir = false) super(server) self.procedure = procedure self.virt_dir = virt_dir || false end |
Instance Attribute Details
#procedure ⇒ Object (protected)
:nodoc:
54 55 56 |
# File 'lib/rex/proto/http/handler/proc.rb', line 54 def procedure @procedure end |
#virt_dir ⇒ Object (protected)
:nodoc:
55 56 57 |
# File 'lib/rex/proto/http/handler/proc.rb', line 55 def virt_dir @virt_dir end |
Instance Method Details
#on_request(cli, req) ⇒ Object
Called when a request arrives.
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/rex/proto/http/handler/proc.rb', line 36 def on_request(cli, req) begin procedure.call(cli, req) rescue Errno::EPIPE, ::Errno::ECONNRESET, ::Errno::ENOTCONN, ::Errno::ECONNABORTED => e elog('Proc::on_request: Client closed connection prematurely', LogSource, error: e) rescue => e elog('Proc::on_request', LogSource, error: e) if self.server and self.server.context exploit = self.server.context['MsfExploit'] if exploit exploit.print_error("Exception handling request: #{$!}") end end end end |
#relative_resource_required? ⇒ Boolean
Returns true if the procedure is representing a virtual directory.
29 30 31 |
# File 'lib/rex/proto/http/handler/proc.rb', line 29 def relative_resource_required? virt_dir end |