- ubuntu12.04环境下使用kvm ioctl接口实现最简单的虚拟机
- Ubuntu 通过无线网络安装Ubuntu Server启动系统后连接无线网络的方法
- 在Ubuntu上搭建网桥的方法
- ubuntu 虚拟机上网方式及相关配置详解
CFSDN坚持开源创造价值,我们致力于搭建一个资源共享平台,让每一个IT人在这里找到属于你的精彩世界.
这篇CFSDN的博客文章python 邮件检测工具mmpi的使用由作者收集整理,如果你对这篇文章有兴趣,记得点赞哟.
mmpi,是一款使用python实现的开源邮件快速检测工具库,基于community框架设计开发。mmpi支持对邮件头、邮件正文、邮件附件的解析检测,并输出json检测报告.
mmpi,代码项目地址:https://github.com/a232319779/mmpi,pypi项目地址https://pypi.org/project/mmpi/ 。
mmpi,邮件快速检测工具库检测逻辑:
ole文件格式:如doc、xls等,提取其中的vba宏代码、模板注入链接 zip文件格式:提取压缩文件列表,统计文件名、文件格式等 rtf文件格式:解析内嵌ole对象等 其他文件格式:如PE可执行文件 。
基础信息规则检测方式 yara规则检测方式 。
mmpi的分析判定检测前提:邮件系统环境。脱离邮件环境上下文,检测规则的依据就不可靠了.
使用方式 。
1
|
$ pip install mmpi
|
备注:windows安装yara-python,可以从这里下载 。
1
|
$ mmpi
-
run $email_path
|
1
2
3
4
5
6
7
8
9
10
11
12
|
from
mmpi
import
mmpi
def
main():
emp
=
mmpi()
emp.parse(
'test.eml'
)
report
=
emp.get_report()
print
(report)
if
__name__
=
=
"__main__"
:
main()
|
1
2
3
4
5
6
7
8
9
10
|
{
// 固定字段
"headers"
: [],
"body"
: [],
"attachments"
: [],
"signatures"
: []
// 动态字段
"vba"
: [],
"rtf"
: [],
}
|
mmpi完全基于python开发,使用python原生email、html、zip库进行解析,基于oletool做定制化修改,支持对office文档和rtf文档的解析,再结合yara实现对其他文件的检测.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
.
├── mmpi
│ ├── common
│ ├── core
│ ├── data
│ │ ├── signatures
│ │ │ ├── eml
│ │ │ ├── html
│ │ │ ├── ole
│ │ │ ├── other
│ │ │ ├── rtf
│ │ │ └──
zip
│ │ ├── white
│ │ └── yara
│ │ ├── exe
│ │ ├── pdf
│ │ └── vba
│ └── processing
└── tests
└── samples
|
1. PE文件伪装文档类检测 检测规则:压缩包中文件名以.exe结尾,并且中间插入20个以上空格的 。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
class
PEFakeDocument(Signature):
authors
=
[
"ddvv"
]
sig_type
=
'zip'
name
=
"pe_fake_document"
severity
=
9
description
=
"PE File Fake Document"
def
on_complete(
self
):
results
=
self
.get_results()
for
result
in
results:
if
result.get(
'type'
, '')
=
=
self
.sig_type:
infos
=
result.get(
'value'
, {}).get(
'infos'
, [])
for
info
in
infos:
file_type
=
info.get(
'type'
)
file_name
=
info.get(
'name'
)
space_count
=
file_name.count(
' '
)
if
'exe'
=
=
file_type
and
space_count >
20
:
self
.mark(
type
=
"zip"
, tag
=
self
.name, data
=
info.get(
'name'
))
return
self
.has_marks()
return
None
|
2. DLL劫持检测 检测规则:压缩包中同时存在exe和dll文件 。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
class
DLLHijacking(Signature):
authors
=
[
"ddvv"
]
sig_type
=
'zip'
name
=
"dll_hijacking"
severity
=
9
description
=
"DLL Hijacking"
def
on_complete(
self
):
results
=
self
.get_results()
for
result
in
results:
if
result.get(
'type'
, '')
=
=
self
.sig_type:
infos
=
result.get(
'value'
, {}).get(
'infos'
, [])
file_types
=
[info.get(
'type'
)
for
info
in
infos]
if
set
([
'exe'
,
'dll'
]).issubset(file_types):
self
.mark(
type
=
"zip"
, tag
=
self
.name)
return
self
.has_marks()
return
None
|
3. RTF漏洞利用检测 检测规则:RTF文档中存在OLE对象,并且class_name是OLE2Link或者以equation开头 。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
class
RTFExploitDetected(Signature):
authors
=
[
"ddvv"
]
sig_type
=
'rtf'
name
=
"rtf_exploit_detected"
severity
=
9
description
=
"RTF Exploit Detected"
def
on_complete(
self
):
results
=
self
.get_results()
for
result
in
results:
if
result.get(
'type'
, '')
=
=
self
.sig_type:
infos
=
result.get(
'value'
, {}).get(
'infos'
, [])
for
info
in
infos:
if
info.get(
'is_ole'
,
False
):
class_name
=
info.get(
'class_name'
, '')
if
class_name
=
=
'OLE2Link'
or
class_name.lower().startswith(
'equation'
):
self
.mark(
type
=
"rtf"
, tag
=
self
.name)
return
self
.has_marks()
return
None
|
结果说明:邮件包含漏洞利用的RTF文档,属于恶意邮件.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
{
"headers"
: [
{
"From"
: [
{
"name"
:
"Mohd Mukhriz Ramli (MLNG/GNE)"
,
"addr"
:
"info@vm1599159.3ssd.had.wf"
}
],
"To"
: [
{
"name"
:
""
,
"addr"
:
""
}
],
"Subject"
:
"Re: Proforma Invoice"
,
"Date"
:
"2020-11-24 12:37:38 UTC+01:00"
,
"X-Originating-IP"
: []
}
],
"body"
: [
{
"type"
:
"text"
,
"content"
:
" \nDEAR SIR, \n\nPLEASE SIGN THE PROFORMA INVOICE SO THAT I CAN PAY AS SOON AS POSSIBLE.\n\nATTACHED IS THE PROFORMA INVOICE,\n\nPLEASE REPLY QUICKLY, \n\nTHANKS & REGARDS' \n\nRAJASHEKAR \n\n Dubai I Kuwait I Saudi Arabia I India I Egypt \nKuwait: +965 22261501 \nSaudi Arabia: +966 920033029 \nUAE: +971 42431343 \nEmail ID: help@rehlat.co [1]m\n \n\nLinks:\n------\n[1]\nhttps://deref-mail.com/mail/client/OV1N7sILlK8/dereferrer/?redirectUrl=https%3A%2F%2Fe.mail.ru%2Fcompose%2F%3Fmailto%3Dmailto%253ahelp%40rehlat.com"
}
],
"attachments"
: [
{
"type"
:
"doc"
,
"filename"
:
"Proforma Invoice.doc"
,
"filesize"
: 1826535,
"md5"
:
"558c4aa596b0c4259182253a86b35e8c"
,
"sha1"
:
"63982d410879c09ca090a64873bc582fcc7d802b"
}
],
"vba"
: [],
"rtf"
: [
{
"is_ole"
:
true
,
"format_id"
: 2,
"format_type"
:
"Embedded"
,
"class_name"
:
"EQUATion.3"
,
"data_size"
: 912305,
"md5"
:
"a5cee525de80eb537cfea247271ad714"
}
],
"signatures"
: [
{
"name"
:
"rtf_suspicious_detected"
,
"description"
:
"RTF Suspicious Detected"
,
"severity"
: 3,
"marks"
: [
{
"type"
:
"rtf"
,
"tag"
:
"rtf_suspicious_detected"
}
],
"markcount"
: 1
},
{
"name"
:
"rtf_exploit_detected"
,
"description"
:
"RTF Exploit Detected"
,
"severity"
: 9,
"marks"
: [
{
"type"
:
"rtf"
,
"tag"
:
"rtf_exploit_detected"
}
],
"markcount"
: 1
}
]
}
|
以上就是python 邮件检测工具mmpi的使用的详细内容,更多关于python mmpi库实现邮件检测的资料请关注我其它相关文章! 。
原文链接:https://www.cnblogs.com/ddvv/p/14225799.html 。
最后此篇关于python 邮件检测工具mmpi的使用的文章就讲到这里了,如果你想了解更多关于python 邮件检测工具mmpi的使用的内容请搜索CFSDN的文章或继续浏览相关文章,希望大家以后支持我的博客! 。
我想在文本区域中向许多其他用户发送电子邮件。在名为内容的文本区域中,如果我键入星号包围的“用户”,我想让它们填写每个电子邮件的用户名(“@”之前的文本)。每封电子邮件中的每个用户名都会产生很多不同。然
这个问题在这里已经有了答案: 关闭 10 年前。 Possible Duplicate: Problem when loading php file into variable (Load resu
我正在从数据库中提取信息,并尝试将其作为电子邮件发送。将从数据库中拉取多行数据。这就是我的代码的样子... 所有的信息邮件都很好。我的问题是,我想保留中断。例如,在标题之后,我想中断一下,然后开始备
当我使用我们使用 java 邮件的门户发送 TEXT 电子邮件时没有问题,但是,当我选择放置 HTML 内容并发送电子邮件时,会引发以下警报。花了几个小时搜索但没有有用的答案! 谁能帮忙 电子邮件主题
我有这个类,它处理 gmail 的登录。无论我输入什么电子邮件和密码,程序都会返回 session 。我不明白如何在返回 session 对象之前检查登录是否成功。 package mailActio
我设置的短信作为文本文件附在信中。我不明白为什么会这样。 replied letter example public void sendEmail(MimeMessage message, Strin
所以我正在制作一个网络系统,这个想法是当用户关闭浏览器时它会向我发送一封电子邮件。目前,用户正在使用 Javascript Ajax 来让 PHP 更新数据库的当前时间。当时间超过 5 分钟时,我希望
我想发送邮件,当产品从之前、日期和之后过期时,在 php 中,我在 php 中使用了 datediff mysql 函数,但如果产品过期日期类似于 31-1-2012 ,则不同值是不适合我的编码,请帮
我正在尝试设置一个邮件脚本,该脚本将首先从 mysql 运行一个简单的选择,并在消息中使用这些数组变量。然而,所有的变量并没有输出到消息体,只有一行变量。这是我的脚本: $sql1 = "SE
我最近一直在努力研究这个问题。是否有我可以使用并添加到其中的 android API?我想为电子邮件应用程序制作一个插件,但我不想制作整个电子邮件应用程序。 我非常想要一些已经可以处理发送和接收电子邮
嗨 我有一个 PHP 西类牙文网站。在此邮件正文中包含一个主题“Solicitud de cotización”,但该主题出现在热门邮箱中,如 Solicitud de cotización 。但它在
我想写一个脚本,使用 php 自动向我的客户发送电子邮件 我如何自动发送它,例如,如果他们输入他们的电子邮件。然后点击提交 我想自动发送这封邮件 其次,我的主机上是否需要 smtp 服务器?我可以在任
今天早上我已经解决了一个问题: Java Mail, sending multiple attachments not working 这次我遇到了一个稍微复杂一点的问题:我想将附件和图片结合起来。
下面是用于连接 IMAP 文件夹并对其执行操作的代码。所以我的问题是关于 javax.mail.Session 的,在这种情况下它会每秒重新创建一次(取决于 checkInbox() 的 hibern
我正尝试按照 http://www.tutorialspoint.com/java/java_sending_email.htm 上的指南发送电子邮件 Java 应用程序 当我尝试运行它时,从上面的链
我有一个包含 2 列 email 和 id 的表格。我需要找到密切相关的电子邮件。例如: john.smith12@example.com 和 john.smith12@some.subdomains
首先是一些信息: Debian 压缩 PHP 5.3.3 带有 mod_cgi 的 PHP 在这种情况下,我绝对必须使用 mail()。对于我所有的其他项目,我已经使用 SMTP 邮件。 我已将站点超
在对电子邮件主机的联系表单进行故障排除时,他们告诉我在 php 邮件功能的发件人地址中使用“-f”。 “-f”标志的作用是什么?为什么它可以解决允许发送电子邮件的问题?我阅读了一些文档,但不是很清楚。
一个简单的问题:群发邮件哪个性能好? mail() 函数或sendmail 流行的 PHP 列表管理器包使用哪个? 最佳答案 嗯,mail() 函数并不适合批量发送电子邮件,因为它会为您发送的每封
我正在制作一个 PHP 表单,允许用户上传附件并将其发送到我的电子邮件。我一直在寻找很长一段时间才能做到。最后,我找到了这个。 http://www.shotdev.com/php/php-mail/
我是一名优秀的程序员,十分优秀!