Skip to content

Commit

Permalink
Fixed vulnerability scanning scanning failure bug.
Browse files Browse the repository at this point in the history
  • Loading branch information
valtmanir committed Jan 30, 2015
1 parent e9136aa commit 0ddb13e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
22 changes: 11 additions & 11 deletions NessusScanner/VulnerabilityAssessment.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand All @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions Prepare.py
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down

0 comments on commit 0ddb13e

Please sign in to comment.