diff options
author | Cédric Ollivier <cedric.ollivier@orange.com> | 2017-06-24 09:30:32 +0200 |
---|---|---|
committer | Cédric Ollivier <cedric.ollivier@orange.com> | 2017-06-24 09:33:53 +0200 |
commit | aec330655f937731c1ef85445f93f0bbec56f7cf (patch) | |
tree | 275682da9aa50f6cc05ecb3d551134cd41ffda18 /security_scan.py | |
parent | 644d8f800fcea0988e04f6422c92b5c2336b98f3 (diff) |
Create securityscanning python package
It also adds requirements and leverages on pkg_resources to find
scripts.
Change-Id: Ie92128ca9f08a9c39025b36ce7664f72982aacc6
Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
Diffstat (limited to 'security_scan.py')
-rw-r--r-- | security_scan.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/security_scan.py b/security_scan.py index 6595faf..c54e096 100644 --- a/security_scan.py +++ b/security_scan.py @@ -13,12 +13,13 @@ # all trace of the scan is removed from the remote system. import argparse +from ConfigParser import SafeConfigParser import connect import datetime import os +import pkg_resources import sys -from ConfigParser import SafeConfigParser from keystoneclient.auth.identity import v2 from keystoneclient import session from novaclient import client @@ -30,7 +31,6 @@ __url__ = 'https://wiki.opnfv.org/display/functest/Functest+Security' # Global vars INSTALLER_IP = os.getenv('INSTALLER_IP') oscapbin = 'sudo /bin/oscap' -repo_dir = '/home/opnfv/repos/securityscanning/' # Apex Spefic var needed to query Undercloud if os.getenv('OS_AUTH_URL') is None: @@ -118,7 +118,9 @@ def internet_check(host, nodetype): import connect user = cfgparse.get(nodetype, 'user') port = cfgparse.get(nodetype, 'port') - localpath = repo_dir + 'scripts/internet_check.py' + localpath = pkg_resources.resource_filename( + pkg_resources.Requirement.parse("securityscanning"), + 'scripts/internet_check.py') remotepath = '/tmp/internet_check.py' com = 'python /tmp/internet_check.py' testconnect = connect.ConnectionManager(host, port, user, localkey, @@ -136,7 +138,9 @@ def createfiles(host, port, user, localkey): """ import connect global tmpdir - localpath = repo_dir + 'scripts/createfiles.py' + localpath = pkg_resources.resource_filename( + pkg_resources.Requirement.parse("securityscanning"), + 'scripts/createfiles.py') remotepath = '/tmp/createfiles.py' com = 'python /tmp/createfiles.py' connect = connect.ConnectionManager(host, port, user, localkey, |