A collection of Python scripts to help you interact with the Contrast Security API and automate common tasks.
- Python 3.x (latest version recommended)
- Contrast Security account with API access
- Git
-
Clone the repository
git clone https://github.com/Contrast-Security-OSS/CSR-Helpful-Scripts.git cd CSR-Helpful-Scripts -
Install dependencies
pip install -r requirements.txt
-
Set up your credentials
Create a
.credsfile in the root directory using the provided template:cp template.creds .creds
Edit
.credsand fill in your Contrast Security credentials:CONTRAST_URL=https://your-contrast-instance.com/Contrast ORG_ID=your-organization-id USERNAME=your-username API_KEY=your-api-key SERVICE_KEY=your-service-key APP_ID=your-app-id⚠️ Important: Never commit the.credsfile to version control. It's already included in.gitignore.
-
Navigate to the script directory:
cd script-folder-name -
Run the script:
python script-name.py
-
Enter credentials:
- If you have a
.credsfile configured, simply press Enter when prompted to use the saved credentials - Otherwise, manually enter your credentials when prompted
- If you have a
| Script | Description |
|---|---|
app-add-label |
Bulk add or remove tags from applications |
correlate-routes-to-vulns |
Determine if vulnerabilities still exist on routes |
distribute-parent-app-rbac-to-children |
Distribute parent application RBAC to child applications |
get-licensed-apps |
Get all licensed applications and their server information |
get-licensed-servers |
Get all licensed servers |
get-scan-data |
Retrieve scan data for SAST projects |
inventory-windows-webapps |
Inventory Windows web applications |
policy-add-to-all-orgs |
Add policies to all organizations |
reporting |
Generate various reports (languages, vulnerabilities, protect vs assess) |
scan-add-label |
Add labels to SAST scan projects |
toggle-server-protect |
Toggle server protect license |
vulnerabilities-by-business-unit |
Get vulnerabilities grouped by business unit |
vulns-and-prompts |
Get vulnerability and prompt details |
📖 Each script directory contains its own
README.mdwith detailed usage instructions.
If you discover any bugs or have feature requests:
- Open an issue in this repository with details about the bug or feature
- Contact your CSA (Customer Success Architect) during your weekly/biweekly calls
- Submit a Pull Request if you've fixed a bug or added a feature
- Never commit credentials to version control
- Keep your
.credsfile secure and private - Regularly rotate your API keys and service keys
- Keep your Python dependencies up to date:
pip install --upgrade -r requirements.txt
See the LICENSE file for details.
Contributions are welcome! Please feel free to submit a Pull Request.
For support, please contact your Contrast Security Customer Success Architect.
Note: These scripts are provided as-is for use by Contrast Security customers and partners. Always test scripts in a non-production environment first.