Class: ForemanProbing::Scan

Inherits:
ActiveRecord::Base
  • Object
show all
Includes:
Taxonomix
Defined in:
app/models/foreman_probing/scan.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#directObject

Returns the value of attribute direct.



17
18
19
# File 'app/models/foreman_probing/scan.rb', line 17

def direct
  @direct
end

#search_queryObject

Returns the value of attribute search_query.



17
18
19
# File 'app/models/foreman_probing/scan.rb', line 17

def search_query
  @search_query
end

#subnet_idObject

Returns the value of attribute subnet_id.



17
18
19
# File 'app/models/foreman_probing/scan.rb', line 17

def subnet_id
  @subnet_id
end

#target_kindObject

Returns the value of attribute target_kind.



17
18
19
# File 'app/models/foreman_probing/scan.rb', line 17

def target_kind
  @target_kind
end

Instance Method Details

#available_scan_typesObject



33
34
35
# File 'app/models/foreman_probing/scan.rb', line 33

def available_scan_types
  ['TCP', 'UDP', 'ICMP']
end

#portsObject



19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'app/models/foreman_probing/scan.rb', line 19

def ports
  if @ports.nil?
    return [] if raw_ports.nil?
    ranges = raw_ports.split(',')
    ports = ranges.map do |range|
      range.split('-').map do |from, to|
        to.nil? ? from : (from..to).entries
      end
    end
    @ports = ports.flatten.map(&:chomp).map(&:to_i)
  end
  @ports
end

#target_kindsObject



37
38
39
# File 'app/models/foreman_probing/scan.rb', line 37

def target_kinds
  ['Direct', 'Subnet', 'Host', 'Proxy']
end