HIXZI/S.A.M.
GitHub: HIXZI/S.A.M.
一款基于 C++11 的企业级终端凭证安全评估套件,通过熵计算、字典比对和模式检测来审计密码强度并生成高强度口令。
Stars: 0 | Forks: 0
# S.A.M — Secure Auth Monitor





## 📌 概述
**S.A.M (Secure Auth Monitor)** 是一款高性能、模块化的 C++ 应用程序,旨在根据数学熵模型、空间键盘走查、字典泄露列表以及连续字符重复来评估身份验证凭证。
S.A.M 采用 **C++11**、**面向对象编程 (OOP)**、**ANSI 24位真彩终端图形** 和 **隐私保护审计日志** 构建,提供交互式网络安全意识和实时防御反馈。
## ✨ 主要特性
- **🧮 Shannon 熵计算**:评估跨 4 种字符池(大写字母、小写字母、数字、符号)的密码随机性(以位为单位,$H = L \cdot \log_2 N$)。
- **🔍 字典漏洞检查器**:将候选密码与字典词表 (`rockyou.txt`) 进行交叉比对,支持精确匹配和子短语检测。
- **⌨️ 空间与键盘走查检测器**:识别顺序模式 (`1234`, `abc`, `qwerty`, `asdf`) 和重复字符序列,并自动进行子模式修剪。
- **🎲 加密口令生成器**:使用 `std::mt19937` 生成具有自定义分隔符和随机符号的高熵多词口令。
- **🔒 隐私保护审计日志记录器**:使用强制字符掩码 (`P**********!`) 将评估日志写入 `analysis_report.txt`,以保护凭证隐私。
- **🎨 ANSI 24位线性 RGB 渐变 UI**:定制的终端 UI,具有线性颜色渐变、夏日天空高亮点缀、高对比度徽章以及交互式非阻塞 10 秒倒计时定时器。
- **📚 集成安全教育**:展示 NIST SP 800-63B 指南和最佳实践的密码防御建议。
## 📐 系统架构
```
classDiagram
class SAMApp {
+run()
+handleEvaluatePassword()
+handleDictionaryCheck()
+handleSecurityEducationAndGenerator()
+handleAuditReports()
+handleDictionaryManagement()
+handleEthicsNotice()
}
class PasswordAnalyzer {
+calculateEntropy()
+checkSequentialAlpha()
+checkSequentialNumeric()
+checkKeyboardSpatial()
+checkRepeatedCharacters()
+analyze() AnalysisReport
}
class DictionaryManager {
+loadDictionary()
+saveDictionary()
+addPasswordToDictionary()
+isExactMatch()
+findSubstringMatches()
}
class PassphraseGenerator {
+generatePassphrase()
+generateComplexPassword()
}
class AuditLogger {
+logReport()
+loadAuditHistory()
+clearAuditHistory()
}
class TerminalUI {
+initTerminal()
+printBanner()
+printHeader()
+printBox()
+getIntInput()
+getStringInput()
+exitPauseWithCountdown()
}
SAMApp --> PasswordAnalyzer
SAMApp --> DictionaryManager
SAMApp --> PassphraseGenerator
SAMApp --> AuditLogger
SAMApp --> TerminalUI
PasswordAnalyzer --> DictionaryManager
```
## 🚀 快速开始与编译
### 前置条件
- 兼容 C++11 的编译器 (GCC / MinGW / Clang / MSVC)
- 支持 ANSI 转义码的 Windows PowerShell / 命令提示符 / Linux 终端
### 构建说明
#### 方案 1:直接使用 GCC 编译(推荐)
```
g++ -std=c++11 -O2 -o sam.exe TerminalUI.cpp DictionaryManager.cpp PasswordAnalyzer.cpp PassphraseGenerator.cpp AuditLogger.cpp SecurityEducation.cpp SAMApp.cpp main.cpp
```
#### 方案 2:Dev-C++ / TDM-GCC
在 Dev-C++ 中打开项目目录,选择启用 C++11 ISO 标准的 **Release (64-bit)**,然后点击 **Rebuild All (F12)**。
### 执行
```
./sam.exe
```
## 📁 文件结构
```
S.A.M/
├── main.cpp # Application Entry Point
├── SAMApp.h / .cpp # Core Application Controller & State Machine
├── TerminalUI.h / .cpp # ANSI TrueColor Rendering & Terminal Input
├── PasswordAnalyzer.h / .cpp # Entropy Calculation & Pattern Pruning Engine
├── DictionaryManager.h / .cpp # Dictionary File I/O & Ascending Sort Engine
├── PassphraseGenerator.h / .cpp # Random Passphrase & Password Generator
├── AuditLogger.h / .cpp # Masked Persistent Audit Log Manager
├── SecurityEducation.h / .cpp # NIST Security Standards & Education Center
├── rockyou.txt # Sample Weak Password Dictionary Dataset
├── analysis_report.txt # Generated Persistent Audit Log File
├── LICENSE # MIT License File
└── README.md # Project Documentation
```
## 🧑💻 作者与项目元数据
- **作者**:HIXZI
- **专业**:数字取证与网络安全
- **项目**:S.A.M - Secure Auth Monitor
- **版本**:`v1.0.4` | Build `2026.08.02-RELEASE`
## 📜 许可证
本项目基于 **MIT License** 授权 — 详情请参阅 [LICENSE](LICENSE) 文件。███████╗ █████╗ ███╗ ███╗ ██╔════╝ ██╔══██╗ ████╗ ████║ ███████╗ ███████║ ██╔████╔██║ ╚════██║ ██╔══██║ ██║╚██╔╝██║ ███████║██╗██║ ██║██╗██║ ╚═╝ ██║ ╚══════╝╚═╝╚═╝ ╚═╝╚═╝╚═╝ ╚═╝ Secure Auth Monitor v1.0.4 | Build 2026.08.02-RELEASE **企业级终端凭证评估与防御性安全套件**
标签:C++11, Gophish, 凭证审计, 安全意识培训, 密码强度评估