Class: Qualys::KnowledgeBase
- Inherits:
-
Base
- Object
- Base
- Qualys::KnowledgeBase
show all
- Defined in:
- lib/qualys_api/knowledge.rb
Constant Summary
Constants inherited
from Base
Base::PLATFORMS
Instance Method Summary
collapse
Methods inherited from Base
#get, #initialize, #post
Constructor Details
This class inherits a constructor from Qualys::Base
Instance Method Details
#get_all ⇒ Object
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
# File 'lib/qualys_api/knowledge.rb', line 4
def get_all
uri = '/api/2.0/fo/knowledge_base/vuln/'
params = {
action: 'list',
details: 'All'
}
response = get(uri, params)
unless response.body['KNOWLEDGE_BASE_VULN_LIST_OUTPUT']['RESPONSE'].has_key? 'VULN_LIST'
return []
end
kb = response.body['KNOWLEDGE_BASE_VULN_LIST_OUTPUT']['RESPONSE']['VULN_LIST']['VULN']
if kb.class == Hash
return [Qualys::Knowledge.new(kb)]
elsif kb.class == Array
kb.map! do |qid|
Qualys::Knowledge.new(qid)
end
else
return []
end
end
|
#get_qid(qids) ⇒ Object
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
# File 'lib/qualys_api/knowledge.rb', line 57
def get_qid(qids)
raise ArgumentError if qids.nil?
uri = '/api/2.0/fo/knowledge_base/vuln/'
params = {
action: 'list',
details: 'All',
ids: qids
}
response = get(uri, params)
unless response.body['KNOWLEDGE_BASE_VULN_LIST_OUTPUT']['RESPONSE'].has_key? 'VULN_LIST'
return []
end
kb = response.body['KNOWLEDGE_BASE_VULN_LIST_OUTPUT']['RESPONSE']['VULN_LIST']['VULN']
if kb.class == Hash
return [Qualys::Knowledge.new(kb)]
elsif kb.class == Array
kb.map! do |qid|
Qualys::Knowledge.new(qid)
end
else
return []
end
end
|
#get_since(last_modified) ⇒ Object
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
# File 'lib/qualys_api/knowledge.rb', line 30
def get_since(last_modified)
uri = '/api/2.0/fo/knowledge_base/vuln/'
params = {
action: 'list',
details: 'All',
last_modified_after: last_modified.strftime("%Y-%m-%d")
}
response = get(uri, params)
unless response.body['KNOWLEDGE_BASE_VULN_LIST_OUTPUT']['RESPONSE'].has_key? 'VULN_LIST'
return []
end
kb = response.body['KNOWLEDGE_BASE_VULN_LIST_OUTPUT']['RESPONSE']['VULN_LIST']['VULN']
if kb.class == Hash
return [Qualys::Knowledge.new(kb)]
elsif kb.class == Array
kb.map! do |qid|
Qualys::Knowledge.new(qid)
end
else
return []
end
end
|