Class: Qualys::Scans
- Inherits:
-
Base
- Object
- Base
- Qualys::Scans
show all
- Defined in:
- lib/qualys_api/scan.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_scan(scan_ref) ⇒ Object
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
# File 'lib/qualys_api/scan.rb', line 28
def get_scan(scan_ref)
raise ArgumentError if scan_ref.nil?
uri = '/api/2.0/fo/scan/'
params = {
action: 'fetch',
mode: 'extended',
output_format: 'json',
scan_ref: scan_ref
}
response = get(uri, params)
issues = JSON.parse(response.body)
if issues.class == Hash
return [Qualys::Issue.new(issues)]
elsif issues.class == Array
issues.map! do |issue|
Qualys::Issue.new(issue)
end
else
return []
end
end
|
#get_scans ⇒ Object
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
# File 'lib/qualys_api/scan.rb', line 3
def get_scans
uri = '/api/2.0/fo/scan/'
params = {
action: 'list',
}
response = get(uri, params)
unless response.body['SCAN_LIST_OUTPUT']['RESPONSE'].has_key? 'SCAN_LIST'
return []
end
scans = response.body['SCAN_LIST_OUTPUT']['RESPONSE']['SCAN_LIST']['SCAN']
if scans.class == Hash
return [Qualys::Scan.new(scans)]
elsif scans.class == Array
scans.map! do |scan|
Qualys::Scan.new(scan)
end
else
return []
end
end
|