![](https://news.xinpengboligang.com/upload/keji/5a98d7e77b7debedef64cc9b73f45548.jpeg)
關於ICSpector
ICSpector是一款功能強大的開源工業PLC安全取證框架,該工具由微軟的研究人員負責開發和維護,可以幫助廣大研究人員輕松分析工業PLC元數據和項目文件。
ICSpector提供了方便的方式來掃描PLC並識別ICS環境中的可疑痕跡,可以用於手動檢查、自動監控任務或響應事件以檢測受損設備。在該工具的幫助下,安全研究人員和取證分許人員可以輕松審查輸出結果並根據自己的特定需求進行定制化開發。
工具要求
Python 3.9
Microsoft Visual C 14.0
工具架構
![](https://news.xinpengboligang.com/upload/keji/cf278d915d37829874362bf177da543f.jpeg)
工具安裝
由於該工具基於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
工具運行截圖
![](https://news.xinpengboligang.com/upload/keji/d9dc34bee5c6e465c75966dac6d48bc9.jpeg)
![](https://news.xinpengboligang.com/upload/keji/a971a7a084bcd15d7fd6fbe285374264.jpeg)
![](https://news.xinpengboligang.com/upload/keji/d570a7f8717afa73701fa6ddbde390e8.jpeg)
許可證協議
本項目的開發與發佈遵循MIT開源許可證協議。
項目地址
ICSpector:https://github.com/microsoft/ics-forensics-tools
參考資料
https://www.python.org/downloads
https://visualstudio.microsoft.com/downloads/
https://azure.microsoft.com/en-us/services/iot-defender/#overview
https://msrc-blog.microsoft.com/?s=section 52
https://ics2022.sched.com/event/15DB2/deep-dive-into-plc-ladder-logic-forensics
https://www.youtube.com/watch?v=g3KLq_IHId4&ab_channel=MicrosoftSecurityCommunity