@@ -222,7 +222,7 @@ def cmd_openvas_target_create(*args)
222
222
223
223
if args? ( args , 3 )
224
224
begin
225
- resp = @ov . target_create ( args [ 0 ] , args [ 1 ] , args [ 2 ] )
225
+ resp = @ov . target_create ( 'name' => args [ 0 ] , 'hosts' => args [ 1 ] , 'comment' => args [ 2 ] )
226
226
print_status ( resp )
227
227
cmd_openvas_target_list
228
228
rescue OpenVASOMP ::OMPError => e
@@ -279,7 +279,7 @@ def cmd_openvas_task_create(*args)
279
279
280
280
if args? ( args , 4 )
281
281
begin
282
- resp = @ov . task_create ( args [ 0 ] , args [ 1 ] , args [ 2 ] , args [ 3 ] )
282
+ resp = @ov . task_create ( 'name' => args [ 0 ] , 'comment' => args [ 1 ] , 'config' => args [ 2 ] , 'target' => args [ 3 ] )
283
283
print_status ( resp )
284
284
cmd_openvas_task_list
285
285
rescue OpenVASOMP ::OMPError => e
@@ -517,12 +517,14 @@ def cmd_openvas_report_download(*args)
517
517
518
518
if args? ( args , 4 )
519
519
begin
520
- report = @ov . report_get_by_id ( args [ 0 ] , args [ 1 ] )
520
+ report = @ov . report_get_raw ( "report_id" => args [ 0 ] , "format" => args [ 1 ] )
521
521
::FileUtils . mkdir_p ( args [ 2 ] )
522
522
name = ::File . join ( args [ 2 ] , args [ 3 ] )
523
523
print_status ( "Saving report to #{ name } " )
524
524
output = ::File . new ( name , "w" )
525
- output . puts ( report )
525
+ data = nil
526
+ report . elements . each ( "//get_reports_response" ) { |r | data = r . to_s }
527
+ output . puts ( data )
526
528
output . close
527
529
rescue OpenVASOMP ::OMPError => e
528
530
print_error ( e . to_s )
@@ -537,9 +539,11 @@ def cmd_openvas_report_import(*args)
537
539
538
540
if args? ( args , 2 )
539
541
begin
540
- report = @ov . report_get_by_id ( args [ 0 ] , args [ 1 ] )
542
+ report = @ov . report_get_raw ( "report_id" => args [ 0 ] , "format" => args [ 1 ] )
543
+ data = nil
544
+ report . elements . each ( "//get_reports_response" ) { |r | data = r . to_s }
541
545
print_status ( "Importing report to database." )
542
- framework . db . import ( { :data => report } )
546
+ framework . db . import ( { :data => data } )
543
547
rescue OpenVASOMP ::OMPError => e
544
548
print_error ( e . to_s )
545
549
end
0 commit comments