Skip to content

mukeshnitjsr/code-security

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

5 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Security Code Scanner

A Python-based security code scanner that helps identify potential security vulnerabilities in your codebase. This tool performs automated scanning to detect common security issues, hardcoded secrets, and potential vulnerabilities while generating comprehensive HTML reports with solutions.

πŸš€ Features

Security Checks

  • πŸ”‘ Hardcoded secrets and API keys
  • 🌐 Insecure protocols (HTTP)
  • πŸ’‰ SQL injection vulnerabilities
  • πŸ› Debug mode configurations
  • πŸ”“ Unsafe CORS settings
  • πŸ–₯️ Hardcoded IP addresses
  • 🎟️ JWT tokens in code

Smart Scanning

  • πŸ“‚ Excludes common build directories (node_modules, .next, etc.)
  • πŸ–ΌοΈ Skips binary and asset files
  • ❌ Reduces false positives
  • 🎯 Intelligent pattern matching

Detailed Reporting

  • πŸ“Š Severity-based classification
  • πŸ“ Precise file and line locations
  • πŸ’» Actual code snippets
  • πŸ› οΈ Recommended solutions
  • βœ… Best practices guidance

πŸ“‹ Prerequisites

  • Python 3.7 or higher
  • pip (Python package installer)

πŸ”§ Installation

  1. Clone the repository:

    git clone https://github.com/yourusername/security-code-scanner.git
    cd security-code-scanner
  2. Install required packages:

    pip install jinja2

πŸ’» Usage

Basic Usage

python security_scanner.py

Custom Directory Scan

   from security_scanner import SecurityScanner
   scanner = SecurityScanner(root_dir="path/to/your/project")
   scanner.scan_directory()
   scanner.generate_report()

πŸ“„ Supported File Types

  • Python (.py)
  • JavaScript (.js, .jsx)
  • TypeScript (.ts, .tsx)
  • HTML (.html)
  • Environment files (.env)
  • Configuration files (.json, .yml, .yaml, .xml)
  • Text files (.txt)

🚫 Excluded Directories

The scanner automatically skips:

  • node_modules
  • .next
  • .git
  • pycache
  • venv/env
  • build/dist
  • coverage
  • public/assets/images
  • And more...

πŸ“Š Report Format

The generated HTML report includes:

Summary Section

  • Total issues found
  • Severity distribution
  • Scan timestamp

Detailed Findings

  • Issue type and severity
  • File location and line number
  • Problematic code snippet
  • Recommended solutions

πŸ› οΈ Customization

Add Custom Patterns

scanner.patterns['Custom Issue'] = r'your-regex-pattern'

Exclude Additional Folders

scanner.exclude_folders.add('your-custom-folder')

Modify File Types

scanner.allowed_extensions.add('.custom-extension')

🀝 Contributing

We welcome contributions! Here's how you can help:

  • Fork the repository
  • Create your feature branch
    git checkout -b feature/AmazingFeature
  • Commit your changes
    git commit -m 'Add some AmazingFeature'
  • Push to the branch
    git push origin feature/AmazingFeature
  • Open a Pull Request

πŸ“ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ”„ Version History

  • 1.0.0
    • Initial Release
    • Basic security scanning functionality
    • HTML report generation

πŸ—ΊοΈ Roadmap

  • Add support for more programming languages
  • Implement custom rule creation
  • Add CI/CD integration
  • Create a web interface
  • Add automated fix suggestions
  • Implement severity score calculation

⚠️ Disclaimer

This tool is provided as-is without any warranties. While it helps identify potential security issues, it should not be relied upon as the sole security measure. Always perform thorough security reviews and testing.

πŸ‘₯ Authors

- Mukesh Kumar
- GitHub: @mukesh6374
- LinkedIn: https://www.linkedin.com/in/mukesh11

🌟 Support

If you found this project helpful, please give it a star! ⭐ For support:

  • Open an issue

Inspired by security best practices

Built with Python and Jinja2

Made with ❀️ by Mukesh Kumar ( mukesh6374)

About

Script created in python to detect code vulnerability

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors