Class: Waps

Inherits:
Object
  • Object
show all
Defined in:
lib/waps.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(interface_name = '') ⇒ Waps



10
11
12
13
# File 'lib/waps.rb', line 10

def initialize(interface_name = '')
  @interface_name = interface_name
  @output = []
end

Instance Attribute Details

#outputObject (readonly)

Returns the value of attribute output.



7
8
9
# File 'lib/waps.rb', line 7

def output
  @output
end

Instance Method Details

#get(find) ⇒ Object



34
35
36
37
38
# File 'lib/waps.rb', line 34

def get(find)
  if (@output[0].keys.include? find.to_sym) && !@output.empty? 
    return @output.map { |cell| cell[find.to_sym] }
  end
end

#scanObject



15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/waps.rb', line 15

def scan
  if RUBY_PLATFORM =~ /win32/
    return {error: "Not support for windows. Coming Soon."}
  elsif RUBY_PLATFORM =~ /linux/
    new_scan = Waps_linux.new(@interface_name)
    return @output = new_scan.scan
  elsif RUBY_PLATFORM =~ /darwin/
    new_scan = Waps_mac.new
    return @output = new_scan.scan
  else
    return {error: "No support for this OS."}
  end
end