Class: Spior::Iptables::Root

Inherits:
Object
  • Object
show all
Defined in:
lib/spior/iptables/root.rb

Overview

Base class for iptables

Direct Known Subclasses

Default, Tor

Instance Method Summary collapse

Constructor Details

#initializeRoot

Returns a new instance of Root.



9
10
11
12
13
14
# File 'lib/spior/iptables/root.rb', line 9

def initialize
  @lo      = Interfacez.loopback
  @lo_addr = Interfacez.ipv4_address_of(@lo)
  @i = Helpers::Exec.new('iptables')
  @debug = false
end

Instance Method Details

#run!Object



16
17
18
19
20
21
22
23
24
25
# File 'lib/spior/iptables/root.rb', line 16

def run!
  stop!
  bogus_tcp_flags
  bad_packets
  spoofing
  redirect
  input
  output
  all
end

#stop!Object



27
28
29
30
31
32
33
34
35
# File 'lib/spior/iptables/root.rb', line 27

def stop!
  Msg.p 'Clearing Iptables rules...'
  ipt '-F'
  ipt '-X'
  ipt '-t nat -F'
  ipt '-t nat -X'
  ipt '-t mangle -F'
  ipt '-t mangle -X'
end