Ruby library for OpenVAS manager interface. This library is used for communication with OpenVAS over OMP interface. You can start, stop, pause and resume scan. Watch progress and status of scan, download report, etc.
This library cannot communicate directly with OpenVAS scanner, as scanner uses (soon to be obsolete) OTP protocol. If you need to communicate directly with OpenVAS scanner, take a look at the ovasotp-ruby library. Still note that this should be bad practice anyway.
require 'socket' require 'timeout' require 'openssl' require 'rexml/document' require 'rexml/text' require 'base64'
gem install openvas-omp
# require 'rubygems' # if using Ruby <1.9
require 'openvas-omp'
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) }
For full API/class documentation, visit rdoc documentation pages.
You can see more ruby examples on wiki.
git clone git://rubyforge.org/openvas-omp.git
For some ideas, take a look at the TODO on git
Feel free to contribute to the knowledge on wiki. Used wiki is UseModWiki and syntax is described here.