CERT-Polska/karton
GitHub: CERT-Polska/karton
基于 Python、Redis 和 S3 的分布式恶意软件处理框架,用于将各类分析工具串联成灵活的自动化流水线。
Stars: 466 | Forks: 51
# Karton
基于 Python、Redis 和 S3 的分布式恶意软件处理框架。
## 理念
Karton 是一个用于创建**灵活**且**轻量级**恶意软件分析后端的健壮框架。
它可用于将恶意软件*分析系统连接成一个健壮的流水线,且只需很少的精力。
我们从事自动化业务已久。我们要处理的威胁日益增多,必须实现一切自动化才能跟上事件的步伐。因此,我们最终常常得到许多用~~鸭子~~布基胶带和 WD-40 粘在一起的脚本。这些脚本是分析人员在紧迫时刻编写的,脆弱且丑陋——但它们能工作,并产生必须被存储、进一步处理、发送到其他系统或与其他组织共享的情报。
我们需要一种方法来获取我们的 PoC 脚本,并轻松将其插入到我们的分析流水线中。我们还希望监控它们的执行,集中日志管理,提高鲁棒性,减少开发惰性……正是为了这个目的,我们创建了 **Karton**。
*\* 虽然 Karton 是为恶意软件分析而设计的,但它在每个面向微服务的项目中都能很好地工作。*
## 安装
安装非常简单,只需一条 `pip install` 命令:
```
pip3 install karton-core
```
为了搭建完整的后端环境,您还需要 S3 兼容存储和 Redis,有关详细信息,请参阅 [文档](https://karton-core.readthedocs.io/en/latest/getting_started.html#installation)。
## 使用示例
要使用 karton,您必须提供一个继承自 Karton 的类。
```
from karton.core import Karton, Task, Resource
class GenericUnpacker(Karton):
"""
Performs sample unpacking
"""
identity = "karton.generic-unpacker"
filters = [
{
"type": "sample",
"kind": "runnable",
"platform": "win32"
}
]
def process(self, task: Task) -> None:
# Get sample object
packed_sample = task.get_resource('sample')
# Log with self.log
self.log.info(f"Hi {packed_sample.name}, let me analyze you!")
...
# Send our results for further processing or reporting
task = Task(
{
"type": "sample",
"kind": "raw"
}, payload = {
"parent": packed_sample,
"sample": Resource(filename, unpacked)
})
self.send_task(task)
if __name__ == "__main__":
GenericUnpacker.main()
```
## 命令行
该包还提供了一个名为 "karton" 的命令行工具。您可以使用它执行简单的管理任务(但它并非设计为功能齐全的管理工具)。
```
$ karton configure # create a new configuration file
$ karton list -s # list current binds
karton name version karton
------------------------------------------------------------------------
karton.yaramatcher 1.2.0 5.3.0
karton.autoit-ripper 1.2.1 5.3.3
karton.mwdb-reporter 1.3.0 5.3.2
$ karton logs # start streaming all system logs
$ karton delete karton.something # remove unused bind (will be GCed by system during the next operation)
```
## Karton 系统
一些 Karton 系统是通用的且对每个人都很有用。我们决定将它们与社区分享。
#### [karton](https://github.com/CERT-Polska/karton)
本仓库。它包含 `karton.system` 服务——主服务,负责在系统内分发任务。它还包含 `karton.core` 模块,该模块被其他系统用作库。
#### [karton-dashboard](https://github.com/CERT-Polska/karton-dashboard)
一个用于任务和队列管理及监控的小型 Flask 仪表板。
#### [karton-classifier](https://github.com/CERT-Polska/karton-classifier)
“路由器”。它识别样本/文件,并根据文件格式生成各种任务类型。多亏了它,其他系统可以只监听特定格式的任务(例如,只监听 `zip` 归档)。
#### [karton-archive-extractor](https://github.com/CERT-Polska/karton-archive-extractor)
通用归档解包器。上传到系统的归档文件将被解压,每个文件将被单独处理。
#### [karton-config-extractor](https://github.com/CERT-Polska/karton-config-extractor)
恶意软件提取器。它使用 Yara 规则和 Python 模块从恶意软件样本和分析中提取静态配置。这是钓鱼竿,而不是鱼——我们不共享模块本身。但编写自己的模块很容易!
#### [karton-mwdb-reporter](https://github.com/CERT-Polska/karton-mwdb-reporter)
流水线中非常重要的一部分。Reporter 将分析期间产生的所有文件、标签、评论和其他情报提交到 [MWDB](https://github.com/CERT-Polska/mwdb-core)。如果您尚未使用 MWDB 或只是更喜欢其他后端,编写自己的 reporter 很容易。
#### [karton-yaramatcher](https://github.com/CERT-Polska/karton-yaramatcher)
自动在流水线中的所有文件上运行 Yara 规则,并适当地标记样本。规则不包含在内 ;).
#### [karton-asciimagic](https://github.com/CERT-Polska/karton-asciimagic)
解码使用常见方法(如 `hex`、`base64` 等)编码的文件的 Karton 系统。(您不会相信它有多常见)。
#### [karton-autoit-ripper](https://github.com/CERT-Polska/karton-autoit-ripper)
[AutoIt-Ripper](https://github.com/nazywam/AutoIt-Ripper) 的一个小封装,用于从编译后的 AutoIt 可执行文件中提取嵌入的 AutoIt 脚本和资源。
#### [DRAKVUF Sandbox](https://github.com/CERT-Polska/drakvuf-sandbox)
自动化黑盒恶意软件分析系统,底层使用 DRAKVUF 引擎,不需要在 Guest OS 上安装代理。
这些系统可以通过以下方式组成一个基本的恶意软件分析流水线:
[](img/karton-systems.svg?raw=true)
## 整合 Karton 框架的社区项目
#### [c3rb3ru5d3d53c/karton-unpacker](https://github.com/c3rb3ru5d3d53c/karton-unpacker)
一个模块化的 Karton Framework 服务,使用 Qiling Framework 解包常见的加壳程序(如 UPX 等)。
#### [c3rb3ru5d3d53c/mwcfg](https://github.com/c3rb3ru5d3d53c/mwcfg) / [c3rb3ru5d3d53c/mwcfg-modules](https://github.com/c3rb3ru5d3d53c/mwcfg-modules)
一个功能丰富的模块化恶意软件配置提取工具,适用于 MalDuck。
#### [raw-data/karton-die-classifier](https://github.com/raw-data/karton-die-classifier)
Karton 框架的 Detect-It-Easy 分类器。
#### [raw-data/karton-retdec-unpacker](https://github.com/raw-data/karton-retdec-unpacker)
Karton 框架的 RetDec 解包模块。
#### [W3ndige/aurora](https://github.com/W3ndige/aurora) / [W3ndige/karton-similarity](https://github.com/W3ndige/karton-similarity)
注重模块化的恶意软件相似度平台。
#### [splintersfury/driver_analyzer](https://github.com/splintersfury/driver_analyzer)
可扩展的 Windows 驱动程序漏洞分析流水线。

标签:DAST, Karton, Python, Redis, S3, 云资产清单, 任务队列, 分布式框架, 后端开发, 威胁情报, 开发者工具, 开源, 恶意软件分析, 搜索引擎查询, 无后门, 样本处理, 漏洞探索, 自动化管道, 请求拦截, 逆向工具, 逆向工程