Process Scripts User Guide¶
Overview¶
The kpat_cli scripts command is the new-and-improved version of what used to be adv-searchfor in earlier versions of the toolkit. Improvements include:
- Searches for all files starting at the current working directory or at a path provided by the user (
-d) - Processes all Windows, MacOS, and Linux systems concurrently -- no longer need to run them each separately
- Saves all results into separate OS-specific Excel workbook (one each for supported OS)
- Provides a search summary and a system summary worksheet
Prerequisites¶
System Requirements¶
- KP Analysis Toolkit installed (see Installation Guide)
Knowledge Requirements¶
- Basic PowerShell (or other command line) skills (PowerShell Primer)
- System hardening and vulnerability management for operating systems being reviewed
- Reference CIS Benchmarks for hardening
- Excel skills for reviewing results
- Basic Excel sort-and-filter
- (Recommended) Basic Excel PivotTable skills -- helpful in reviewing time-stamped results such as monthly vulnerability management activities
- (Advanced Use Cases) Excel PowerPivot -- only needed if you plan on doing advanced correlation across result sets
Required Files/Data¶
- Script results from:
kpmacaudit- MacOS data collection scriptkpnixaudit-- Linux OS data collection scriptkpwinaudit- Windows OS data collection script
These collection scripts each produce a structured, text-based file that can be read by the kpat_cli scripts tool. The results will be parsed and collated into OS-specific Excel spreadsheets for auditor review.
Getting Started¶
PowerShell Basics¶
See the PowerShell Primer for additional help on getting started with PowerShell.
Example 1: Process results from the collector scripts¶
Use Case: Customer has returned their script results based on the sample chosen by the auditor
Steps:
- Unzip and organize the files into the most meaningful arrangement based on your project. For example, create folders for:
- Different operating systems
- Function group such as "Workstations", "Developers" or "HR"
- Launch PowerShell (PowerShell Primer)
-
Change to your project folder and run
kpat_cli scripts -
The tool will begin parsing all of the files it can find in the current folder and any sub-folders. Warning messages will be displayed if it finds a file that it can't process.

-
Review the results in the
results/folder- Results are stored in a
results/folder relative to the folder wherekpat_clistarted its search from - There will be a separate Excel workbook for
Linux,Darwin(MacOS), andWindowsoperating systems - Each file will be time-stamped to when you started the analysis

- Results are stored in a
Core Functionality¶
Basic Usage¶
The typical command doesn't require any options or flags. It will find and process any .txt files in the current folder and all sub-folders.
Advanced Options¶
Advanced options are available to display information about the internal workings of the scripts command and to change the default behavior.

Information Options¶
Each of the informational commands start with --list-* and will provide details about the inner workings of the scripts tool. Options include:
| Command Option | Description | Default |
|---|---|---|
--list-audit-configs |
Show the list of available audit configurations | audit-all.yaml |
--list-source-files |
Show all of the files that will be discovered by the tool | N/A |
--list-systems |
Pre-process all discovered files to show the system details that will be used when extracting results | N/A |
--list-sections |
Not implemented and will be removed from a future version | N/A |
There are also --verbose options for each of these commands to increase the amount of information that will be shown. This is helpful for troubleshooting.

Change the Output Folder¶
You can change the results folder to something else using the --out-path option.
# Provide a different results folder
kpat_cli scripts --out-path "C:\Users\YourName\Downloads\Temp\"
The files will still be named using their OS-type and a timestamp, but they'll now be located in the Temp folder.
Change the starting folder¶
The typical workflow involves changing to the folder where you want to start the file search from. But you can also override the starting folder when you start kpat_cli scripts:
Changing the Audit Configuration¶
The default configuration will process all Windows, MacOS and Linux systems (audit-all.yaml) that it can find when scanning folder the folder hiearchy. You can override this behavior and force just one policy or operating system.
-
List the available audit configuration files

-
Override the default
Output and Results¶
Output Files¶
All results are written into OS-specific Excel files. The results for each search pattern are stored in separate worksheets, and a search summary and system summary worksheet will also be written:
- Starting folder (e.g.
C:\Users\YourName\Downloads\Customers\Acme Corp\scripts\)results\folder- Filename: <OSType>_search_results_timestamp.xlsx
SummaryworksheetSystem Summaryworksheet- ... Alphabetized search results worksheets
- Filename: <OSType>_search_results_timestamp.xlsx
Interpreting Results¶
Troubleshooting¶
When kpat_cli scripts encounters errors in processing files or exporting results, it will note the error and continue with the next file. The most common warning conditions are listed below:
Common Issues¶
File encoding errors¶
Encoding errors occur when the source file's encoding can't be determined. The most common file encodings are follows:
| Platform | Encoding |
|---|---|
| Linux | utf-8ascii |
| MacOS | utf-8ascii |
| Windows | utf-8utf-16 |
Symptoms:

Solutions:
Encoding errors indicate that either the file was not produced by one of the collection scripts or that it was corrupted.
- Try opening the file in VS Code, Notepad++ or Notepad.
- Compare the file with one that it is working; the structure of the file should be immediately evident.
- If the structure looks consistent, but you observe byte patterns or obscure characters, the file has become corrupted.
Unknown producer error¶
An Unknown producer error indicates the file was not created by one of the supported collection scripts. The tool looks for one of the following, and if it can't find it, this error is reported:
KPMACVERSION: Produced bykpmacaudit.shKPNIXVERSION: Produced bykpnixaudit.shKPWINVERSION: Produced bykpwinaudit.ps1