Comprehensive SAST & DAST security testing in one powerful command
Features β’ Installation β’ Usage β’ Documentation β’ Contributing
SafetyScan is a powerful, automated security scanning tool designed exclusively for Linux environments. It combines the best of both worlds by seamlessly integrating Static Application Security Testing (SAST) and Dynamic Application Security Testing (DAST) to provide comprehensive vulnerability detection for your applications.
β οΈ Linux Only: This tool is built specifically for Linux systems and requires a Linux environment to function properly.
- π Two-in-One Solution: Combine SAST and DAST in a single tool
- π³ Isolated Testing: Docker-based containers ensure clean, reproducible scans
- π Actionable Reports: Get detailed HTML and JSON reports you can actually use
- β‘ Developer-Friendly: Simple CLI interface, complex security analysis
- π Open Source: Free, transparent, and community-driven
|
|
- β Automatic Detection: Identifies project types and dependencies
- β Flexible Execution: Run SAST, DAST, or both simultaneously
- β Docker Integration: Containerized scans for security and consistency
- β Rich Reporting: Multiple report formats (HTML, JSON, TXT)
- β Easy Setup: Single installation script, global command access
- β Language Agnostic: Supports Node.js, Python, Java, Go, Ruby, PHP, and more
| Component | Requirement |
|---|---|
| Operating System | Linux (Ubuntu 18.04+, Debian 10+, CentOS 7+, Fedora 30+, Arch Linux) |
| Architecture | x86_64 (64-bit) |
| RAM | 2 GB minimum, 4 GB recommended |
| Disk Space | 5 GB free space |
| Docker | Version 20.10+ |
| Shell | Bash 4.0+ |
| Python | Python 3.6+ (optional, for comprehensive reports) |
- β Ubuntu 20.04 LTS / 22.04 LTS / 24.04 LTS
- β Debian 10 (Buster) / 11 (Bullseye) / 12 (Bookworm)
- β CentOS 7 / 8 / Stream
- β Fedora 35+
- β Arch Linux
- β Linux Mint 20+
| Component | Purpose | Installation |
|---|---|---|
| Python 3 | Generate comprehensive HTML/MD reports | sudo apt install python3 (Ubuntu/Debian) |
| jq | Enhanced JSON parsing in summaries | sudo apt install jq (Ubuntu/Debian) |
Docker is required for SafetyScan to function. Choose your distribution:
Ubuntu / Debian
# Update package index
sudo apt-get update
# Install prerequisites
sudo apt-get install -y \
apt-transport-https \
ca-certificates \
curl \
gnupg \
lsb-release
# Add Docker's official GPG key
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
# Set up stable repository
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
# Install Docker Engine
sudo apt-get update
sudo apt-get install -y docker-ce docker-ce-cli containerd.io
# Verify installation
sudo docker --versionCentOS / RHEL / Fedora
# Remove old versions (if any)
sudo yum remove docker docker-client docker-client-latest docker-common docker-latest docker-latest-logrotate docker-logrotate docker-engine
# Install required packages
sudo yum install -y yum-utils
# Add Docker repository
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
# Install Docker Engine
sudo yum install -y docker-ce docker-ce-cli containerd.io
# Start Docker
sudo systemctl start docker
sudo systemctl enable docker
# Verify installation
sudo docker --versionArch Linux
# Install Docker
sudo pacman -S docker
# Start and enable Docker service
sudo systemctl start docker.service
sudo systemctl enable docker.service
# Verify installation
sudo docker --versionRun Docker commands without sudo:
# Add your user to the docker group
sudo usermod -aG docker $USER
# Apply changes (log out and back in, or run)
newgrp docker
# Verify - this should work without sudo
docker run hello-world# Clone the repository
git clone https://github.com/IsMohit/SafetyScan-Automated-Security-Scanning-Tool-for-Linux-.git
# Navigate to directory
cd SafetyScan-Automated-Security-Scanning-Tool-for-Linux-
# Make install script executable
chmod +x install.sh
# Run installation (may require sudo)
./install.sh# Check if safetyscan is accessible
safetyscan --help
# Should display usage information# Ubuntu/Debian
sudo apt-get install jq
# CentOS/RHEL/Fedora
sudo yum install jq
# Arch Linux
sudo pacman -S jqsafetyscan <project_path> --mode [sast|dast|both] [OPTIONS]| Option | Description | Required | Example |
|---|---|---|---|
<project_path> |
Path to your project directory | β Yes | ./myapp |
--mode |
Scan type: sast, dast, or both |
β Yes | --mode both |
--start |
Command to start your application | --start "npm start" |
|
--port |
Application port number | --port 3000 |
|
-h, --help |
Display help information | β No | -h |
Perfect for code review before runtime testing:
safetyscan ./my-web-app --mode sastWhat it does:
- Analyzes source code for vulnerabilities
- Identifies insecure coding patterns
- Generates
semgrep.jsonandsemgrep-summary.txt
Test a running Node.js application:
safetyscan ./my-node-app --mode dast --start "npm install && npm start" --port 3000What it does:
- Installs dependencies and starts your app
- Runs OWASP ZAP against
http://localhost:3000 - Generates HTML and JSON DAST reports
Test a Flask web application:
safetyscan ./my-flask-app --mode dast --start "pip install -r requirements.txt && python app.py" --port 5000Test a Spring Boot application:
safetyscan ./my-spring-app --mode dast --start "mvn spring-boot:run" --port 8080Run both static and dynamic analysis:
safetyscan ./my-application --mode both --start "npm install && npm start" --port 3000What it does:
- β Performs static code analysis (SAST)
- β Starts your application in a container
- β Runs dynamic security tests (DAST)
- β Generates comprehensive reports for both
safetyscan ./my-react-app --mode both --start "npm install && npm run start" --port 3001safetyscan ./my-django-app --mode both --start "pip install -r requirements.txt && python manage.py runserver 0.0.0.0:8000" --port 8000After scanning, all reports are saved in a timestamped directory:
<project_root>/
βββ reports/
βββ <project_name>_YYYYMMDD_HHMMSS/
βββ semgrep.json # Raw SAST output (machine-readable)
βββ semgrep-summary.txt # SAST findings summary (human-readable)
βββ zap-report.html # Full DAST report (browser-friendly)
βββ zap-report.json # Raw DAST output (machine-readable)
βββ zap-warnings.html # Critical DAST warnings (prioritized)
βββ scan-summary.txt # Overall scan overview
βββ comprehensive-security-report.html # π Comprehensive HTML report
βββ comprehensive-security-report.md # π Comprehensive Markdown report
SafetyScan now generates beautiful, detailed, and organized comprehensive reports that combine both SAST and DAST findings into a single, easy-to-read document!
- π Executive Summary Dashboard - Visual overview of all findings by severity
- π¨ Professional Design - Beautiful HTML with gradient headers and color-coded severity badges
- π Table of Contents - Easy navigation through all findings
- π Detailed Findings - Each vulnerability includes:
- Severity level with color coding
- Complete description and context
- File location and line numbers (SAST)
- Affected URLs (DAST)
- CWE/OWASP mappings
- Remediation guidance
- Code snippets (when applicable)
- π‘ Smart Recommendations - Prioritized action items based on findings
- π Security Resources - Links to OWASP, CWE, and documentation
- π¨οΈ Print-Friendly - Optimized CSS for PDF export
-
HTML Report (
comprehensive-security-report.html)- Open in any browser
- Interactive and visually appealing
- Perfect for sharing with stakeholders
- Can be converted to PDF
-
Markdown Report (
comprehensive-security-report.md)- Text-based, version control friendly
- Easy to include in documentation
- Compatible with GitHub, GitLab, etc.
- Simple to parse programmatically
| File | Format | Purpose | Best For |
|---|---|---|---|
semgrep.json |
JSON | Complete SAST findings with metadata | CI/CD integration, automated processing |
semgrep-summary.txt |
Text | Human-readable vulnerability summary | Quick review, documentation |
zap-report.html |
HTML | Comprehensive DAST test results | Detailed analysis, stakeholder reports |
zap-report.json |
JSON | Structured DAST findings | Automation, tracking, dashboards |
zap-warnings.html |
HTML | High-priority vulnerabilities | Immediate action items |
scan-summary.txt |
Text | Combined SAST + DAST overview | Executive summary |
comprehensive-security-report.html |
HTML | π Complete security analysis | Primary report for all stakeholders |
comprehensive-security-report.md |
Markdown | π Text-based full report | Documentation, version control |
SafetyScan uses a two-stage architecture for comprehensive reporting:
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Bash Script (safetyscan.sh) β
β β
β ββββββββββββββββ ββββββββββββββββ β
β β SAST Scan β β DAST Scan β β
β β (Semgrep) β β (OWASP ZAP) β β
β ββββββββ¬ββββββββ ββββββββ¬ββββββββ β
β β β β
β βΌ βΌ β
β ββββββββββββββββββββββββββββββββββββββ β
β β semgrep.json zap-report.json β β
β ββββββββββββββ¬ββββββββββββββββββββββββ β
β β β
β βΌ β
β ββββββββββββββββββββββββββββββββββββββ β
β β Python Report Generator β β
β β (report_generator.py) β β
β β β β
β β β’ Parses JSON outputs β β
β β β’ Categorizes by severity β β
β β β’ Generates statistics β β
β β β’ Creates beautiful HTML β β
β β β’ Exports Markdown β β
β ββββββββββββββ¬ββββββββββββββββββββββββ β
β β β
β βΌ β
β ββββββββββββββββββββββββββββββββββββββ β
β β Comprehensive Reports β β
β β β’ HTML with CSS styling β β
β β β’ Markdown for documentation β β
β ββββββββββββββββββββββββββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Benefits of this architecture:
- β Modular design - each component can be updated independently
- β Language-specific strengths - Bash for orchestration, Python for data processing
- β Fallback support - Works even if Python is not available
- β Extensible - Easy to add new report formats or analysis tools
| Technology | Semgrep - Open-source static analysis |
| Analysis Method | Abstract Syntax Tree (AST) pattern matching |
| Language Support | 30+ languages including JavaScript, TypeScript, Python, Java, Go, Ruby, PHP, C, C++, C#, Rust |
| Rulesets | OWASP Top 10, CWE, custom security rules |
| Output | Detailed vulnerability locations with severity ratings |
| Technology | OWASP Zed Attack Proxy (ZAP) |
| Analysis Method | Active web application penetration testing |
| Test Coverage | SQL Injection, XSS, CSRF, Security Headers, SSL/TLS, Authentication |
| Scanning Mode | Automated spider + active scanner |
| Standards | OWASP Top 10, PCI DSS compliance checks |
π΄ Docker daemon not running
Error: Cannot connect to the Docker daemon
Solution:
# Start Docker service
sudo systemctl start docker
# Enable Docker to start on boot
sudo systemctl enable docker
# Check Docker status
sudo systemctl status dockerπ΄ Permission denied (Docker socket)
Error: Got permission denied while trying to connect to the Docker daemon socket
Solution:
# Add user to docker group
sudo usermod -aG docker $USER
# Apply changes
newgrp docker
# OR log out and back in
# Verify
docker run hello-worldπ΄ Port already in use
Error: Port 3000 is already in use
Solution:
# Find process using the port
sudo lsof -i :3000
# OR
sudo netstat -tulpn | grep :3000
# Kill the process (replace PID)
kill -9 <PID>
# OR use a different port
safetyscan ./myapp --mode dast --start "npm start" --port 3001π΄ Application fails to start in container
Issue: Application startup command doesn't work in Docker
Solution:
- Ensure all dependencies are installed in the start command
- Use
&&to chain commands:"npm install && npm start" - Check application logs in the container
- Verify the application binds to
0.0.0.0, not justlocalhost
π΄ Comprehensive reports not generated
Issue: HTML/Markdown comprehensive reports are missing
Symptoms:
β Python 3 not found - skipping comprehensive report generation
Solution:
# Check Python installation
python3 --version
# Install Python 3 if not present
# Ubuntu/Debian
sudo apt install python3
# CentOS/RHEL
sudo yum install python3
# Fedora
sudo dnf install python3
# Verify report generator is installed
which safetyscan-report-generator
ls -la /usr/local/bin/safetyscan-report-generator
# Reinstall if needed
cd SafetyScan-Automated-Security-Scanning-Tool-for-Linux
sudo ./install.shNote: Basic reports (JSON, TXT, HTML from ZAP) will still be generated even without Python.
π΄ White text in HTML report
Issue: Text appears white on white background in comprehensive report
Solution: This has been fixed in the latest version. Update your installation:
cd SafetyScan-Automated-Security-Scanning-Tool-for-Linux
git pull origin main
sudo ./install.sh
# Or manually update report generator
sudo cp report_generator.py /usr/local/bin/safetyscan-report-generator
sudo chmod +x /usr/local/bin/safetyscan-report-generatorπ΄ HTML tags visible in report
Issue: Seeing <p>, <br> tags in descriptions and solutions
Solution: This has been fixed in the latest version. The report generator now:
- Strips HTML tags from OWASP ZAP output
- Preserves formatting by converting tags to newlines
- Properly escapes content for display
Update to the latest version:
cd SafetyScan-Automated-Security-Scanning-Tool-for-Linux
git pull origin main
sudo ./install.shπ΄ Command not found: safetyscan
Solution:
# Reinstall with proper permissions
cd SafetyScan-Automated-Security-Scanning-Tool-for-Linux-
sudo ./install.sh
# OR manually copy
sudo cp safetyscan.sh /usr/local/bin/safetyscan
sudo chmod +x /usr/local/bin/safetyscanπ΄ Disk space issues
Solution:
# Clean up Docker
docker system prune -a --volumes
# Check disk usage
df -h
# Remove old scan reports
rm -rf ./reports/*_oldWe welcome contributions from the community! Here's how you can help:
- π΄ Fork the repository
- πΏ Create a feature branch
git checkout -b feature/amazing-feature
- π» Commit your changes
git commit -m 'Add amazing feature' - π€ Push to your branch
git push origin feature/amazing-feature
- π Open a Pull Request
- β Follow existing code style and conventions
- β Write clear, descriptive commit messages
- β Add comments for complex logic
- β Test your changes thoroughly on multiple Linux distributions
- β Update documentation for new features
- β Ensure all scans pass before submitting PR
- π Add support for additional scanners
- π Fix bugs and improve error handling
- π Improve documentation and examples
- π¨ Enhance report formatting
- β‘ Performance optimizations
- π Add CI/CD integration examples
This project is licensed under the MIT License - see the LICENSE file for full details.
MIT License
Copyright (c) 2025 Mohit Khambekar
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software...
SafetyScan is built on the shoulders of giants:
- Semgrep - Fast, lightweight static analysis
- OWASP ZAP - World's most popular DAST tool
- Docker - Containerization platform
- Linux Community - For the amazing ecosystem
Need help? Have questions? Found a bug?
- π Bug Reports: Open an Issue
- π‘ Feature Requests: Suggest a Feature
- π¬ Discussions: GitHub Discussions
- π§ Direct Contact: Reach out via GitHub
If SafetyScan helps secure your applications, please consider:
- β Starring this repository
- π Reporting bugs or issues
- π‘ Suggesting new features
- π’ Sharing with your team and network
- π€ Contributing to the codebase