qualys 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +3 -2
  3. data/.rubocop.yml +7 -0
  4. data/.rubocop_todo.yml +71 -0
  5. data/.travis.yml +13 -1
  6. data/Gemfile +3 -1
  7. data/Gemfile.lock +91 -0
  8. data/README.md +50 -10
  9. data/Rakefile +3 -4
  10. data/lib/qualys.rb +10 -11
  11. data/lib/qualys/api.rb +38 -47
  12. data/lib/qualys/auth.rb +11 -20
  13. data/lib/qualys/compliance.rb +3 -7
  14. data/lib/qualys/config.rb +3 -5
  15. data/lib/qualys/host.rb +17 -0
  16. data/lib/qualys/report.rb +90 -0
  17. data/lib/qualys/scans.rb +10 -22
  18. data/lib/qualys/version.rb +1 -1
  19. data/lib/qualys/vulnerability.rb +74 -0
  20. data/qualys.gemspec +18 -19
  21. data/spec/fixtures/vcr_cassettes/api_get.yml +52 -0
  22. data/spec/fixtures/vcr_cassettes/create_global_report.yml +68 -0
  23. data/spec/fixtures/vcr_cassettes/emptyscans.yml +35 -0
  24. data/spec/fixtures/vcr_cassettes/get.yml +107 -0
  25. data/spec/fixtures/vcr_cassettes/global_report.yml +17800 -0
  26. data/spec/fixtures/vcr_cassettes/load_global_report.yml +625 -0
  27. data/spec/fixtures/vcr_cassettes/login.yml +50 -0
  28. data/spec/fixtures/vcr_cassettes/logout.yml +50 -0
  29. data/spec/fixtures/vcr_cassettes/scan.yml +73 -0
  30. data/spec/fixtures/vcr_cassettes/scans.yml +89 -0
  31. data/spec/fixtures/vcr_cassettes/templates.yml +121 -0
  32. data/spec/fixtures/vcr_cassettes/try_load_not_existing_report.yml +63 -0
  33. data/spec/fixtures/vcr_cassettes/unlogged.yml +45 -0
  34. data/spec/fixtures/vcr_cassettes/wrong.yml +101 -0
  35. data/spec/qualys/api_spec.rb +27 -0
  36. data/spec/qualys/report_spec.rb +65 -0
  37. data/spec/qualys/scans_spec.rb +75 -0
  38. data/spec/qualys/version_spec.rb +11 -0
  39. data/spec/qualys/vulnerability_spec.rb +53 -0
  40. data/spec/qualys_spec.rb +20 -0
  41. data/spec/spec_helper.rb +37 -0
  42. metadata +61 -15
  43. data/.rock.yml +0 -17
  44. data/lib/qualys/reports.rb +0 -47
data/.rock.yml DELETED
@@ -1,17 +0,0 @@
1
- runtime: ruby21
2
- build_gem: |
3
- rm -rf *.gem
4
- gem build qualys.gemspec
5
-
6
- push_gem: exec gem push *.gem
7
-
8
- gem: |
9
- rm -rf *.gem
10
- gem build qualys.gemspec
11
- gem push *.gem
12
-
13
- sublime: |
14
- rock run bin/test.rb
15
-
16
- todo: |
17
- find bin lib spec -type f -exec grep -Hni --color "todo" {} \; > TODO
@@ -1,47 +0,0 @@
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