Class: BetterCap::Firewalls::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/bettercap/firewalls/base.rb

Overview

Base class for BetterCap::Firewalls objects.

Direct Known Subclasses

Linux, OSX

Instance Method Summary collapse

Constructor Details

#initializeBase

Initialize the firewall object. Raise NotImplementedError


18
19
20
# File 'lib/bettercap/firewalls/base.rb', line 18

def initialize
  @frwd_initial_state = forwarding_enabled?
end

Instance Method Details

#add_port_redirection(r) ⇒ Object

Apply the r BetterCap::Firewalls::Redirection port redirection object. Raise NotImplementedError


51
52
53
# File 'lib/bettercap/firewalls/base.rb', line 51

def add_port_redirection( r )
  not_implemented_method!
end

#del_port_redirection(r) ⇒ Object

Remove the r BetterCap::Firewalls::Redirection port redirection object. Raise NotImplementedError


57
58
59
# File 'lib/bettercap/firewalls/base.rb', line 57

def del_port_redirection( r )
  not_implemented_method!
end

#enable_forwarding(enabled) ⇒ Object

If enabled is true will enable packet forwarding, otherwise it will disable it. Raise NotImplementedError


25
26
27
# File 'lib/bettercap/firewalls/base.rb', line 25

def enable_forwarding(enabled)
  not_implemented_method!
end

#enable_icmp_bcast(enabled) ⇒ Object

If enabled is true will enable icmp_echo_ignore_broadcasts, otherwise it will disable it. Raise NotImplementedError


32
33
34
# File 'lib/bettercap/firewalls/base.rb', line 32

def enable_icmp_bcast(enabled)
  not_implemented_method!
end

#enable_send_redirects(enabled) ⇒ Object

If enabled is true will enable send_redirects, otherwise it will disable it. Raise NotImplementedError


39
40
41
# File 'lib/bettercap/firewalls/base.rb', line 39

def enable_send_redirects(enabled)
  not_implemented_method!
end

#forwarding_enabled?Boolean

Return true if packet forwarding is currently enabled, otherwise false. Raise NotImplementedError

Returns:

  • (Boolean)

45
46
47
# File 'lib/bettercap/firewalls/base.rb', line 45

def forwarding_enabled?
  not_implemented_method!
end

#restoreObject

Restore the system's original packet forwarding state. Raise NotImplementedError


63
64
65
66
67
# File 'lib/bettercap/firewalls/base.rb', line 63

def restore
  if forwarding_enabled? != @frwd_initial_state
    enable_forwarding @frwd_initial_state
  end
end