Class: BetterCap::ServerOptions
- Inherits:
-
Object
- Object
- BetterCap::ServerOptions
- Defined in:
- lib/bettercap/options/server_options.rb
Instance Attribute Summary collapse
-
#dnsd ⇒ Object
If true, BetterCap::Network::Servers::DNSD will be enabled.
-
#dnsd_file ⇒ Object
The host resolution file to use with the DNS server.
-
#dnsd_port ⇒ Object
The port to bind DNS server to.
-
#httpd ⇒ Object
If true, BetterCap::Network::Servers::HTTPD will be enabled.
-
#httpd_path ⇒ Object
Web root of the HTTP server.
-
#httpd_port ⇒ Object
The port to bind HTTP server to.
Instance Method Summary collapse
-
#initialize ⇒ ServerOptions
constructor
A new instance of ServerOptions.
- #parse!(ctx, opts) ⇒ Object
Constructor Details
#initialize ⇒ ServerOptions
Returns a new instance of ServerOptions.
30 31 32 33 34 35 36 37 |
# File 'lib/bettercap/options/server_options.rb', line 30 def initialize @httpd = false @httpd_port = 8081 @httpd_path = './' @dnsd = false @dnsd_port = 5300 @dnsd_file = nil end |
Instance Attribute Details
#dnsd ⇒ Object
If true, BetterCap::Network::Servers::DNSD will be enabled.
24 25 26 |
# File 'lib/bettercap/options/server_options.rb', line 24 def dnsd @dnsd end |
#dnsd_file ⇒ Object
The host resolution file to use with the DNS server.
28 29 30 |
# File 'lib/bettercap/options/server_options.rb', line 28 def dnsd_file @dnsd_file end |
#dnsd_port ⇒ Object
The port to bind DNS server to.
26 27 28 |
# File 'lib/bettercap/options/server_options.rb', line 26 def dnsd_port @dnsd_port end |
#httpd ⇒ Object
If true, BetterCap::Network::Servers::HTTPD will be enabled.
18 19 20 |
# File 'lib/bettercap/options/server_options.rb', line 18 def httpd @httpd end |
#httpd_path ⇒ Object
Web root of the HTTP server.
22 23 24 |
# File 'lib/bettercap/options/server_options.rb', line 22 def httpd_path @httpd_path end |
#httpd_port ⇒ Object
The port to bind HTTP server to.
20 21 22 |
# File 'lib/bettercap/options/server_options.rb', line 20 def httpd_port @httpd_port end |
Instance Method Details
#parse!(ctx, opts) ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/bettercap/options/server_options.rb', line 39 def parse!( ctx, opts ) opts.separator "" opts.separator "SERVERS:".bold opts.separator "" opts.on( '--httpd', "Enable HTTP server, default to #{'false'.yellow}." ) do @httpd = true end opts.on( '--httpd-port PORT', "Set HTTP server port, default to #{@httpd_port.to_s.yellow}." ) do |v| @httpd = true @httpd_port = v.to_i end opts.on( '--httpd-path PATH', "Set HTTP server path, default to #{@httpd_path.yellow} ." ) do |v| @httpd = true @httpd_path = v end opts.on( '--dns FILE', 'Enable DNS server and use this file as a hosts resolution table.' ) do |v| @dnsd = true @dnsd_file = File. v end opts.on( '--dns-port PORT', "Set DNS server port, default to #{@dnsd_port.to_s.yellow}." ) do |v| @dnsd_port = v.to_i end end |