ersec 21.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- ersec-21.0.0/LICENSE +21 -0
- ersec-21.0.0/MANIFEST.in +3 -0
- ersec-21.0.0/PKG-INFO +22 -0
- ersec-21.0.0/README.md +10 -0
- ersec-21.0.0/ersec/__init__.py +2 -0
- ersec-21.0.0/ersec/ai.py +206 -0
- ersec-21.0.0/ersec/cli.py +924 -0
- ersec-21.0.0/ersec/mitre.py +116 -0
- ersec-21.0.0/ersec/scanner.py +231 -0
- ersec-21.0.0/ersec/version.py +2 -0
- ersec-21.0.0/ersec.egg-info/PKG-INFO +22 -0
- ersec-21.0.0/ersec.egg-info/SOURCES.txt +17 -0
- ersec-21.0.0/ersec.egg-info/dependency_links.txt +1 -0
- ersec-21.0.0/ersec.egg-info/entry_points.txt +2 -0
- ersec-21.0.0/ersec.egg-info/requires.txt +4 -0
- ersec-21.0.0/ersec.egg-info/top_level.txt +1 -0
- ersec-21.0.0/pyproject.toml +9 -0
- ersec-21.0.0/setup.cfg +4 -0
- ersec-21.0.0/setup.py +26 -0
ersec-21.0.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 ERSEC Development Team
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
ersec-21.0.0/MANIFEST.in
ADDED
ersec-21.0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: ersec
|
|
3
|
+
Version: 21.0.0
|
|
4
|
+
Summary: Enterprise Reconnaissance & Security Engine - Professional Vulnerability Scanner
|
|
5
|
+
Author: ERSEC Team
|
|
6
|
+
Classifier: Programming Language :: Python :: 3
|
|
7
|
+
Classifier: Topic :: Security
|
|
8
|
+
Requires-Python: >=3.8
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Requires-Dist: requests>=2.28.0
|
|
11
|
+
Requires-Dist: beautifulsoup4>=4.12.0
|
|
12
|
+
Requires-Dist: lxml>=4.9.0
|
|
13
|
+
Requires-Dist: urllib3>=2.0.0
|
|
14
|
+
Dynamic: author
|
|
15
|
+
Dynamic: classifier
|
|
16
|
+
Dynamic: description
|
|
17
|
+
Dynamic: license-file
|
|
18
|
+
Dynamic: requires-dist
|
|
19
|
+
Dynamic: requires-python
|
|
20
|
+
Dynamic: summary
|
|
21
|
+
|
|
22
|
+
Professional vulnerability scanner with MITRE ATT&CK integration and AI-powered analysis
|
ersec-21.0.0/README.md
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# ERSEC - Enterprise Reconnaissance & Security Engine
|
|
2
|
+
|
|
3
|
+
Professional vulnerability scanner with MITRE ATT&CK integration for authorized security assessment.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
- Deep Vulnerability Detection (SQL Injection, XSS, Command Injection, LFI/RFI)
|
|
7
|
+
- Complete MITRE ATT&CK Framework
|
|
8
|
+
- Professional AI Analysis
|
|
9
|
+
- Advanced Reconnaissance
|
|
10
|
+
- Comprehensive Reporting
|
ersec-21.0.0/ersec/ai.py
ADDED
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
"""Professional AI Analysis Engine for ERSEC"""
|
|
2
|
+
|
|
3
|
+
from typing import Dict, Any, List
|
|
4
|
+
from .mitre import MITREKnowledgeBase
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class ProfessionalAI:
|
|
8
|
+
"""AI-powered analysis engine using MITRE knowledge base"""
|
|
9
|
+
|
|
10
|
+
def __init__(self):
|
|
11
|
+
self.mitre = MITREKnowledgeBase()
|
|
12
|
+
|
|
13
|
+
def analyze(self, target: str, results: Dict[str, Any]) -> str:
|
|
14
|
+
"""Generate comprehensive analysis"""
|
|
15
|
+
findings = results.get("all_findings", [])
|
|
16
|
+
|
|
17
|
+
sections = []
|
|
18
|
+
sections.append(self._generate_summary(target, findings))
|
|
19
|
+
sections.append(self._generate_vulnerability_details(findings))
|
|
20
|
+
sections.append(self._generate_mitre_mapping(findings))
|
|
21
|
+
sections.append(self._generate_exploitation_guide(findings))
|
|
22
|
+
sections.append(self._generate_defense_strategies(findings))
|
|
23
|
+
sections.append(self._generate_recommendations(findings))
|
|
24
|
+
|
|
25
|
+
return "\n\n".join(sections)
|
|
26
|
+
|
|
27
|
+
def _generate_summary(self, target: str, findings: List[Dict]) -> str:
|
|
28
|
+
"""Generate executive summary"""
|
|
29
|
+
critical = len([f for f in findings if f.get("severity") == "Critical"])
|
|
30
|
+
high = len([f for f in findings if f.get("severity") == "High"])
|
|
31
|
+
medium = len([f for f in findings if f.get("severity") == "Medium"])
|
|
32
|
+
total = len(findings)
|
|
33
|
+
|
|
34
|
+
risk_score = min(100, critical * 30 + high * 15 + medium * 5)
|
|
35
|
+
|
|
36
|
+
if risk_score >= 80:
|
|
37
|
+
risk_level = "CRITICAL"
|
|
38
|
+
elif risk_score >= 60:
|
|
39
|
+
risk_level = "HIGH"
|
|
40
|
+
elif risk_score >= 40:
|
|
41
|
+
risk_level = "MEDIUM"
|
|
42
|
+
else:
|
|
43
|
+
risk_level = "LOW"
|
|
44
|
+
|
|
45
|
+
return f"""
|
|
46
|
+
╔══════════════════════════════════════════════════════════════╗
|
|
47
|
+
║ EXECUTIVE SECURITY REPORT ║
|
|
48
|
+
╚══════════════════════════════════════════════════════════════╝
|
|
49
|
+
|
|
50
|
+
📋 Target: {target}
|
|
51
|
+
📊 Risk Score: {risk_score}/100 - {risk_level}
|
|
52
|
+
|
|
53
|
+
Vulnerability Distribution:
|
|
54
|
+
🔴 Critical: {critical}
|
|
55
|
+
🟠 High: {high}
|
|
56
|
+
🟡 Medium: {medium}
|
|
57
|
+
📊 Total: {total}
|
|
58
|
+
|
|
59
|
+
{"⚠️ CRITICAL VULNERABILITIES - IMMEDIATE ACTION REQUIRED!" if critical > 0 else "⚡ Vulnerabilities found - remediation recommended" if total > 0 else "✅ No critical vulnerabilities detected"}
|
|
60
|
+
"""
|
|
61
|
+
|
|
62
|
+
def _generate_vulnerability_details(self, findings: List[Dict]) -> str:
|
|
63
|
+
"""Generate detailed vulnerability analysis"""
|
|
64
|
+
if not findings:
|
|
65
|
+
return "No vulnerabilities detected."
|
|
66
|
+
|
|
67
|
+
details = "╔══════════════════════════════════════════════════════════════╗\n"
|
|
68
|
+
details += "║ VULNERABILITY DETAILS ║\n"
|
|
69
|
+
details += "╚══════════════════════════════════════════════════════════════╝\n"
|
|
70
|
+
|
|
71
|
+
for i, f in enumerate(findings, 1):
|
|
72
|
+
severity = f.get("severity", "Unknown")
|
|
73
|
+
emoji = "🔴" if severity == "Critical" else "🟠" if severity == "High" else "🟡"
|
|
74
|
+
|
|
75
|
+
details += f"""
|
|
76
|
+
|
|
77
|
+
{emoji} Finding #{i}: {f.get('name', 'Unknown')}
|
|
78
|
+
{'=' * 60}
|
|
79
|
+
Type: {f.get('type', 'Unknown')}
|
|
80
|
+
Severity: {severity}
|
|
81
|
+
CVSS Score: {f.get('cvss', 'N/A')}
|
|
82
|
+
|
|
83
|
+
Description:
|
|
84
|
+
{f.get('description', 'No description available')}
|
|
85
|
+
|
|
86
|
+
Impact:
|
|
87
|
+
{f.get('impact', 'Unknown impact')}
|
|
88
|
+
"""
|
|
89
|
+
|
|
90
|
+
return details
|
|
91
|
+
|
|
92
|
+
def _generate_mitre_mapping(self, findings: List[Dict]) -> str:
|
|
93
|
+
"""Generate MITRE ATT&CK mapping"""
|
|
94
|
+
if not findings:
|
|
95
|
+
return ""
|
|
96
|
+
|
|
97
|
+
mapping = "╔══════════════════════════════════════════════════════════════╗\n"
|
|
98
|
+
mapping += "║ MITRE ATT&CK MAPPING ║\n"
|
|
99
|
+
mapping += "╚══════════════════════════════════════════════════════════════╝\n"
|
|
100
|
+
|
|
101
|
+
seen = set()
|
|
102
|
+
for f in findings:
|
|
103
|
+
for tech_id in f.get("techniques", []):
|
|
104
|
+
if tech_id in seen:
|
|
105
|
+
continue
|
|
106
|
+
seen.add(tech_id)
|
|
107
|
+
|
|
108
|
+
tech = self.mitre.get_technique(tech_id)
|
|
109
|
+
if tech:
|
|
110
|
+
mapping += f"""
|
|
111
|
+
|
|
112
|
+
[{tech_id}] {tech.get('name', 'Unknown')}
|
|
113
|
+
Tactic: {tech.get('tactic', 'Unknown')}
|
|
114
|
+
Description: {tech.get('description', 'N/A')}
|
|
115
|
+
"""
|
|
116
|
+
|
|
117
|
+
return mapping
|
|
118
|
+
|
|
119
|
+
def _generate_exploitation_guide(self, findings: List[Dict]) -> str:
|
|
120
|
+
"""Generate exploitation guide"""
|
|
121
|
+
if not findings:
|
|
122
|
+
return ""
|
|
123
|
+
|
|
124
|
+
guide = "╔══════════════════════════════════════════════════════════════╗\n"
|
|
125
|
+
guide += "║ EXPLOITATION GUIDE ║\n"
|
|
126
|
+
guide += "╚══════════════════════════════════════════════════════════════╝\n"
|
|
127
|
+
|
|
128
|
+
for f in findings:
|
|
129
|
+
tools = f.get("tools", [])
|
|
130
|
+
commands = f.get("commands", [])
|
|
131
|
+
|
|
132
|
+
if tools or commands:
|
|
133
|
+
guide += f"""
|
|
134
|
+
|
|
135
|
+
{'-' * 60}
|
|
136
|
+
Exploiting: {f.get('name', 'Unknown')}
|
|
137
|
+
{'-' * 60}
|
|
138
|
+
|
|
139
|
+
🛠️ Tools:
|
|
140
|
+
{', '.join(tools) if tools else 'Manual exploitation'}
|
|
141
|
+
|
|
142
|
+
💻 Commands:
|
|
143
|
+
"""
|
|
144
|
+
for cmd in commands:
|
|
145
|
+
guide += f" $ {cmd}\n"
|
|
146
|
+
|
|
147
|
+
return guide
|
|
148
|
+
|
|
149
|
+
def _generate_defense_strategies(self, findings: List[Dict]) -> str:
|
|
150
|
+
"""Generate defense strategies"""
|
|
151
|
+
if not findings:
|
|
152
|
+
return ""
|
|
153
|
+
|
|
154
|
+
defense = "╔══════════════════════════════════════════════════════════════╗\n"
|
|
155
|
+
defense += "║ DEFENSE STRATEGIES ║\n"
|
|
156
|
+
defense += "╚══════════════════════════════════════════════════════════════╝\n"
|
|
157
|
+
|
|
158
|
+
for f in findings:
|
|
159
|
+
strategies = f.get("defense", [])
|
|
160
|
+
if strategies:
|
|
161
|
+
defense += f"""
|
|
162
|
+
|
|
163
|
+
{'-' * 60}
|
|
164
|
+
Defending Against: {f.get('name', 'Unknown')}
|
|
165
|
+
{'-' * 60}
|
|
166
|
+
|
|
167
|
+
"""
|
|
168
|
+
for s in strategies:
|
|
169
|
+
defense += f" ✅ {s}\n"
|
|
170
|
+
|
|
171
|
+
defense += """
|
|
172
|
+
|
|
173
|
+
🔒 General Hardening:
|
|
174
|
+
✅ Regular patching
|
|
175
|
+
✅ Network segmentation
|
|
176
|
+
✅ Least privilege
|
|
177
|
+
✅ MFA everywhere
|
|
178
|
+
✅ WAF deployment
|
|
179
|
+
"""
|
|
180
|
+
|
|
181
|
+
return defense
|
|
182
|
+
|
|
183
|
+
def _generate_recommendations(self, findings: List[Dict]) -> str:
|
|
184
|
+
"""Generate prioritized recommendations"""
|
|
185
|
+
recommendations = "╔══════════════════════════════════════════════════════════════╗\n"
|
|
186
|
+
recommendations += "║ PRIORITIZED RECOMMENDATIONS ║\n"
|
|
187
|
+
recommendations += "╚══════════════════════════════════════════════════════════════╝\n"
|
|
188
|
+
|
|
189
|
+
if not findings:
|
|
190
|
+
recommendations += "\n✅ No critical vulnerabilities\n✅ Maintain security posture\n"
|
|
191
|
+
return recommendations
|
|
192
|
+
|
|
193
|
+
critical = [f for f in findings if f.get("severity") == "Critical"]
|
|
194
|
+
high = [f for f in findings if f.get("severity") == "High"]
|
|
195
|
+
|
|
196
|
+
if critical:
|
|
197
|
+
recommendations += "\n🚨 IMMEDIATE (24-48 Hours):\n"
|
|
198
|
+
for f in critical:
|
|
199
|
+
recommendations += f" ⚡ {f.get('name')}: {f.get('description', '')[:80]}\n"
|
|
200
|
+
|
|
201
|
+
if high:
|
|
202
|
+
recommendations += "\n⚠️ URGENT (1 Week):\n"
|
|
203
|
+
for f in high:
|
|
204
|
+
recommendations += f" ⚠️ {f.get('name')}: {f.get('description', '')[:80]}\n"
|
|
205
|
+
|
|
206
|
+
return recommendations
|