AI智能摘要
你是否希望在红蓝攻防演练中,第一时间感知红队攻击动作?本文揭秘一个实用的IPS监控声音告警脚本,通过实时解析IPS日志,自动识别红队IP发起的攻击并触发声光报警。脚本支持自定义红队IP列表,利用Python结合pygame实现攻击告警提示,帮助蓝队快速响应、精准定位威胁。适合攻防演练中的实时监控场景,提升防守效率。
— AI 生成的文章内容摘要
攻防演练时写的小脚本,挺管用的,记录一下。。。

#!coding:utf-8
from socket import *
import pygame,re
tmpSip = ''
tmpDip = ''
#!红队IP
Sip = ['210.72.243.18','114.242.71.226','114.242.71.227','114.242.71.228','114.242.71.229','114.242.71.230','114.242.71.231','114.242.71.232','114.242.71.233','114.242.71.234','114.242.71.235','114.242.71.236','114.242.71.237','114.242.71.238','114.242.71.239','114.242.71.240','114.242.71.241','114.242.71.242','114.242.71.243','114.242.71.244','114.242.71.245','114.242.71.246','114.242.71.247','114.242.71.248','114.242.71.249','114.242.71.250','114.242.71.251','114.242.71.252','114.242.71.253','114.242.71.254','1.50.104.62','14.135.74.35']
#接收IPS告警
revlog = socket(AF_INET,SOCK_DGRAM)
addr = ('172.16.26.122',514)
revlog.bind(addr)
while True:
receive_data = revlog.recvfrom(204800)
date = receive_data[0]#decode('gbk')# 存储接收的数据
addr = receive_data[1]
Dev_ip = addr[0]
port = addr[1]
#监测红队IP
SrcIP = str(re.findall("SrcIP=+(d+S+)",date)[0])
DstIP = str(re.findall("DstIP=+(d+S+)",date)[0])
EventName = str(re.findall("EventName=+(S+)",date)[0])#.decode('gbk').encode('utf-8')
SecurityType = str(re.findall("SecurityType=+(S+)",date)[0])#.decode('gbk').encode('utf-8')
ProtocolType = str(re.findall("ProtocolType=+(S+)",date)[0])#.decode('gbk').encode('utf-8')
Action = str(re.findall("Action=+(w+)",date)[0])
print "=",#日志接收状态
#!去重
if tmpSip == SrcIP:
if tmpDip == DstIP:
continue
#!告警
if SrcIP in Sip:
tmpSip = SrcIP
tmpDip = DstIP
pygame.mixer.init()
track = pygame.mixer.music.load(r"D:auto-toolstoollisteningMP3620.wav")
pygame.mixer.music.play()
#print "+++"*10
print "+++++ This is IPS +++++n"
print "检测到红队攻击IP %s 目标服务器IP:%s 安全事件:%s 类型:%s 动作:%sn".decode('UTF-8').encode('GBK') %(SrcIP,DstIP,EventName,SecurityType,Action)
print "+++"*10

印度 1F
这个脚本思路不错,告警用声音比弹窗实用多了。
江西省南昌市 2F
Python写的?看起来是监控IPS日志触发播放音频。
日本 3F
有没有考虑过加个邮件或者钉钉通知?光声音容易错过。
韩国 4F
之前蓝队演练用过类似的,不过我们是直接推送到大屏。
湖南省长沙市 5F
这个IP列表是固定的吗?感觉红队IP可能会变啊。
泰国 6F
声音告警这个点可以,晚上值班不会打瞌睡了hhh。