openvas-omp 0.0.2 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -4,6 +4,29 @@ This library is used for communication with OpenVAS manager over OMP
4
4
  You can start, stop, pause and resume scan. Watch progress and status of
5
5
  scan, download report, etc.
6
6
 
7
+ == Usage example
8
+
9
+ require 'openvas-omp'
10
+
11
+ ov=OpenVASOMP::OpenVASOMP.new("user"=>'openvas',"password"=>'openvas')
12
+ config=ov.config_get().index("Full and fast")
13
+ target=ov.target_create({"name"=>"t", "hosts"=>"127.0.0.1", "comment"=>"t"})
14
+ taskid=ov.task_create({"name"=>"t","comment"=>"t", "target"=>target, "config"=>config})
15
+ ov.task_start(taskid)
16
+ while not ov.task_finished(taskid) do
17
+ stat=ov.task_get_byid(taskid)
18
+ puts "Status: #{stat['status']}, Progress: #{stat['progress']}"
19
+ sleep 10
20
+ end
21
+ stat=ov.task_get_byid(taskid)
22
+ content=ov.report_get_byid(stat["lastreport"],'HTML')
23
+ File.open('report.html', 'w') {|f| f.write(content) }
24
+
25
+ == Note
26
+
27
+ Note that if you're using gem and Ruby 1.8, you should require 'rubygems' as
28
+ well.
29
+
7
30
  == Contributing to openvas-omp
8
31
 
9
32
  * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
data/TODO ADDED
@@ -0,0 +1,2 @@
1
+ * add not-so frequently used OMP functions
2
+
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.2
1
+ 0.0.4
@@ -0,0 +1,21 @@
1
+ #!/usr/bin/env ruby
2
+ # Basic example of openvas-omp usage
3
+
4
+ # in case you're using Ruby 1.8 and using gem, you should uncomment line below
5
+ # require 'rubygems'
6
+ require 'openvas-omp'
7
+
8
+ ov=OpenVASOMP::OpenVASOMP.new("user"=>'openvas',"password"=>'openvas')
9
+ config=ov.config_get().index("Full and fast")
10
+ target=ov.target_create({"name"=>"t", "hosts"=>"127.0.0.1", "comment"=>"t"})
11
+ taskid=ov.task_create({"name"=>"t","comment"=>"t", "target"=>target, "config"=>config})
12
+ ov.task_start(taskid)
13
+ while not ov.task_finished(taskid) do
14
+ stat=ov.task_get_byid(taskid)
15
+ puts "Status: #{stat['status']}, Progress: #{stat['progress']} %"
16
+ sleep 10
17
+ end
18
+ stat=ov.task_get_byid(taskid)
19
+ content=ov.report_get_byid(stat["lastreport"],'HTML')
20
+ File.open('report.html', 'w') {|f| f.write(content) }
21
+
@@ -20,6 +20,20 @@
20
20
  # == Usage:
21
21
  #
22
22
  # require 'openvas-omp'
23
+ #
24
+ # ov=OpenVASOMP::OpenVASOMP.new("user"=>'openvas',"password"=>'openvas')
25
+ # config=ov.config_get().index("Full and fast")
26
+ # target=ov.target_create({"name"=>"t", "hosts"=>"127.0.0.1", "comment"=>"t"})
27
+ # taskid=ov.task_create({"name"=>"t","comment"=>"t", "target"=>target, "config"=>config})
28
+ # ov.task_start(taskid)
29
+ # while not ov.task_finished(taskid) do
30
+ # stat=ov.task_get_byid(taskid)
31
+ # puts "Status: #{stat['status']}, Progress: #{stat['progress']} %"
32
+ # sleep 10
33
+ # end
34
+ # stat=ov.task_get_byid(taskid)
35
+ # content=ov.report_get_byid(stat["lastreport"],'HTML')
36
+ # File.open('report.html', 'w') {|f| f.write(content) }
23
37
 
24
38
  require 'socket'
25
39
  require 'timeout'
@@ -33,6 +47,8 @@ require 'base64'
33
47
  # Usage:
34
48
  #
35
49
  # require 'openvas-omp'
50
+ #
51
+ # ov=OpenVASOMP::OpenVASOMP.new("user"=>'openvas',"password"=>'openvas')
36
52
 
37
53
  module OpenVASOMP
38
54
 
@@ -65,14 +81,14 @@ module OpenVASOMP
65
81
  end
66
82
  end
67
83
 
68
- # Class which uses standard REXML to parse OpenVAS replies.
84
+ # Core class for OMP communication protocol
69
85
  class OpenVASOMP
70
86
  # initialize object: try to connect to OpenVAS using URL, user and password
71
87
  #
72
88
  # Usage:
73
89
  #
74
- # ov=OpenVASOMP.new(user=>'user',password=>'pass')
75
- # # default: host=>'localhost', port=>'9390'
90
+ # ov=OpenVASOMP.new(user=>'user',password=>'pass')
91
+ # # default: host=>'localhost', port=>'9390'
76
92
  #
77
93
  def initialize(p={})
78
94
  if p.has_key?("host")
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 2
9
- version: 0.0.2
8
+ - 4
9
+ version: 0.0.4
10
10
  platform: ruby
11
11
  authors:
12
12
  - Vlatko Kosturjak
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-12-30 00:00:00 +00:00
17
+ date: 2011-01-10 00:00:00 -08:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -86,13 +86,16 @@ extensions: []
86
86
  extra_rdoc_files:
87
87
  - LICENSE.txt
88
88
  - README.rdoc
89
+ - TODO
89
90
  files:
90
91
  - .document
91
92
  - Gemfile
92
93
  - LICENSE.txt
93
94
  - README.rdoc
94
95
  - Rakefile
96
+ - TODO
95
97
  - VERSION
98
+ - examples/basic-scan.rb
96
99
  - lib/openvas-omp.rb
97
100
  - test/helper.rb
98
101
  - test/test_openvas-omp.rb
@@ -110,7 +113,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
110
113
  requirements:
111
114
  - - ">="
112
115
  - !ruby/object:Gem::Version
113
- hash: -890019011
116
+ hash: -646625681
114
117
  segments:
115
118
  - 0
116
119
  version: "0"
@@ -130,5 +133,6 @@ signing_key:
130
133
  specification_version: 3
131
134
  summary: Communicate with OpenVAS manager through OMP
132
135
  test_files:
136
+ - examples/basic-scan.rb
133
137
  - test/helper.rb
134
138
  - test/test_openvas-omp.rb