Module: Nessus::Client::Policy

Included in:
Nessus::Client
Defined in:
lib/nessus/client/policy.rb

Overview

Author:

Policy Auxiliary Methods collapse

Instance Method Summary collapse

Instance Method Details

#policiesArray<Array<String>>

and their policy IDs

Returns:

  • (Array<Array<String>>)

    an object containing a list of policies



15
16
17
18
19
# File 'lib/nessus/client/policy.rb', line 15

def policies
  policy_list.map do |policy|
    [policy['policyname'], policy['policyid']]
  end
end

#policy_id_by_name(name) ⇒ String

Returns looks up policy ID by policy name.

Returns:

  • (String)

    looks up policy ID by policy name



22
23
24
25
26
# File 'lib/nessus/client/policy.rb', line 22

def policy_id_by_name(name)
  policy_list.find{|policy| policy['policyname'].eql? name}['policyid']
rescue
  nil
end

#policy_listObject

GET /policy/list



6
7
8
9
# File 'lib/nessus/client/policy.rb', line 6

def policy_list
  response = get '/policy/list'
  response['reply']['contents']['policies']['policy']
end

#policy_name_by_id(id) ⇒ String

Returns looks up policy name by policy ID.

Returns:

  • (String)

    looks up policy name by policy ID



29
30
31
32
33
# File 'lib/nessus/client/policy.rb', line 29

def policy_name_by_id(id)
  policy_list.find{|policy| policy['policyid'].eql? id}['policyname']
rescue
  nil
end