I'm trying to connect to a nessus server using the library that nessus makes available .... however, there are several errors and warnings reported by the terminal:
from pynessus import Nessus
from pynessus.models.user import User
from pynessus.models.policy import Policy
server=Nessus("localhost", 8834)
[enter image description here][2]if server.login(User("username", "password")):
server.load_policies()
# display available policies
for policy in server.policies:
print ("%s - %s" % (policy.db_id, policy.name))
# creating a policy
p = server.Policy()
p.name = "My new policy"
if p.save():
print ("[+] Policy %s successfully created." % p.name)
else:
print ("[!] An error occured while creating policy %s" % p.name)
# updating a policy
p.description = "Let's set a description."
if p.save():
print ("[+] Policy %s successfully updated." % p.name)
else:
print ("[!] An error occured while updating policy %s" % p.name)
# downloading nessus xml policy description#
path = p.download()
if path is not None:
print ("[+] Policy %s successfully downloaded to %s." % (p.name, path))
else:
print ("[!] An error occured while downloading policy %s" % p.name)
# deleting a policy
if p.delete():
print ("[+] Policy %s successfully deleted." % p.name)
else:
print ("[!] An error occured while deleting policy %s" % p.name)
else:
print ("Fail!")