class Amnesie::Persist::WpaSupplicant

Public Class Methods

new() click to toggle source
# File lib/amnesie/persist/wpa_supplicant.rb, line 7
def initialize
  @cards = Network.new(/wl^/, nil).search
  @tmp = Tempfile.new("main.conf")
  apply_cards
end

Public Instance Methods

apply_cards() click to toggle source
# File lib/amnesie/persist/wpa_supplicant.rb, line 13
def apply_cards
  @cards.each { |card|
    apply(card)
  }
end

Private Instance Methods

apply(card) click to toggle source
# File lib/amnesie/persist/wpa_supplicant.rb, line 21
def apply(card)
  file = "/etc/wpa_supplicant/wpa_supplicant-#{card}.conf"
  if ! File.exist? file ||
      ! grep?(file, /gas_rand_mac/)
    puts "Add #{file}"
    Nito::Cat.new(file, wpa_conf)
  else
    puts "MAC random on wpa_supplicant seem enable."
  end
end
wpa_conf() click to toggle source
# File lib/amnesie/persist/wpa_supplicant.rb, line 32
      def wpa_conf
        <<EOF
mac_addr=1
preassoc_mac_addr=1
gas_rand_mac_addr=1
EOF
      end