最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

python 郵件檢測(cè)工具mmpi的使用

 更新時(shí)間:2021年01月04日 08:39:30   作者:ddvv  
這篇文章主要介紹了python 用mmpi庫(kù)實(shí)現(xiàn)郵件檢測(cè)的方法,幫助大家更好的理解和使用python,感興趣的朋友可以了解下

概要介紹

mmpi,是一款使用python實(shí)現(xiàn)的開源郵件快速檢測(cè)工具庫(kù),基于community框架設(shè)計(jì)開發(fā)。mmpi支持對(duì)郵件頭、郵件正文、郵件附件的解析檢測(cè),并輸出json檢測(cè)報(bào)告。

mmpi,代碼項(xiàng)目地址:https://github.com/a232319779/mmpi,pypi項(xiàng)目地址https://pypi.org/project/mmpi/

mmpi,郵件快速檢測(cè)工具庫(kù)檢測(cè)邏輯:

  • 支持解析提取郵件頭數(shù)據(jù),包括收件人、發(fā)件人的姓名和郵箱,郵件主題,郵件發(fā)送時(shí)間,以及郵件原始發(fā)送IP。通過檢測(cè)發(fā)件人郵箱和郵件原始發(fā)送IP,實(shí)現(xiàn)對(duì)郵件頭的檢測(cè)。
  • 支持對(duì)郵件正文的解析檢測(cè),提取text和html格式的郵件正文,對(duì)text郵件正文進(jìn)行關(guān)鍵字匹配,對(duì)html郵件正文進(jìn)行解析分析檢測(cè),實(shí)現(xiàn)探針郵件檢測(cè)、釣魚郵件檢測(cè)、垃圾郵件檢測(cè)等其他檢測(cè)。
  • 支持對(duì)郵件附件等解析檢測(cè)

ole文件格式:如doc、xls等,提取其中的vba宏代碼、模板注入鏈接
zip文件格式:提取壓縮文件列表,統(tǒng)計(jì)文件名、文件格式等
rtf文件格式:解析內(nèi)嵌ole對(duì)象等
其他文件格式:如PE可執(zhí)行文件

  • 檢測(cè)方式包括

基礎(chǔ)信息規(guī)則檢測(cè)方式
yara規(guī)則檢測(cè)方式

適用前提

mmpi的分析判定檢測(cè)前提:郵件系統(tǒng)環(huán)境。脫離郵件環(huán)境上下文,檢測(cè)規(guī)則的依據(jù)就不可靠了。

使用方式

1. 安裝

$ pip install mmpi

備注:windows安裝yara-python,可以從這里下載

2. 命令執(zhí)行

$ mmpi-run $email_path

3. 快速開始

from mmpi import mmpi


def main():
  emp = mmpi()
  emp.parse('test.eml')
  report = emp.get_report()
  print(report)


if __name__ == "__main__":
  main()

4. 輸出格式

{
	 // 固定字段
  "headers": [],
  "body": [],
  "attachments": [],
  "signatures": []
  // 動(dòng)態(tài)字段
  "vba": [],
  "rtf": [],
}

工具特色

mmpi完全基于python開發(fā),使用python原生email、html、zip庫(kù)進(jìn)行解析,基于oletool做定制化修改,支持對(duì)office文檔和rtf文檔的解析,再結(jié)合yara實(shí)現(xiàn)對(duì)其他文件的檢測(cè)。

項(xiàng)目代碼結(jié)構(gòu)

.
├── mmpi
│   ├── common
│   ├── core
│   ├── data
│   │   ├── signatures
│   │   │   ├── eml
│   │   │   ├── html
│   │   │   ├── ole
│   │   │   ├── other
│   │   │   ├── rtf
│   │   │   └── zip
│   │   ├── white
│   │   └── yara
│   │     ├── exe
│   │     ├── pdf
│   │     └── vba
│   └── processing
└── tests
  └── samples
  • mmpi/common:基礎(chǔ)模塊,實(shí)現(xiàn)基本流程功能
  • mmpi/core:核心調(diào)度模塊,實(shí)現(xiàn)插件的加載及相關(guān)模塊的初始化
  • mmpi/data:核心檢測(cè)模塊,實(shí)現(xiàn)基本檢測(cè)規(guī)則及yara檢測(cè)規(guī)則
  • mmpi/processing:核心解析模塊,實(shí)現(xiàn)eml、html、zip等文件格式的解析
  • tests:測(cè)試模塊

檢測(cè)規(guī)則示例說明

1. PE文件偽裝文檔類檢測(cè)
檢測(cè)規(guī)則:壓縮包中文件名以.exe結(jié)尾,并且中間插入20個(gè)以上空格的

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劫持檢測(cè)
檢測(cè)規(guī)則:壓縮包中同時(shí)存在exe和dll文件

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漏洞利用檢測(cè)
檢測(cè)規(guī)則:RTF文檔中存在OLE對(duì)象,并且class_name是OLE2Link或者以equation開頭

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

結(jié)果示例

結(jié)果說明:郵件包含漏洞利用的RTF文檔,屬于惡意郵件。

  • 包括收發(fā)件人信息、主題信息、發(fā)送時(shí)間,郵件正文,以及附件信息。
  • vba和rtf字段為附件檢測(cè)基本信息。
  • signatures字段說明命中規(guī)則。
{
  "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 郵件檢測(cè)工具mmpi的使用的詳細(xì)內(nèi)容,更多關(guān)于python mmpi庫(kù)實(shí)現(xiàn)郵件檢測(cè)的資料請(qǐng)關(guān)注腳本之家其它相關(guān)文章!

相關(guān)文章

  • python爬蟲用scrapy獲取影片的實(shí)例分析

    python爬蟲用scrapy獲取影片的實(shí)例分析

    在本篇內(nèi)容里小編給大家整理的是一篇關(guān)于python爬蟲用scrapy獲取影片的實(shí)例分析內(nèi)容,有興趣的朋友們可以參考下。
    2020-11-11
  • Python實(shí)現(xiàn)京東搶秒殺功能

    Python實(shí)現(xiàn)京東搶秒殺功能

    這篇文章主要介紹了Python實(shí)現(xiàn)京東搶秒殺功能,本文給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
    2021-01-01
  • Python中搜索和替換文件中的文本的實(shí)現(xiàn)(四種)

    Python中搜索和替換文件中的文本的實(shí)現(xiàn)(四種)

    本文主要介紹了Python中搜索和替換文件中的文本的實(shí)現(xiàn),文中通過示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2021-10-10
  • python mysql實(shí)現(xiàn)學(xué)生成績(jī)管理系統(tǒng)

    python mysql實(shí)現(xiàn)學(xué)生成績(jī)管理系統(tǒng)

    這篇文章主要為大家詳細(xì)介紹了python mysql實(shí)現(xiàn)學(xué)生成績(jī)管理系統(tǒng),文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2021-10-10
  • Pycharm Terminal 與Project interpreter 安裝包不同步問題解決

    Pycharm Terminal 與Project interpreter 安裝

    本文主要介紹了Pycharm Terminal 與Project interpreter 安裝包不同步問題解決,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2023-02-02
  • Python?如何引用不確定的函數(shù)

    Python?如何引用不確定的函數(shù)

    在Python中,引用不確定的函數(shù)通常意味著我們可能在運(yùn)行時(shí)才知道要調(diào)用哪個(gè)函數(shù),或者我們可能想根據(jù)某些條件動(dòng)態(tài)地選擇不同的函數(shù)來執(zhí)行,下面給大家分享Python?如何引用不確定的函數(shù),感興趣的朋友跟隨小編一起看看吧
    2024-07-07
  • 在python中按照特定順序訪問字典的方法詳解

    在python中按照特定順序訪問字典的方法詳解

    今天小編就為大家分享一篇在python中按照特定順序訪問字典的方法詳解,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過來看看吧
    2018-12-12
  • 使用python更改Word文檔字體的操作代碼

    使用python更改Word文檔字體的操作代碼

    更改文字字體是編輯和美化Word文檔時(shí)的一項(xiàng)常見需求,使用合適的字體不僅可以提升文檔的整體視覺效果,還能突顯關(guān)鍵信息,本文將介紹如何通過Python代碼更改Word文檔字體,實(shí)現(xiàn)批量操作與自動(dòng)化,需要的朋友可以參考下
    2024-08-08
  • 使用Flask創(chuàng)建簡(jiǎn)單的圖片上傳站點(diǎn)的流程步驟

    使用Flask創(chuàng)建簡(jiǎn)單的圖片上傳站點(diǎn)的流程步驟

    在網(wǎng)絡(luò)應(yīng)用程序中,實(shí)現(xiàn)圖片上傳功能是一項(xiàng)常見的需求,Flask框架提供了簡(jiǎn)單而靈活的工具,使得構(gòu)建這樣的功能變得相對(duì)簡(jiǎn)單,本文將介紹如何使用Flask框架創(chuàng)建一個(gè)簡(jiǎn)單的圖片上傳站點(diǎn),以及其中涉及的關(guān)鍵技術(shù)和步驟,需要的朋友可以參考下
    2024-05-05
  • Python 3.8新特征之a(chǎn)syncio REPL

    Python 3.8新特征之a(chǎn)syncio REPL

    我最近都在寫一些Python 3.8的新功能介紹的文章,在自己的項(xiàng)目中也在提前體驗(yàn)新的Python版本。這篇文章主要介紹了Python 3.8新特征之a(chǎn)syncio REPL,需要的朋友可以參考下
    2019-05-05

最新評(píng)論

汉沽区| 大埔区| 手游| 丽江市| 江山市| 临沭县| 平定县| 泸水县| 合川市| 屯门区| 三都| 大宁县| 横山县| 江陵县| 东辽县| 庆元县| 惠来县| 宁陵县| 松潘县| 五台县| 大理市| 依安县| 团风县| 新津县| 阿合奇县| 邹城市| 崇礼县| 余姚市| 陆川县| 浦县| 株洲县| 来安县| 石门县| 竹溪县| 东至县| 安泽县| 霍城县| 台北县| 嘉峪关市| 阿坝县| 盘山县|