Jump to content


 


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.


Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

Photo

Create tasks in Python with openvas.omplib


  • Please log in to reply
4 replies to this topic

#1 foxraindinh

foxraindinh

  • Members
  • 3 posts
  • OFFLINE
  •  
  • Local time:01:08 PM

Posted 17 June 2014 - 03:07 PM

Hi everyone, I'm doing a project with openvas and i get a problem. When I want to used python with the library omplib to create task and send it to OMP, but it always have error that can get target ID. Who can help me ?



BC AdBot (Login to Remove)

 


m

#2 neilbuddy

neilbuddy

  • Members
  • 42 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Rochester MN
  • Local time:01:08 AM

Posted 17 June 2014 - 03:59 PM

What is the exact error message you see when running it?



#3 foxraindinh

foxraindinh
  • Topic Starter

  • Members
  • 3 posts
  • OFFLINE
  •  
  • Local time:01:08 PM

Posted 18 June 2014 - 08:29 AM

My idea is I want to use python to manage openvas, so I used the openvas.omplib library to interac with OMP of openvas. But the problem here is when i create a task to scan, I don't now how to do it because in function create_task in __ini__.py in omp lib it request a id of target but I don't now how to get that target_id to send to that function. I used function get_targets() but it returned for me Generator object. Do you have any idea ?

This is mycode:

"import openvas

from openvas import omplib
from xml.etree import ElementTree as etree
 
username = 'admin'
password = '123'
host = '192.168.181.129'
target = '210.245.80.191'
job_name = 'testip'
tasks = ''
manager = openvas.omplib.OMPClient(host)
manager.open(username, password)
#manager.create_target(job_name, target)
print manager.get_targets()



#4 neilbuddy

neilbuddy

  • Members
  • 42 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Rochester MN
  • Local time:01:08 AM

Posted 18 June 2014 - 10:09 AM

I looked at the openvas.omplib module and it looks like the create_target should return the name of the target.  Try to pass this into the create_task function.  



#5 foxraindinh

foxraindinh
  • Topic Starter

  • Members
  • 3 posts
  • OFFLINE
  •  
  • Local time:01:08 PM

Posted 18 June 2014 - 10:13 PM

I tried but when i print it to screen it show me 'none'. I think I'll try rebuld the __init__ function in omplib because I want to send a XML file to that function to create a target and task. Do you know how to send a XML file from a computer over a computer in network ?






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users