Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ doc
# jeweler generated
pkg

.idea
examples/reports


# Have editor/IDE/OS specific files you need to ignore? Consider using a global gitignore:
#
# * Create a file at ~/.gitignore
Expand Down
9 changes: 5 additions & 4 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ source "http://rubygems.org"

# Add dependencies to develop your gem here.
# Include everything needed to run rake, tests, features, etc.

group :development do
gem "shoulda", ">= 0"
gem "bundler", "~> 1.0.0"
gem "jeweler", "~> 1.5.2"
gem "rcov", ">= 0"
gem "shoulda"
gem "bundler"
gem "jeweler"
gem "simplecov"
end
80 changes: 80 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
GEM
remote: http://rubygems.org/
specs:
activesupport (4.1.0)
i18n (~> 0.6, >= 0.6.9)
json (~> 1.7, >= 1.7.7)
minitest (~> 5.1)
thread_safe (~> 0.1)
tzinfo (~> 1.1)
addressable (2.3.6)
builder (3.2.2)
descendants_tracker (0.0.4)
thread_safe (~> 0.3, >= 0.3.1)
docile (1.1.3)
faraday (0.9.0)
multipart-post (>= 1.2, < 3)
git (1.2.6)
github_api (0.11.3)
addressable (~> 2.3)
descendants_tracker (~> 0.0.1)
faraday (~> 0.8, < 0.10)
hashie (>= 1.2)
multi_json (>= 1.7.5, < 2.0)
nokogiri (~> 1.6.0)
oauth2
hashie (2.1.1)
highline (1.6.21)
i18n (0.6.9)
jeweler (2.0.1)
builder
bundler (>= 1.0)
git (>= 1.2.5)
github_api
highline (>= 1.6.15)
nokogiri (>= 1.5.10)
rake
rdoc
json (1.8.1)
jwt (0.1.11)
multi_json (>= 1.5)
mini_portile (0.5.3)
minitest (5.3.3)
multi_json (1.9.2)
multi_xml (0.5.5)
multipart-post (2.0.0)
nokogiri (1.6.1)
mini_portile (~> 0.5.0)
oauth2 (0.9.3)
faraday (>= 0.8, < 0.10)
jwt (~> 0.1.8)
multi_json (~> 1.3)
multi_xml (~> 0.5)
rack (~> 1.2)
rack (1.5.2)
rake (10.3.1)
rdoc (4.1.1)
json (~> 1.4)
shoulda (3.5.0)
shoulda-context (~> 1.0, >= 1.0.1)
shoulda-matchers (>= 1.4.1, < 3.0)
shoulda-context (1.2.1)
shoulda-matchers (2.6.0)
activesupport (>= 3.0.0)
simplecov (0.8.2)
docile (~> 1.1.0)
multi_json
simplecov-html (~> 0.8.0)
simplecov-html (0.8.0)
thread_safe (0.3.3)
tzinfo (1.1.0)
thread_safe (~> 0.1)

PLATFORMS
ruby

DEPENDENCIES
bundler
jeweler
shoulda
simplecov
4 changes: 4 additions & 0 deletions LICENSE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,7 @@ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


The header says MIT, this is different than MIT...
investigate my options. I prefer MIT.
27 changes: 17 additions & 10 deletions examples/basic-scan.rb
Original file line number Diff line number Diff line change
@@ -1,21 +1,28 @@
#!/usr/bin/env ruby
# Basic example of openvas-omp usage

# in case you're using Ruby 1.8 and using gem, you should uncomment line below
# require 'rubygems'
require 'openvas-omp'
require_relative '../lib/openvas-omp'
require_relative "./common"

ov = OpenVASOMP::OpenVASOMP.new(:user=>USER, :password =>PASS, :host =>HOST, :debug=>0)

config = ov.config_get().key("Full and fast")
puts "Config: #{config}"

target = ov.target_create({"name"=>"t2", "hosts"=>"127.0.0.1", "comment"=>"t"})
puts "Target: #{target}"

taskid = ov.task_create({"name"=>"t2","comment"=>"t", "target"=>target, "config"=>config})
puts "Taskid: #{taskid}"

ov=OpenVASOMP::OpenVASOMP.new("user"=>'openvas',"password"=>'openvas')
config=ov.config_get().index("Full and fast")
target=ov.target_create({"name"=>"t", "hosts"=>"127.0.0.1", "comment"=>"t"})
taskid=ov.task_create({"name"=>"t","comment"=>"t", "target"=>target, "config"=>config})
ov.task_start(taskid)
while not ov.task_finished(taskid) do
stat=ov.task_get_byid(taskid)
puts "Status: #{stat['status']}, Progress: #{stat['progress']} %"
sleep 10
end
stat=ov.task_get_byid(taskid)
content=ov.report_get_byid(stat["lastreport"],'HTML')
File.open('report.html', 'w') {|f| f.write(content) }

# this is broken in version 4
# content=ov.report_get_byid(stat["lastreport"],'HTML')
# File.open('report.html', 'w') {|f| f.write(content) }

5 changes: 5 additions & 0 deletions examples/common.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# store access info for testing

USER = 'tester'
PASS = 'tester'
HOST = '192.168.101.115'
61 changes: 61 additions & 0 deletions examples/list_stuff.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
#!/usr/bin/env ruby

# added by jkl to test access

require_relative '../lib/openvas-omp'
require_relative "./common"

ov = OpenVASOMP::OpenVASOMP.new( :user =>USER, :password =>PASS, :host =>HOST, :debug =>0)

puts "Openvas Version #{ov.version_get}"

targets = ov.target_get_all
puts "\nTargets:"
targets.each { |k,v| puts "#{k} => #{v}"}

tasks = ov.task_get_all
puts "\nTasks"
puts tasks

configs = ov.config_get_all
puts "\nConfigs"
puts configs



formats = ov.format_get_all
puts "\nFormats"
puts formats

x = 'HTML'
puts "\nID for #{x} is #{ov.format_get_by_name(x)}"
x = 'NBE'
puts "\nID for #{x} is #{ov.format_get_by_name(x)}"


reports = ov.report_get_all
puts "\nReports"
puts reports

x = (reports.first)['id']

content=ov.report_get_byid(x,'HTML')
File.open('reports/report.html', 'w') {|f| f.write(content) }

content=ov.report_get_byid(x,'XML')
File.open('reports/report.xml', 'w') {|f| f.write(content) }

content=ov.report_get_byid(x,'ARF')
File.open('reports/report_arf.xml', 'w') {|f| f.write(content) }

content=ov.report_get_byid(x,'CPE')
File.open('reports/report_cpe.csv','w') {|f| f.write(content) }

content=ov.report_get_byid(x,'NBE')
File.open('reports/report_nbe.txt','w') {|f| f.write(content) }

content=ov.report_get_byid(x,'TXT')
File.open('reports/report_txt.txt','w') {|f| f.write(content) }

content=ov.report_get_byid(x,'LaTeX')
File.open('reports/report.tex','w') {|f| f.write(content) }
Loading