Skip to content

Rounak87/ArmorCode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

10 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ›ก๏ธ ArmorCode AI - JavaScript Security Analysis Platform

React Python Flask Machine Learning Tailwind CSS

๐Ÿ“ธ Live Preview

ArmorCode AI Frontend Preview

Modern, professional interface with real-time vulnerability analysis

๐ŸŒŸ Overview

ArmorCode AI is an advanced, enterprise-grade JavaScript security analysis platform that combines the power of machine learning with rule-based vulnerability detection. Built with a modern tech stack, it provides real-time security analysis, AI-enhanced risk scoring, and comprehensive vulnerability reporting for JavaScript applications.

โœจ Key Features

  • ๐Ÿค– AI-Powered Analysis: Advanced machine learning model with Random Forest classifier
  • โšก Real-Time Detection: Instant vulnerability scanning and risk assessment
  • ๐ŸŽฏ Hybrid Scoring System: Combines ML predictions with rule-based analysis and heuristics
  • ๐ŸŽจ Professional UI: Modern, responsive interface with dark theme and animations
  • ๐Ÿ“Š Comprehensive Metrics: Detailed code analysis with 35+ feature extraction points
  • ๐Ÿ” 15+ Vulnerability Patterns: Detects XSS, code injection, eval() usage, and more
  • ๐Ÿ“ฑ Responsive Design: Works seamlessly across desktop, tablet, and mobile devices
  • ๐ŸŽช Enterprise Ready: Professional-grade interface suitable for corporate environments

๐Ÿ—๏ธ Architecture

ArmorCode AI/
โ”œโ”€โ”€ Frontend/          # React.js Frontend Application
โ”œโ”€โ”€ ml_API/           # Python Flask ML API
โ”œโ”€โ”€ Backend/          # Node.js Backend (Optional)
โ””โ”€โ”€ .venv/           # Python Virtual Environment

๐Ÿš€ Tech Stack

Frontend

  • React.js 19.1.0 - Modern UI framework with hooks
  • Tailwind CSS 4.1.11 - Utility-first CSS framework
  • Vite - Fast build tool and development server
  • ESLint - Code linting and static analysis

Backend & ML API

  • Python Flask - Lightweight web framework
  • scikit-learn - Machine learning library
  • joblib - Model persistence and loading
  • Flask-CORS - Cross-origin resource sharing
  • Random Forest Classifier - Core ML model

Development Tools

  • Git - Version control
  • Virtual Environment - Python dependency isolation
  • Modern JavaScript (ES6+) - Latest language features

๐Ÿ“ฆ Installation & Setup

Prerequisites

  • Node.js (v16 or higher)
  • Python (v3.8 or higher)
  • Git

1. Clone the Repository

git clone https://github.com/Rounak87/ArmorCode.git
cd ArmorCode

2. Set Up Python Virtual Environment

python -m venv .venv
.venv\Scripts\activate  # Windows
cd ml_API
pip install flask flask-cors scikit-learn joblib numpy pandas

3. Set Up Frontend

cd ../Frontend
npm install

4. Install ESLint (if needed)

cd ../ml_API
npm install eslint

๐ŸŽฎ Running the Application

Start the ML API Server

cd ml_API
.venv\Scripts\activate  # Windows
python ml_api.py

Server runs on: http://localhost:5000

Start the Frontend

cd Frontend
npm run dev

Frontend runs on: http://localhost:5176

๐Ÿ” Usage

Quick Start

  1. Open your browser and navigate to http://localhost:5176
  2. Paste JavaScript code in the code editor
  3. Click "Analyze Code Security" to get instant results
  4. Review the results including risk level, vulnerabilities, and metrics

๐Ÿง  AI Model & Analysis

Machine Learning Features

The AI model analyzes 35+ code characteristics:

  • Structural metrics: Lines, characters, functions, variables
  • Security patterns: eval(), innerHTML, document.write usage
  • Risk indicators: Dynamic function creation, unsafe DOM manipulation
  • Code complexity: Nested structures, conditional statements

๐ŸŽจ Features Walkthrough

Real-Time Analysis

  • Instant feedback as you type or paste code
  • Loading indicators during analysis
  • Error handling for network issues

Results Dashboard

  • Risk assessment with color-coded levels (High/Medium/Low/Minimal)
  • Vulnerability list with detailed descriptions and line numbers
  • Code metrics showing analysis statistics
  • Interactive elements with hover effects and transitions

๐Ÿ”ง Configuration

Environment Variables

Create a .env file in the root directory:

# API Configuration
ML_API_URL=http://localhost:5000
FRONTEND_PORT=5176

# Development
NODE_ENV=development

๐Ÿ“ Project Structure

ArmorCode AI/
โ”œโ”€โ”€ Frontend/
โ”‚   โ”œโ”€โ”€ src/
โ”‚   โ”‚   โ”œโ”€โ”€ components/       # React components
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ Header.jsx
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ CodeInput.jsx
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ RiskAssessment.jsx
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ VulnerabilityList.jsx
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ CodeMetrics.jsx
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ ResultsPanel.jsx
โ”‚   โ”‚   โ”œโ”€โ”€ App.jsx          # Main application
โ”‚   โ”‚   โ”œโ”€โ”€ main.jsx         # Entry point
โ”‚   โ”‚   โ””โ”€โ”€ index.css        # Global styles
โ”‚   โ”œโ”€โ”€ package.json         # Frontend dependencies
โ”‚   โ””โ”€โ”€ vite.config.js       # Vite configuration
โ”œโ”€โ”€ ml_API/
โ”‚   โ”œโ”€โ”€ ml_api.py            # Flask API server
โ”‚   โ”œโ”€โ”€ rf_vuln_model.pkl    # Trained ML model
โ”‚   โ””โ”€โ”€ package.json         # API dependencies
โ”œโ”€โ”€ Backend/                 # Optional Node.js backend
โ”œโ”€โ”€ .venv/                   # Python virtual environment
โ”œโ”€โ”€ .gitignore              # Git ignore rules
โ””โ”€โ”€ README.md               # This file

๐Ÿ“Š Performance

  • Analysis Speed: ~100-500ms per code sample
  • Accuracy: 85%+ vulnerability detection rate
  • Scalability: Handles code samples up to 10,000+ lines
  • Memory Usage: ~50MB for ML model in memory

๐Ÿ”’ Security

  • Input Sanitization: All user inputs are properly sanitized
  • CORS Protection: Configured for development and production
  • No Code Execution: Analysis is static, no user code is executed
  • Data Privacy: Code analysis happens locally, no data sent to external services

๐Ÿ‘จโ€๐Ÿ’ป Authors

โญ Star this repository if you find it helpful!

About

๐Ÿ›ก๏ธ AI-powered JavaScript security analysis platform with ML-based vulnerability detection and real-time risk assessment

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors