diff options
-rw-r--r-- | connect.py | 1 | ||||
-rw-r--r-- | requirements.txt | 4 | ||||
-rw-r--r-- | security_scan.py | 12 | ||||
-rw-r--r-- | setup.cfg | 7 | ||||
-rw-r--r-- | setup.py | 22 |
5 files changed, 42 insertions, 4 deletions
@@ -13,6 +13,7 @@ import logging import os import socket + import paramiko diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..264cf79 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,4 @@ +pbr>=1.8 # Apache-2.0 +paramiko>=2.0 # LGPLv2.1+ +python-keystoneclient>=3.8.0 # Apache-2.0 +python-novaclient!=7.0.0,>=6.0.0 # Apache-2.0 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, diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..719c389 --- /dev/null +++ b/setup.cfg @@ -0,0 +1,7 @@ +[metadata] +name = securityscanning +version = 5 +home-page = https://wiki.opnfv.org/display/PROJ/Security+Scanning + +[files] +packages = . diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..a1e9b3b --- /dev/null +++ b/setup.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python + +# Copyright (c) 2017 Orange and others. +# +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 + +import setuptools + +# In python < 2.7.4, a lazy loading of package `pbr` will break +# setuptools if some other modules registered functions in `atexit`. +# solution from: http://bugs.python.org/issue15881#msg170215 +try: + import multiprocessing # noqa +except ImportError: + pass + +setuptools.setup( + setup_requires=['pbr>=1.8'], + pbr=True) |