关于ICSpector

ICSpector是一款功能强大的开源工业PLC安全取证框架,该工具由微软的研究人员负责开发和维护,可以帮助广大研究人员轻松分析工业PLC元数据和项目文件。

ICSpector提供了方便的方式来扫描PLC并识别ICS环境中的可疑痕迹,可以用于手动检查、自动监控任务或响应事件以检测受损设备。在该工具的帮助下,安全研究人员和取证分许人员可以轻松审查输出结果并根据自己的特定需求进行定制化开发。

工具要求

Python 3.9+

Microsoft Visual C++ 14.0

工具架构

工具安装

由于该工具基于Python 3开发,因此我们首先需要在本地设备上安装并配置好Python 3.9+环境。接下来,广大研究人员可以直接使用下列命令将该项目源码克隆至本地:

git clone https://github.com/microsoft/ics-forensics-tools.git

然后切换到项目目录中,使用pip工具和项目提供的requirements.txt文件安装该工具所需的其他依赖组件:

cd ics-forensics-tools

pip install -r requirements.txt

工具参数选项

常用应用程序参数选项

参数

描述

必选/可选

-h, --help

显示帮助信息和退出

可选

-s, --save-config

存储配置文件

可选

-c, --config

配置文件路径,默认为config.json

可选

-o, --output-dir

输出目录路径,默认为output

可选

-v, --verbose

Verbose模式

可选

-p, --multiprocess

以多进程模式运行

可选

特定插件参数选项

参数

描述

必选/可选

-h, --help

显示帮助信息和退出

可选

--ip

地址文件路径、CIDR或IP地址CSV文件路径

必选

--port

端口号

可选

--transport

tcp/udp

可选

--analyzer

要运行的分析器

可选

工具使用

工具命令行使用

python driver.py -s -v PluginName --ip ips.csv
python driver.py -s -v PluginName --ip ips.csv --analyzer AnalyzerName
python driver.py -s -v -c config.json --multiprocess

以代码库形式导入使用

from forensic.client.forensic_client import ForensicClient

from forensic.interfaces.plugin import PluginConfig

forensic = ForensicClient()

plugin = PluginConfig.from_json({

    "name": "PluginName",

    "port": 123,

    "transport": "tcp",

    "addresses": [{"ip": "192.168.1.0/24"}, {"ip": "10.10.10.10"}],

    "parameters": {

    },

    "analyzers": []

})

forensic.scan([plugin])

添加插件

研究人员在根据实际需求进行本地自定义开发时,请确保将src目录标记为“Sources Root”。接下来,按照下列步骤开发即可:

1、在插件目录下使用插件名称创建一个新的目录;

2、使用插件名称创建一个新的Python文件;

3、使用下列模板代码开发自己的插件,并将其中的“General”替换为你的插件名称;

from pathlib import Path

from forensic.interfaces.plugin import PluginInterface, PluginConfig, PluginCLI

from forensic.common.constants.constants import Transport

 

 

class GeneralCLI(PluginCLI):

    def __init__(self, folder_name):

        super().__init__(folder_name)

        self.name = "General"

        self.description = "General Plugin Description"

        self.port = 123

        self.transport = Transport.TCP

 

    def flags(self, parser):

        self.base_flags(parser, self.port, self.transport)

        parser.add_argument('--general', help='General additional argument', metavar="")

 

 

class General(PluginInterface):

    def __init__(self, config: PluginConfig, output_dir: Path, verbose: bool):

        super().__init__(config, output_dir, verbose)

 

    def connect(self, address):

        self.logger.info(f"{self.config.name} connect")

 

    def export(self, extracted):

        self.logger.info(f"{self.config.name} export")

添加分析器

1、在分析器目录下使用跟分析器相关的插件名创建一个新的目录;

2、使用分析器名称创建一个新的Python文件;

3、使用下列模板开发自己的分析器,并将其中的“General”替换为你的分析器名称;

from pathlib import Path

from forensic.interfaces.analyzer import AnalyzerInterface, AnalyzerConfig

 

 

class General(AnalyzerInterface):

    def __init__(self, config: AnalyzerConfig, output_dir: Path, verbose: bool):

        super().__init__(config, output_dir, verbose)

        self.plugin_name = 'General'

        self.create_output_dir(self.plugin_name)

 

    def analyze(self):

      pass

工具运行截图

许可证协议

本项目的开发与发布遵循MIT开源许可证协议。

项目地址

ICSpector:【GitHub传送门

参考资料

Download Python | Python.org

Download Visual Studio Tools - Install Free for Windows, Mac, Linux

Microsoft Defender for IoT | Microsoft Security

Microsoft Security Response Center

ICS 2022: Deep Dive Into PLC Ladder Logic Forensic...

https://www.youtube.com/watch?v=g3KLq_IHId4&ab_channel=MicrosoftSecurityCommunity

Logo

瓜分20万奖金 获得内推名额 丰厚实物奖励 易参与易上手

更多推荐