
目的:用于监听可疑活动并触发警报的服务器,供蓝队进行调查。该服务器模拟安全运营中心(SOC)的监控和警报流程。
服务器脚本 (blue_team_server.py):
from fastapi import FastAPI, BackgroundTasks
import logging
import random
app = FastAPI()
logging.basicConfig(filename='alerts.log', level=logging.INFO)
@app.get("/detect-activity")
async def detect_activity():
activities = [
"检测到异常登录尝试",
"检测到多次密码尝试失败",
"检测到可疑文件下载",
"检测到异常出站流量"
]
activity = random.choice(activities)
logging.info(f"警报: {activity}")
return {"alert": activity}
@app.get("/alerts")
async def get_alerts():
with open('alerts.log', 'r') as file:
logs = file.readlines()
return {"alerts": logs}
if __name__ == "__main__":
import uvicorn
uvicorn.run(app, host="0.0.0.0", port=8002)uvicorn blue_team_server:app --reload该服务器提供了一个警报系统的模拟实现,能够记录可疑活动并允许蓝队查询日志。它模拟了安全团队监控和响应威胁的真实场景。
相关标签:
#蓝队 #网络防御 #安全监控 #SOC #事件响应
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。