This is a tool to run, compare, print, and list OpenSCAP tests with the STIG profile.
python3 OscapScanTool.py [--output-dir OUTPUT_DIR] [--run-scan] [--list-scans] [--print-scan FILE] [--compare-scans FILE1 FILE2]
- --output-dir OUTPUT_DIR: Specifies the output directory for scan results. Default is /var/log/openscap.
- --run-scan: Run a new scan.
- --list-scans: List previous scans.
- --print-scan FILE: Print a specific scan.
- --compare-scans FILE1 FILE2: Compare two previous scans.
- Run a scan:
python3 OscapScanTool.py --run-scan
- List previous scans:
python3 OscapScanTool.py --list-scans
- Print a specific scan:
python3 OscapScanTool.py --print-scan FILE
- Compare two previous scans:
python3 OscapScanTool.py --compare-scans FILE1 FILE2
- Before running the tool, ensure that the required OpenSCAP tools are installed and accessible in the system environment.
- Make sure to provide valid file names and directories when using the tool to avoid errors.
- Python 3.11 installed on your system.
- Access to the terminal or command line.
- Open a terminal.
- Navigate to the folder where the OscapScanTool.py file is located.
cd path_to_your_folder/sandbox
- Create a new virtual environment using Python 3.11. You can do this with the following command:
python3.11 -m venv myenv
- Activate the virtual environment:
On Linux/macOS:
source myenv/bin/activate
On Windows:
myenv\Scripts\activate
Once the virtual environment is activated, install the necessary dependencies using pip:
pip install -r requirements.txt
After installing the dependencies, you can run the Python program using the following command:
python3.11 OscapScanTool.py [arguments]
Make sure to replace [arguments]
with the specific options you want to use, such as --run-scan
, --list-scans
, --print-scan
, --compare-scans
, or --verbose
, as defined in the program.
When you're finished using the program, you can deactivate the virtual environment by typing the following command in the terminal:
deactivate
Docker is a platform for developing, shipping, and running applications inside containers. Containers allow developers to package up an application with all its dependencies and ship it out as a single unit. This ensures that the application will run on any environment that supports Docker, regardless of differences in infrastructure.
To install Docker, follow these steps:
- Visit the official Docker website: https://docs.docker.com/get-docker/
- Choose the appropriate installation method for your operating system (e.g., Docker Desktop for Windows or macOS, Docker Engine for Linux).
- Follow the installation instructions provided on the website.
Once Docker is installed, you can start using it to manage containers.
To build a Docker image from the provided Dockerfile:
- Navigate to the directory containing the Dockerfile.
- Open a terminal or command prompt.
- Run the following command:
This command builds a Docker image named
docker build -t oscap-scanner .
oscap-scanner
from the Dockerfile in the current directory.
To run a Docker container interactively using the built image:
- Open a terminal or command prompt.
- Run the following command:
This command starts a new Docker container named
docker run -it --name oscap-scanner-container oscap-scanner
oscap-scanner-container
from theoscap-scanner
image. The container runs an interactive shell.
- Make sure Docker is running before executing any Docker commands.
- Replace
oscap-scanner
with the appropriate image name if you chose a different name during the image build process. - Additional Docker commands and options can be found in the Docker documentation: https://docs.docker.com/.