Class: BetterCap::Proxy::TCP::Module
- Inherits:
-
BetterCap::Pluggable
- Object
- BetterCap::Pluggable
- BetterCap::Proxy::TCP::Module
- Defined in:
- lib/bettercap/proxy/tcp/module.rb
Overview
Constant Summary collapse
- @@loaded =
Loaded modules.
{}
Class Method Summary collapse
-
.dispatch(event_name, event) ⇒ Object
Execute method
even_name
for each loaded module instance usingevent
as its argument. -
.inherited(subclass) ⇒ Object
Called when a class inherits this base class.
-
.load(file) ⇒ Object
Load
file
as a proxy module.
Instance Method Summary collapse
-
#on_data(event) ⇒ Object
This callback is called when the target is sending data to the upstream server.
-
#on_finish(event) ⇒ Object
This callback is called when the connection is terminated.
-
#on_response(event) ⇒ Object
This callback is called when the upstream server is sending data to the target.
Methods inherited from BetterCap::Pluggable
Class Method Details
.dispatch(event_name, event) ⇒ Object
Execute method even_name
for each loaded module instance using event
as its argument.
65 66 67 68 69 |
# File 'lib/bettercap/proxy/tcp/module.rb', line 65 def dispatch( event_name, event ) @@loaded.each do |name,mod| mod.send( event_name, event ) end end |
.inherited(subclass) ⇒ Object
Called when a class inherits this base class.
45 46 47 48 |
# File 'lib/bettercap/proxy/tcp/module.rb', line 45 def inherited(subclass) name = subclass.name.upcase @@loaded[name] = subclass end |
.load(file) ⇒ Object
Load file
as a proxy module.
51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/bettercap/proxy/tcp/module.rb', line 51 def load( file ) begin require file rescue LoadError => e raise BetterCap::Error, "Invalid TCP proxy module specified: #{e.}" end @@loaded.each do |name,mod| @@loaded[name] = mod.new end end |
Instance Method Details
#on_data(event) ⇒ Object
This callback is called when the target is sending data to the upstream server. event
is an instance of the BetterCap::Proxy::TCP::Event class.
32 |
# File 'lib/bettercap/proxy/tcp/module.rb', line 32 def on_data( event ); end |
#on_finish(event) ⇒ Object
This callback is called when the connection is terminated. event
is an instance of the BetterCap::Proxy::TCP::Event class.
38 |
# File 'lib/bettercap/proxy/tcp/module.rb', line 38 def on_finish( event ); end |
#on_response(event) ⇒ Object
This callback is called when the upstream server is sending data to the target. event
is an instance of the BetterCap::Proxy::TCP::Event class.
35 |
# File 'lib/bettercap/proxy/tcp/module.rb', line 35 def on_response( event ); end |