From 0ddb13e85d38f64a62e3f1b3471c90b2c32104ea Mon Sep 17 00:00:00 2001 From: valtmanir Date: Fri, 30 Jan 2015 17:42:55 +0200 Subject: [PATCH] Fixed vulnerability scanning scanning failure bug. --- NessusScanner/VulnerabilityAssessment.py | 22 +++++++++++----------- Prepare.py | 4 ++-- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/NessusScanner/VulnerabilityAssessment.py b/NessusScanner/VulnerabilityAssessment.py index 2bb66f8..efbc8e6 100644 --- a/NessusScanner/VulnerabilityAssessment.py +++ b/NessusScanner/VulnerabilityAssessment.py @@ -2,10 +2,10 @@ __author__ = 'nirv' -from Common.AppConfigMgr import ConfigMgr -from Common.Logger import Logger -from Common.Exceptions import RemediationException -from Common.Exceptions import GenericException +from CloudServices.Common.AppConfigMgr import ConfigMgr +from CloudServices.Common.Logger import Logger +from CloudServices.Common.Exceptions import RemediationException +from CloudServices.Common.Exceptions import GenericException import xml.etree.ElementTree as ET import urllib import urllib2 @@ -16,12 +16,12 @@ class Scanner: def __init__(self): self.__cfg = ConfigMgr() - protocol = self.__cfg.getParameter("Nessus", "Protocol") - ip_address = self.__cfg.getParameter("Nessus", "IPAddress") - port = self.__cfg.getParameter("Nessus", "Port") + protocol = self.__cfg.get_parameter("Nessus", "Protocol") + ip_address = self.__cfg.get_parameter("Nessus", "IPAddress") + port = self.__cfg.get_parameter("Nessus", "Port") self.__url = "{}://{}:{}".format(protocol,ip_address,port) - username = self.__cfg.getParameter("Nessus", "Username") - password = self.__cfg.getParameter("Nessus", "Pssword") + username = self.__cfg.get_parameter("Nessus", "Username") + password = self.__cfg.get_parameter("Nessus", "Pssword") query_args = { 'login':username, 'password':password, 'seq': '1'} post_data = urllib.urlencode(query_args) try: @@ -33,11 +33,11 @@ def __init__(self): else: raise GenericException("Could not connect to the vulnerability scanner due to incorrect credentials") finally: - self.__logout() + pass def run_scan(self): target = self.__get_ip_address() - policy_id = self.__cfg.getParameter("Nessus", "ScanPolicyId") + policy_id = self.__cfg.get_parameter("Nessus", "ScanPolicyId") scan_name = "Target:{} Time:{}".format(target, self.__get_time()) query_args = { 'target':target, 'policy_id':policy_id, "scan_name":scan_name, "seq":"1"} response = self.__send_request("/scan/new", query_args) diff --git a/Prepare.py b/Prepare.py index be060d7..e08b5b7 100644 --- a/Prepare.py +++ b/Prepare.py @@ -9,11 +9,11 @@ try: ec2 = EC2Instance() - ec2.create_volume() + ec2.attach_new_storage_to_current_instance() bucket = S3Storage() if len(sys.argv) > 1: - bucket.set_encryption_key() + bucket.generate_and_store_encryption_key() with open("key","a+") as key_file: key_file.write(bucket.get_encryption_key())