Skip to content

AbdullahMaqbool22/FalconScan

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

66 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ¦… FalconScan - Advanced APK Security Analysis Platform

License: MIT Python Django Next.js TypeScript

A comprehensive cybersecurity platform for analyzing Android APK files, detecting threats, vulnerabilities, and malicious behavior using advanced static analysis and AI-powered intelligence.

FalconScan Dashboard


πŸ“‹ Table of Contents

  1. 🎯 Overview
  2. ✨ Features
  3. πŸ—οΈ Architecture
  4. πŸ› οΈ Technology Stack
  5. πŸ“‹ Prerequisites
  6. πŸ› οΈ Installation
  7. πŸ“– User Guide
  8. πŸ€– AI Analysis
  9. πŸ”’ Security Analysis
  10. πŸ”Œ API Documentation
  11. πŸ“ Directory Structure
  12. πŸ“„ Pages
  13. 🌍 Environment Variables
  14. πŸš€ Deployment
  15. πŸ› Troubleshooting
  16. πŸ“„ License

🎯 Overview

FalconScan is an advanced Android APK security analysis platform for static analysis, vulnerability detection, AI-assisted triage, and professional reporting.

Key Highlights

⚑ Fast Analysis πŸ”’ Security Checks πŸ“Š Professional Reports 🎨 Modern UI
Completes analysis in seconds Covers secrets, crypto, permissions, network risks, and more PDF and JSON reporting with remediation guidance Cybersecurity-themed interface with real-time feedback
πŸ€– AI Assistance πŸ“± APK Focused πŸš€ Live Updates πŸ›‘οΈ Production-Ready
Optional Gemini-powered analysis and summaries Built for Android package workflows Progress tracking and notifications JWT auth, role-aware dashboard, and deployment guidance

✨ Features

  • πŸ” Real-time APK Analysis - Instant threat detection and vulnerability scanning
  • πŸ›‘οΈ Advanced Security Checks - Detect hardcoded secrets, weak crypto, dangerous permissions
  • πŸ€– AI Security Intelligence - On-demand AI analysis with attack chains, severity re-scoring, and code-level fix recommendations
  • πŸ“Š Dynamic Risk Scoring - Industry-standard CVSS-inspired weighted scoring system
  • πŸ“ˆ Comprehensive Reporting - Detailed vulnerability reports with remediation guidance
  • πŸ” Permission Analysis - Identify dangerous permissions and risky behaviors
  • πŸ“‰ Threat Visualization - Interactive charts and graphs for vulnerability breakdown
  • πŸ“œ PDF Export - Professional security reports for documentation
  • πŸ”” Real-time Notifications - Stay informed about scan completion and threats
  • πŸ‘€ User Management - Secure JWT authentication and profile management
  • 🎨 Modern UI - Professional dark cybersecurity theme with glassmorphism effects

πŸ› οΈ Technology Stack

Backend

  • Framework: Django 4.2 + Django REST Framework
  • APK Analysis: Androguard 4.x for decompilation and static analysis
  • AI Engine: google-genai 1.0+ for intelligent security reporting
  • Authentication: JWT (djangorestframework-simplejwt)
  • Database: SQLite (development) / PostgreSQL (production)
  • Server: Daphne (ASGI)
  • PDF Generation: ReportLab
  • API: RESTful with comprehensive endpoints

Frontend

  • Framework: Next.js 16 with TypeScript 5
  • UI Library: React 19
  • Components: shadcn/ui + Radix UI
  • Styling: Tailwind CSS with custom cybersecurity theme
  • Charts: Recharts for data visualization
  • HTTP Client: Axios
  • Date Handling: date-fns

πŸ—οΈ Architecture

High-Level System Architecture

The application is split into a Django backend for analysis and persistence, and a Next.js frontend for the dashboard, reports, and uploads.

System Architecture

Data Flow Architecture

Data Flow Architecture

Component Architecture

Component Architecture

Core Modules

  • Backend API and analysis engine live under backend/
  • Frontend dashboard and user flows live under app/
  • Shared UI, auth, and notification components live under components/
  • API access and helpers live under lib/

πŸ“‹ Prerequisites

  • Python 3.8 or higher
  • Node.js 18 or higher
  • npm or pnpm
  • Git

πŸ› οΈ Installation

1. Clone the repository

git clone https://github.com/yourusername/falconscan.git
cd falconscan

2. Backend Setup

cd backend

# Create virtual environment
python -m venv venv

# Activate virtual environment
# On Windows:
venv\Scripts\activate
# On macOS/Linux:
source venv/bin/activate

# Install dependencies
pip install -r requirements.txt

# Run migrations
python manage.py migrate

# Create superuser (optional)
python manage.py createsuperuser

# Start development server
python manage.py runserver

The backend will run at http://localhost:8000


3. Frontend Setup

# In a new terminal, from project root
pnpm install
# or
npm install

# Copy environment file
cp .env.example .env.local

# Update .env.local with your settings:
# NEXT_PUBLIC_API_URL=http://localhost:8000/api

# Start development server
pnpm dev
# or
npm run dev

The frontend will run at http://localhost:3000


πŸ“– User Guide

Upload an APK for Analysis

  1. Navigate to http://localhost:3000
  2. Register or login to your account
  3. Go to Upload page
  4. Drag & drop or browse for an APK file
  5. Enter app name (optional - will use filename if empty)
  6. Click Start Analysis
  7. Wait for analysis to complete (~1.5-2 seconds)
  8. View detailed security report

View Analysis Results

  • Dashboard: Overview of all scans with statistics
  • Reports: Detailed vulnerability findings for each scan
  • History: Timeline of all previous scans
  • Download PDF: Export professional security reports

Additional Pages

  • Upload: Submit APKs for static analysis and scoring
  • Documentation: Read built-in API and usage help
  • Profile: Manage your account settings and preferences

πŸ€– AI Analysis

FalconScan can generate AI-assisted analysis for completed scans using the configured Gemini model.

What It Adds

  • Attack-chain style summaries
  • Severity re-scoring and prioritization
  • Remediation recommendations
  • Compliance-oriented observations

Usage

  1. Open a completed scan report.
  2. Select the AI tab.
  3. Click Generate AI Report.
  4. Review the generated findings and recommendations.

Notes

  • AI analysis requires AI_API_KEY in the backend environment.
  • Model selection and fallback behavior are configured in the backend.

πŸ”’ Security Analysis

Vulnerability Detection

  • Hardcoded API keys and secrets (AWS, Google, Firebase, GitHub, Stripe, and more)
  • Weak cryptographic implementations (DES, ECB, MD5, SHA-1)
  • Insecure network configurations (HTTP, cleartext traffic)
  • Dangerous permissions usage (CAMERA, LOCATION, SMS, CONTACTS, etc.)
  • SQL injection vulnerabilities
  • Path traversal issues
  • Exported components without permission protection
  • Debug certificate in production
  • 15+ additional security checks

Risk Scoring Algorithm

Weighted scoring system based on industry standards:

  • Critical: 25 points each
  • High: 15 points each
  • Medium: 8 points each
  • Low: 3 points each

Multipliers applied for:

  • Dangerous permissions (5+): +20%
  • Debuggable flag: +15%
  • Cleartext traffic: +15%
  • Hardcoded secrets: +15%
  • Backup allowed: +10%

Threat Levels

Level Score Range Color Action Required
Critical β‰₯ 80 πŸ”΄ Immediate attention required
High β‰₯ 60 🟠 Significant security concerns
Medium β‰₯ 35 🟑 Notable issues requiring review
Low β‰₯ 15 🟒 Minor issues or recommendations
Safe < 15 βœ… No threats detected

Analysis Coverage

  • Manifest and permission inspection
  • Component exposure and exported surface review
  • Certificate and signing checks
  • Secret, token, and credential pattern detection
  • Network and cleartext traffic review
  • Weak crypto and insecure storage checks

API Documentation

Authentication

POST /api/accounts/users/register/    # Create account
POST /api/token/                      # Login β†’ returns access + refresh JWT
POST /api/token/refresh/              # Refresh access token
GET  /api/accounts/users/me/          # Current user profile

Scans

POST   /api/scans/upload/             # Upload APK (multipart/form-data)
GET    /api/scans/                    # List all scans (paginated)
GET    /api/scans/{id}/               # Full scan details + analysis results
GET    /api/scans/{id}/report/        # Security report (JSON)
GET    /api/scans/{id}/download_pdf/  # Download PDF report
POST   /api/scans/{id}/rescan/        # Retry a failed scan
DELETE /api/scans/{id}/               # Delete scan + all associated data
GET    /api/scans/statistics/         # Dashboard stats
POST   /api/scans/ai_report/          # Generate AI security report
POST   /api/scans/cleanup_failed/     # Bulk retry all failed scans

All scan endpoints require Authorization: Bearer <access_token>.


Directory Structure

falconscan/
β”œβ”€β”€ backend/
β”‚   β”œβ”€β”€ falconscan_backend/
β”‚   β”‚   β”œβ”€β”€ settings.py               # Django configuration
β”‚   β”‚   β”œβ”€β”€ urls.py
β”‚   β”‚   └── wsgi.py / asgi.py
β”‚   β”œβ”€β”€ apps/
β”‚   β”‚   β”œβ”€β”€ accounts/                 # User management (JWT auth)
β”‚   β”‚   β”‚   β”œβ”€β”€ models.py
β”‚   β”‚   β”‚   β”œβ”€β”€ views.py
β”‚   β”‚   β”‚   └── serializers.py
β”‚   β”‚   └── scans/                    # Core scan engine
β”‚   β”‚       β”œβ”€β”€ models.py             # Scan, Vulnerability, Report models
β”‚   β”‚       β”œβ”€β”€ analyzer.py           # Androguard APK wrapper
β”‚   β”‚       β”œβ”€β”€ static_analyzer.py    # String & artifact extraction
β”‚   β”‚       β”œβ”€β”€ vulnerability_scanner.py  # 15+ security checks
β”‚   β”‚       β”œβ”€β”€ ai_analyzer.py        # AI security intelligence engine
β”‚   β”‚       β”œβ”€β”€ pdf_generator.py      # ReportLab PDF builder
β”‚   β”‚       └── views.py              # REST API endpoints
β”‚   └── manage.py
β”œβ”€β”€ app/                              # Next.js app router
β”‚   β”œβ”€β”€ dashboard/
β”‚   β”‚   β”œβ”€β”€ upload/                   # APK upload interface
β”‚   β”‚   β”œβ”€β”€ reports/[id]/             # Detailed scan report viewer
β”‚   β”‚   β”œβ”€β”€ history/                  # Scan history timeline
β”‚   β”‚   β”œβ”€β”€ settings/                 # User settings
β”‚   β”‚   └── documentation/           # In-app documentation viewer
β”‚   β”œβ”€β”€ login/
β”‚   β”œβ”€β”€ register/
β”‚   └── page.tsx                      # Landing page
β”œβ”€β”€ components/                       # Shared React components
β”œβ”€β”€ lib/
β”‚   └── api.ts                        # Centralised Axios API client
└── public/                           # Static assets

Pages

Public Pages

  • / - Landing page with features and stats
  • /login - User login with JWT authentication
  • /register - New user registration

Dashboard Pages (Protected)

  • /dashboard - Overview with statistics and recent scans
  • /dashboard/upload - Upload APK for scanning
  • /dashboard/history - View all previous scans
  • /dashboard/reports - Generate and download detailed reports
  • /dashboard/documentation - Complete API and usage documentation
  • /dashboard/settings - User settings and preferences
  • /dashboard/profile - User profile management

Environment Variables

Backend (backend/.env)

DEBUG=True
DJANGO_SECRET_KEY=your-secret-key-here
ALLOWED_HOSTS=localhost,127.0.0.1
CORS_ALLOWED_ORIGINS=http://localhost:3000
DATABASE_URL=sqlite:///db.sqlite3
AI_API_KEY=your-ai-api-key-here

Frontend (.env.local)

NEXT_PUBLIC_API_URL=http://localhost:8000/api
NEXT_PUBLIC_APP_NAME=FalconScan

Deployment

Production Checklist

  • Set DEBUG=False in Django settings
  • Generate a new DJANGO_SECRET_KEY
  • Switch to PostgreSQL for production
  • Set ALLOWED_HOSTS to your production domain
  • Configure HTTPS / TLS termination
  • Set CORS_ALLOWED_ORIGINS to the production frontend URL
  • Set AI_API_KEY for AI analysis feature
  • Run python manage.py collectstatic
  • Set up proper logging and monitoring

Troubleshooting

Backend won't start

# Check if port 8000 is in use
lsof -i :8000           # macOS/Linux
netstat -ano | findstr :8000  # Windows

Frontend won't start

# Clear cache and reinstall
rm -rf node_modules .next
pnpm install

Database issues

# Reset database (development only!)
python manage.py flush --no-input
python manage.py migrate

Missing Python module

pip install androguard
pip install -r requirements.txt

CORS errors: Verify CORS_ALLOWED_ORIGINS in backend/falconscan_backend/settings.py includes your frontend origin.


πŸ“„ License

MIT β€” see LICENSE.

Releases

No releases published

Packages

 
 
 

Contributors