Complete Workflow Overview
Therun_full_assessment() method in main.py:136 orchestrates all seven phases:
Phase 1: Initialization
Database Setup
The assessment begins with database initialization (main.py:144-159):
1
Create Scan Record
Generates unique scan ID and creates database entry with timestamp
2
Verify Database
Ensures SQLite connection is active and tables exist
3
Initialize Storage
Prepares directories for reports, logs, and exploit scripts
The scan ID tracks all results throughout the assessment and allows historical comparison of scans against the same target.
Phase 2: Network Reconnaissance
Port Scanning & Service Detection
Comprehensive network scanning using Nmap (main.py:161-180):
Scanning Capabilities
TCP Scanning
All 65,535 TCP ports with service detection
UDP Scanning
Top 20 UDP ports for common services
OS Detection
Operating system fingerprinting via TCP/IP stack analysis
Banner Grabbing
Service version identification from banners
Data Collected
- Open port numbers
- Service names (HTTP, SSH, FTP, etc.)
- Service versions (Apache 2.4.41, OpenSSH 8.2p1)
- Operating system family and version
- Network latency and responsiveness
Database Storage
Phase 3: Vulnerability Analysis
Web Vulnerability Scanning
Deep vulnerability analysis using Nikto and SQLMap (main.py:183-207):
This phase can be skipped with
--skip-web for faster scans or when web testing isn’t needed.Detection Methods
1
Common Vulnerabilities
Checks for default credentials, outdated software, misconfigurations
2
Web Application Scanning
Nikto scans for web server vulnerabilities, dangerous files, outdated versions
3
SQL Injection Testing
SQLMap tests for SQL injection points in web applications
4
Service-Specific Checks
Custom checks for FTP, SSH, SMB, and other common services
Vulnerability Storage
Phase 4: CVE Intelligence
Automated CVE Lookup
Cross-references discovered services with CVE databases (main.py:209-230):
CVE Matching Process
1
Service Identification
Extracts service name and version from scan results
2
Database Query
Queries CVE databases (NVD, CVE Details) for matching vulnerabilities
3
CVSS Scoring
Retrieves CVSS scores and severity ratings for each CVE
4
Exploit Availability
Checks if public exploits exist for identified CVEs
CVE Data Structure
Phase 5: Risk Assessment
Multi-Factor Risk Calculation
Comprehensive risk analysis combining all vulnerability data (main.py:233-254):
Risk Factors
Port Exposure
Number and type of open ports (higher = riskier)
Vulnerability Count
Total vulnerabilities weighted by severity
CVSS Scores
Aggregate CVSS scores from all CVEs
Exploit Availability
Whether public exploits exist for vulnerabilities
Risk Levels
- CRITICAL: CVSS 9.0-10.0 or actively exploited vulnerabilities
- HIGH: CVSS 7.0-8.9 or multiple serious issues
- MEDIUM: CVSS 4.0-6.9 or configuration weaknesses
- LOW: CVSS 0.1-3.9 or informational findings
- INFO: No security impact, awareness only
Database Update
Phase 6: Exploitation Simulation
Safe Mode Exploitation
Metasploit integration with safety controls (main.py:256-290):
Phase 6 can be skipped with
--skip-exploit for compliance requirements or faster assessments.Exploit Matching
The exploit engine matches vulnerabilities to known exploits (exploit_engine.py:70-117):
Exploit Database
Built-in exploit mappings (exploit_engine.py:22-53):
- vsftpd 2.3.4: Backdoor command execution
- ProFTPD 1.3.3c: Backdoor vulnerability
- EternalBlue (MS17-010): SMB remote code execution
- Shellshock: Bash environment variable injection
- Drupalgeddon2: Drupal RCE vulnerability
Safe Mode Behavior
In safe mode (default), the tool:1
Identifies Exploits
Matches vulnerabilities to Metasploit modules
2
Simulates Execution
Logs what would happen without actually executing
3
Generates RC Scripts
Creates Metasploit resource scripts for manual testing
4
Records Results
Stores simulation results in database
Phase 7: Report Generation
Professional PDF Reports
Final phase generates comprehensive documentation (main.py:293-310):
Report Contents
Executive Summary
Executive Summary
High-level overview suitable for non-technical stakeholders:
- Overall risk level and score
- Critical findings count
- Top 5 recommendations
- Business impact assessment
Technical Findings
Technical Findings
Detailed technical information for security teams:
- Complete port scan results
- All identified vulnerabilities
- CVE details with CVSS scores
- Exploit simulation results
Risk Assessment
Risk Assessment
Comprehensive risk analysis:
- Risk calculation methodology
- Individual vulnerability ratings
- Aggregate risk scoring
- Threat prioritization
Remediation Guidance
Remediation Guidance
Actionable recommendations:
- Prioritized fix list
- Configuration changes
- Patch requirements
- Compensating controls
Report Formats
- PDF: Primary format with professional styling
- Database: SQLite for historical analysis
- Logs: Text logs for debugging and audit trails
- RC Scripts: Metasploit scripts for validation testing
Workflow Execution
Automatic Progress
All phases execute automatically with real-time progress indicators:Error Handling
The workflow includes comprehensive error handling (main.py:324-341):
All partial results are saved even if the scan is interrupted, allowing you to review findings up to the failure point.
Timeline & Performance
Typical Execution Times
Total: Typically 10-30 minutes for a complete assessment
What’s Next?
Safe Mode Details
Learn about exploitation safety mechanisms
Run Your First Scan
Execute your first penetration test
CLI Reference
Complete command-line options
Understanding Reports
Interpret generated PDF reports