工控安全 : siemens 仿真搭建实验
前言
之前介绍过利用Snap7模拟的S7设备启停实验,在没有真实PLC的条件下获取S7通讯数据报文,或者测试第三方上位软件与西门子PLC通讯,这种本地的PLC仿真器就无法胜任了,在没有真实的西门子PLC设备情况的情况下,我们可以通过plcsim搭建仿真环境。
STEP7
安装STEP7,确保有相应组件

先安装 STEP7

打开,重启计算机

重启,右键-以管理员权限运行,一路下一步

许可证这里选择,否,以后再传送许可证密钥,下面一路下一步

这里由于没有以管理员权限运行,运行到安装 step7 时报错,就
以管理员权限运行重新打开了一次

等到所有组件安装完毕后,这里需要手动中止安装.


在这个界面,我等了10分钟都没有反应,就直接资源管理器杀掉安装进程了,后续使用时没有发现有任何影响.

继续安装 plcsim
plcsim
安装 plcsim

打开,要求你先重启计算机

重启,打开,注意,右键-以管理员权限运行,一路下一步,等待安装完毕
服务器使用plcsim
打开 SIMATIC Manager 软件,新建项目 test2



在新建项目 test2 点击插入新对象,并选择 SIMATIC 300 站点

选择 SIMATIC300( 1 ) 打开对象

在 HW Config 界面下选择 SIMATIC 300,并选择 RACK-300 下的 Rail

UR(0)对话框中的序号槽1中右键

插入对象PS 307 2A

在序号槽2中点击右键插入对象 CPU 314C-2PN/DP V3.3

新建子网设置 ip 地址为本机的 IP 地址

启动 S7-PLCSIM

进入 S7-PLCSIM 界面,选择 PLCSIM(TCP/IP)

回到 HW Config 对话框,选择下载到模块



待下载完成,PLCSIM 会显示 PLC 的地址为之前设置的 IP 地址

下载 NetToPLCSim,解压,打开 NetToPLCSim.exe

点击 add,弹出 station 对话框,在 Network IP Address 及 Plcsim IP Address 中选择 IP 地址为之前设置的 ip 地址

点击 Start Server,PLC#001 进入运行状态

回到 S7-PLCSIM ,勾选 RUN

客户机连接
在客户机中打开 Snap7 Client Demo 工具,填写仿真 PLC 的 IP 地址如:192.168.141.131,点击 Connect

如果这里连接失败,应该是因为服务器防火墙开着,关闭防火墙即可
再在 control 下点击 stop 按钮即停止 PLC 的命令

查看靶机中仿真 PLC 的状态从 run 变为 stop

无论是研究工控安全,还是CTF中S7的流量分析题,单纯依靠snap7是不够的。而搭建仿真环境,可以胜任很多在局域网络中对西门子PLC的安全研究工作(如实训平台),只需启动更多的靶机和操作机即可。