闽盾杯复赛

本文最后更新于:2023年6月5日 下午

签到好难战队wp

威胁情报分析2

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# -*- coding = utf-8 -*-
# @Time : 2023/5/26 9:40
# @Author : Leekos
# @File : 威胁情报分析2.py
# @Software : PyCharm


import json
import re

f = open("network.txt","r")
data = json.load(f)
dic = {}

for line in data:
DestHost = line['DestHost']
rel = re.match("[a-zA-Z]+",DestHost)
if rel:
ls = DestHost.split(".")
length = len(ls)
if length == 2:
value = dic.get(DestHost,0)
dic[DestHost] = value + 1

elif length == 3:
value = dic.get(DestHost, 0)
dic[DestHost] = value + 1
Host2 = ls[1]+"."+ls[2]
value2 = dic.get(Host2,0)
dic[Host2] = value2 + 1

elif length == 4:
value = dic.get(DestHost, 0)
dic[DestHost] = value + 1
Host2 = ls[0] + "." + ls[1] + "." + ls[2]
value2 = dic.get(Host2, 0)
dic[Host2] = value2 + 1
Host3 = ls[1]+"."+ls[2]
value3 = dic.get(Host3, 0)
dic[Host3] = value3 + 1


print(sorted(dic.items(), key=lambda item:item[1], reverse=True))

运行脚本,flag在生成的字典的第三个值


闽盾杯复赛
https://leekosss.github.io/2023/08/24/闽盾杯复赛/
作者
leekos
发布于
2023年8月24日
更新于
2023年6月5日
许可协议