AlexeyTolstopyatov/SunFlower
GitHub: AlexeyTolstopyatov/SunFlower
这是一个基于插件驱动架构的开源二进制静态分析系统,旨在通过模块化设计实现对 PE、NE、LE 等多种可执行文件格式的解析与扩展分析。
Stars: 6 | Forks: 0
### Sunflower
Sunflower 是一个开源的、插件驱动的二进制分析系统。
其灵感来源于 PEAnathomist、CFFExplrer、Semi VB Decompiler 以及其他类似的工具包。
它的主要理念是构建非单体应用程序,并避免嵌入式功能。此仓库仅包含
加载器细节和客户端。
此仓库包含我工作的三个部分:
- 基础定义 (`abstractions`)
- 插件管理器 (`kernel`)
- Avalonia 客户端 (`client`)

### Sunflower 核心“种子”(插件)
在发布版中,将始终提供用于定义的插件
- `MZ` 可执行文件(实模式 x86 应用程序);
- `NE` 分段可执行文件(首批保护模式 x86 应用程序);
- `LE` OS/2-Windows386 可执行文件;
- `LX` OS/2-ArcaOS 标准可执行文件;
- `PE` Windows NT 标准应用程序;
- `MS-DOS PIF` 文件。
但是 Sunflower 给了你机会去制作你自己的扩展,
并在加载所有插件的情况下运行它。
### Sunflower “种子”(应用程序插件)
要制作新的 Sunflower 扩展:
1. 创建 Visual Studio 解决方案。
2. 添加引用 `SunFlower.Abstractions.dll`
3. 确保:Client 应用程序版本与 Abstractions 之间没有差异
4. 遵循此模板
5. 阅读“README”末尾的文档。
```
[Flower(SeedTarget.Data)]
[FlowerContract(5, 0, 0)]
public class MyAnalyzer : IFlowerSeed {
/// Title
public string Name => "It shows in Connected Plugins menu";
/// Plugin results writes here. All exception chains
/// contains here. When exception throws ->
/// plugin terminates and information shows in a Client app.
public FlowerSeedStatus Status { get; set; }
/// EntryPoint
/// (calls when IFlowerSeed derivate instance creates)
public int Main(string path) { /* Scan for patterns */ }
}
```
如果你想使用 F# 工具链,你可以像这样实现:
```
[]
[]
type MyAnalyzer() =
interface IFlowerSeed with
/// Title
member this.Name = "It shows in Connected Plugins menu"
/// Plugin results writes here. All exception chains
/// contains here. When exception throws ->
/// plugin terminates and information shows in a Client app.
member val Status = FlowerSeedStatus() with get, set
/// EntryPoint
/// (calls when IFlowerSeed derivate instance creates)
member this.Main(path: string) : int =
// Scan for patterns
0
```
6. 构建并将 .DLL 放入 `%Application%/Plugins`
7. 运行 SunFlower 并查看你能做什么!

### 支持的二进制格式
开箱即用的 DLL 位于 [plugins](https://github.com/AlexeyTolstopyatov/SunFlower.Plugins/) 仓库中
### 严重困扰我但我无法修复的架构问题
- **愚蠢的** 异常处理 -
`Main` 过程包含异常处理程序,它会
重写 Status 最后一个错误字段。加载器打印调用程序集的所有堆栈帧;
- 版本不兼容 - 不幸的是,与基础版本不同的 Sunflower 插件是**不兼容的**。
基础文件版本与插件基础调用之间的任何差异都会强制退出(意味着冲突行为)。
### 框架和其他外部工具链
所有框架和工具包
- Avalonia XPF `.net8.0` - 跨平台客户端的基础
- `.NET 8.0` - 一切的基础
- [HandyControls](https://github.com/HandyOrg/HandyControl) - 更好的 Window 控件 / 少量 MVVM 经验
- [Markdown.Avalonia](https://github.com/whistyun/Markdown.Avalonia) - 代替 Monaco Editor 和 JavaScript 绑定
### 文档
- [插件开发笔记](ABSTRACT.md) - 初始阶段与抽象应用
- [客户端-内核通信笔记](KERNEL.md) - SunFlower 内核的工作原理
- [版本控制笔记](VERSIONING.md)
标签:Avalonia, DAST, F#, LE, LX, MZ, NE, PE文件, URL提取, Windows可执行文件, 二进制分析, 二进制发布, 云安全监控, 云安全运维, 云资产清单, 反编译, 可扩展架构, 开源工具, 恶意软件分析, 文件格式解析, 端点检测与响应, 脱壳工具, 调试插件, 逆向工程, 静态分析