qualys 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +11 -0
- data/lib/qualys/compliance.rb +21 -0
- data/lib/qualys/reports.rb +47 -0
- data/lib/qualys/scans.rb +24 -6
- data/lib/qualys/version.rb +1 -1
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e957c9f5a99607890d0f0c19e0e0cf76518a8a71
|
4
|
+
data.tar.gz: 87dbbf0f630a150cc16d177c9c7a1e07e585fa24
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2cba8be57e2c3d8dcf4a40139baf178f09f7e084d3c3aa2b5a9ecb3ffe3c766f0e14229dfca580c605b4e821c96ed6a548a09c6905e55f69f080c118b801989b
|
7
|
+
data.tar.gz: ec85b2412fb86b9150b3d0f5e84c3dd6b11a2f6295fd88f1185c558d6a0825b21e71502b9b9af4082ab11be9e88c4deab9b2bf585cdd32e2fd08106e058dbb62
|
data/README.md
CHANGED
@@ -45,6 +45,17 @@ You can easily get a list of all scans within your Qualys account by accessing t
|
|
45
45
|
|
46
46
|
```ruby
|
47
47
|
scans = Qualys::Scans.all
|
48
|
+
#-> [#<Qualys::Scan:0x007fad4c4645c8 @ref="scan/refid", @title="Scan Title", @type="Scheduled", @date="2015-04-15T12:02:12Z", @duration="01:51:38", @status="Finished", @target="ip ranges", @user="managing_user">...
|
49
|
+
```
|
50
|
+
|
51
|
+
You can get more details from each scan like:
|
52
|
+
|
53
|
+
```ruby
|
54
|
+
scans = Qualys::Scans.all
|
55
|
+
puts scans.first.details
|
56
|
+
#-> {"ip"=>"x.x.x.x", "dns"=>"mikemackintosh.com", "netbios"=>nil, "qid"=>86000, "result"=>"Server Version\tServer Banner\nnginx\tnginx", "protocol"=>"tcp", "port"=>"80", "ssl"=>"no", "fqdn"=>""},
|
57
|
+
# {"ip"=>"x.x.x.x", "dns"=>"mikemackintosh.com", "netbios"=>nil, "qid"=>86189, "result"=>"Number of web servers behind load balancer:\n2 - based on IP Identification values", "protocol"=>"tcp", "port"=>"80", "ssl"=>"no", "fqdn"=>""},
|
58
|
+
# {"ip"=>"x.x.x.x, "dns"=>"mikemackintosh.com", "netbios"=>nil, "qid"=>86001, "result"=>"Server Version\tServer Banner\nnginx\tnginx", "protocol"=>"tcp", "port"=>"443", "ssl"=>"no", "fqdn"=>""}
|
48
59
|
```
|
49
60
|
|
50
61
|
## References
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module Qualys
|
2
|
+
class Compliance < Api
|
3
|
+
|
4
|
+
def self.all
|
5
|
+
response = api_get("compliance/control/", { :query => { :action => 'list' }} )
|
6
|
+
|
7
|
+
unless response.parsed_response['<COMPLIANCE_SCAN_RESULT_OUTPUT']['RESPONSE'].has_key? 'COMPLIANCE_SCAN'
|
8
|
+
return []
|
9
|
+
end
|
10
|
+
|
11
|
+
response.parsed_response['COMPLIANCE_SCAN_RESULT_OUTPUT']['RESPONSE']['COMPLIANCE_SCAN']
|
12
|
+
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.each
|
16
|
+
self.all
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
module Qualys
|
2
|
+
class Reports < Api
|
3
|
+
|
4
|
+
def self.all
|
5
|
+
response = api_get("report/", { :query => { :action => 'list' }} )
|
6
|
+
puts response.parsed_response.inspect
|
7
|
+
unless response.parsed_response['SCAN_LIST_OUTPUT']['RESPONSE'].has_key? 'SCAN_LIST'
|
8
|
+
return []
|
9
|
+
end
|
10
|
+
|
11
|
+
#scanlist = response.parsed_response['SCAN_LIST_OUTPUT']['RESPONSE']['SCAN_LIST']['SCAN']
|
12
|
+
#scanlist.map!{|scan| Scan.new(scan)}
|
13
|
+
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.each
|
17
|
+
self.all
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
|
22
|
+
class Report
|
23
|
+
|
24
|
+
attr_accessor :ref, :title, :type, :date, :duration, :status, :target, :user
|
25
|
+
|
26
|
+
def initialize(scan)
|
27
|
+
@ref = scan['REF']
|
28
|
+
@title = scan['TITLE']
|
29
|
+
@type = scan['TYPE']
|
30
|
+
@date = scan['LAUNCH_DATETIME']
|
31
|
+
@duration = scan['DURATION']
|
32
|
+
@status = scan['STATUS']['STATE']
|
33
|
+
@target = scan['TARGET']
|
34
|
+
@user = scan['USER_LOGIN']
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
38
|
+
|
39
|
+
def finished?
|
40
|
+
if @status.eql? 'Finished'
|
41
|
+
return true
|
42
|
+
end
|
43
|
+
|
44
|
+
false
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
data/lib/qualys/scans.rb
CHANGED
@@ -16,6 +16,18 @@ module Qualys
|
|
16
16
|
self.all
|
17
17
|
end
|
18
18
|
|
19
|
+
def self.get(ref)
|
20
|
+
response = api_get("scan/", {
|
21
|
+
:query => {
|
22
|
+
:action => 'fetch',
|
23
|
+
:scan_ref => ref,
|
24
|
+
:mode => 'extended',
|
25
|
+
:output_format => 'json'
|
26
|
+
}} )
|
27
|
+
|
28
|
+
JSON.parse(response.parsed_response)
|
29
|
+
end
|
30
|
+
|
19
31
|
end
|
20
32
|
|
21
33
|
class Scan
|
@@ -33,14 +45,20 @@ module Qualys
|
|
33
45
|
@user = scan['USER_LOGIN']
|
34
46
|
end
|
35
47
|
|
36
|
-
|
37
|
-
|
38
|
-
def finished?
|
39
|
-
if @status.eql? 'Finished'
|
40
|
-
return true
|
48
|
+
def details
|
49
|
+
Scans.get(@ref)
|
41
50
|
end
|
42
51
|
|
43
|
-
|
52
|
+
def finished?
|
53
|
+
if @status.eql? 'Finished'
|
54
|
+
return true
|
55
|
+
end
|
56
|
+
|
57
|
+
false
|
58
|
+
end
|
44
59
|
end
|
45
60
|
|
61
|
+
class Details
|
62
|
+
|
63
|
+
end
|
46
64
|
end
|
data/lib/qualys/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: qualys
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Mackintosh
|
@@ -154,7 +154,9 @@ files:
|
|
154
154
|
- lib/qualys.rb
|
155
155
|
- lib/qualys/api.rb
|
156
156
|
- lib/qualys/auth.rb
|
157
|
+
- lib/qualys/compliance.rb
|
157
158
|
- lib/qualys/config.rb
|
159
|
+
- lib/qualys/reports.rb
|
158
160
|
- lib/qualys/scans.rb
|
159
161
|
- lib/qualys/version.rb
|
160
162
|
- qualys.gemspec
|