C
S
学
习
记
录
-
探
测
&
提
取
配
置
B
e
a
c
o
n
是
C
o
b
a
l
t
¨NBSP;
S
t
r
i
k
e
运
⾏
在
⽬
标
主
机
上
的
pa
y
l
o
a
d
,
B
e
a
c
o
n
在
隐
蔽
信
道
上
我
们
提
供
服
务
,
⽤
于
⻓
期
控
制
受
感
染
主
机
。
它
的
⼯
作
⽅
式
与
Me
t
a
s
p
l
o
i
t
F
r
a
m
e
w
o
r
k
P
a
y
l
o
a
d
类
似
。
在
实
际
渗
透过
程
中
,
我
们
可
以
将
其
嵌
⼊到
可
执
⾏
⽂
件
、
添
加到
Wo
r
d
⽂
档
或
者
通过
利
⽤
主
机
漏
洞
来
传
递
B
e
a
c
o
n
。
h
t
t
p
s
:
//c
o
b
a
l
t
-
s
t
r
i
k
e
.
g
i
t
h
u
b
.
i
o
/c
o
m
m
u
n
i
t
y
_k
i
t
/
<https://cobalt-strike.github.io/community_kit/>
C
o
b
a
l
t
S
t
r
i
k
e
服
务
器
附
带
⼀个
默
认证
书
,
显
示
序
列
号
、
发
⾏
者
、
主
题
和
证
书
有
效
性
的
特
定
值
,
如
下
所
示
。
D
e
f
a
u
l
t
c
e
r
t
:
s
s
l
.
c
e
r
t
.
s
e
r
i
a
l
:
1
4647
3198
h
t
t
p
s
:
//w
w
w
.
s
h
o
d
a
n
.
i
o
/s
e
a
r
c
h
?
q
u
e
r
y
=
s
s
l
.
c
e
r
t
.
s
e
r
i
a
l
%
3A
1
4647
31
98
<https://www.shodan.io/search?query=ssl.cert.serial%3A146473198>
如
果
它
们
没
有
被
攻
击
者
修
改
,
则
可
以使
⽤
shod
a
n
请
求
轻
松
发
现
这
些
服
务
器
。
在
撰
写
本
⽂
时
,
有
8
0
0
+
台
服
务
器
与
此
证
书
序
列
号匹
配
。
C
o
b
a
l
t
S
t
r
i
k
e
介
绍
B
e
a
c
o
n
是
什么
⼯
具包
发
现
C
&C
服
务
器
默
认证
书
对
于
3.
1
3
<https://download.cobaltstrike.com/releasenotes.txt>
之
前
的
C
o
b
a
l
t
S
t
r
i
k
e
版
本
,
h
t
t
p
响
应
在
h
t
t
p
状
态
的
末
尾
显
示
⼀个
⽆
关
的
空
格
。
⽂
档
介
绍
h
t
t
p
s
:
//t
r
i
a
l
.
c
o
b
a
l
t
s
t
r
i
k
e
.
c
o
m
/h
e
l
p
-
m
a
l
l
e
a
b
l
e
-
c
2
<https://trial.cobaltstrike.com/help-malleable-c2>
根
据
⼤
量
的
ma
l
l
e
a
b
l
e
C
2
p
r
o
f
i
l
e
编
写
查
询
。
示
例使
⽤
微
软
更
新
m
a
l
l
e
a
b
l
e
C
2
p
r
o
f
i
l
e
⽂
件
来
检
测
团
队
服
务
器
的
查
询
。
此
资
料
可
以使
⽤
w
w
w
[
.
]
w
i
n
d
o
w
s
u
p
d
a
t
e
.
c
o
m
,
伪
装
成
⼀个
合
法
的
微
软
证
书
证
书
。
h
t
t
p
s
:
//g
i
t
h
u
b
.
c
o
m
/b
l
u
s
c
r
e
e
n
o
f
j
e
f
f
/M
a
l
l
e
a
b
l
e
-
C
2-
R
a
n
d
o
m
i
z
e
r
/b
l
o
b
/m
a
s
t
e
r
/S
a
m
p
l
e
%
20T
e
m
p
l
a
t
e
s
/m
i
c
r
o
s
o
f
t
u
p
d
a
t
e
_g
e
t
o
n
l
y
.
p
r
o
f
i
l
e
<
h
t
t
p
s
:
//g
i
t
h
u
b
.
c
o
m
/b
l
u
s
c
r
e
e
n
o
f
j
e
f
f
/
M
a
l
l
e
a
b
l
e
-
C
2-
R
a
n
d
o
m
i
z
e
r
/b
l
o
b
/m
a
s
t
e
r
/S
a
m
p
l
e
%
20T
e
m
p
l
a
t
e
s
/m
i
c
r
o
s
o
f
t
u
p
d
a
t
e
_g
e
t
o
n
l
y
.
p
r
o
f
i
l
e
>
s
s
l
.
c
e
r
t
.
s
u
b
j
e
c
t
.
c
n
:
"
w
w
w
.
w
i
n
d
o
w
s
u
p
d
a
t
e
.
c
o
m
"
H
T
T
P
响
应
m
a
l
l
e
a
b
l
e
C
2
p
r
o
f
i
l
e
T
o
p
1
0
J
A
R
M
f
i
n
g
e
r
p
r
i
n
t
s
h
t
t
p
s
:
//g
i
t
h
u
b
.
c
o
m
/c
a
r
b
o
n
b
l
a
c
k
/a
c
t
i
v
e
_c
2_i
o
c
_p
u
b
l
i
c
/b
l
o
b
/m
a
i
n
/c
o
b
a
l
t
s
t
r
i
k
e
/J
A
R
M
/j
a
r
m
_c
s
_2021
07
_u
n
i
q
_s
o
r
t
e
d
.
t
x
t
<
h
t
t
p
s
:
//g
i
t
h
u
b
.
c
o
m
/c
a
r
b
o
n
b
l
a
c
k
/a
c
t
i
v
e
_c
2_i
o
c
_p
u
b
l
i
c
/b
l
o
b
/m
a
i
n
/c
o
b
a
l
t
s
t
r
i
k
e
/J
A
R
M
/j
a
r
m
_c
s
_2021
07
_u
n
i
q
_s
o
r
t
e
d
.
t
x
t
>
J
A
R
M
(
T
L
S
指
纹
识
别
)
h
t
t
p
s
:
//w
w
w
.
s
h
o
d
a
n
.
i
o
/s
e
a
r
c
h
?
q
u
e
r
y
=
s
s
l
.
j
a
r
m
%
3A
07
d
1
4d
1
6d
21
d
21
d
00042d
41
d
00041
d
e
5f
b
30381
04f
457
d
92b
a
02e
931
1
51
2c
2
<
h
t
t
p
s
:
//w
w
w
.
s
h
o
d
a
n
.
i
o
/s
e
a
r
c
h
?
q
u
e
r
y
=
s
s
l
.
j
a
r
m
%
3A
07
d
1
4d
1
6d
21
d
21
d
00042d
41
d
00041
d
e
5f
b
30381
04f
457
d
92b
a
02e
931
1
51
2c
2>
00014d16d21d21d00042d41d00041df1e57cd0b3bf64d18696fb4fce056610
00014d16d21d21d07c42d41d00041d47e4e0ae17960b2a5b4fd6107fbb0926
05d02d16d04d04d05c05d02d05d04d4606ef7946105f20b303b9a05200e829
05d02d20d21d20d05c05d02d05d20dd7fc4c7c6ef19b77a4ca0787979cdc13
05d13d20d21d20d05c05d13d05d20dd7fc4c7c6ef19b77a4ca0787979cdc13
07d00016d21d21d00042d41d00041df1e57cd0b3bf64d18696fb4fce056610
07d0bd0fd06d06d07c07d0bd07d06d9b2f5869a6985368a9dec764186a9175
07d0bd0fd21d21d07c07d0bd07d21d9b2f5869a6985368a9dec764186a9175
07d13d15d21d21d07c07d13d07d21dd7fc4c7c6ef19b77a4ca0787979cdc13
07d14d16d21d21d00007d14d07d21d3fe87b802002478c27f1c0da514dbf80
07d14d16d21d21d00042d41d00041d47e4e0ae17960b2a5b4fd6107fbb0926
07d14d16d21d21d00042d41d00041de5fb3038104f457d92ba02e9311512c2
07d14d16d21d21d07c07d14d07d21d4606ef7946105f20b303b9a05200e829
07d14d16d21d21d07c07d14d07d21d9b2f5869a6985368a9dec764186a9175
07d14d16d21d21d07c07d14d07d21dee4eea372f163361c2623582546d06f8
07d14d16d21d21d07c42d41d00041d24a458a375eef0c576d23a7bab9a9fb1
07d14d16d21d21d07c42d41d00041d58c7162162b6a603d3d90a2b76865b53
07d14d16d21d21d07c42d43d00041d24a458a375eef0c576d23a7bab9a9fb1
07d19d1ad21d21d00007d19d07d21d25f4195751c61467fa54caf42f4e2e61
15d15d15d3fd15d00042d42d00042d1279af56d3d287bbc5d38e226153ba9e
15d3fd16d21d21d00042d43d000000fe02290512647416dcf0a400ccbc0b6b
15d3fd16d29d29d00015d3fd15d29d1f9d8d2d24bf6c1a8572e99c89f1f5f0
15d3fd16d29d29d00042d43d000000ed1cf37c9a169b41886e27ba8fad60b0
15d3fd16d29d29d00042d43d000000fbc10435df141b3459e26f69e76d5947
15d3fd16d29d29d00042d43d000000fe02290512647416dcf0a400ccbc0b6b
16d16d16d00000022c43d43d00043d370cd49656587484eb806b90846875a0
1dd28d28d00028d00042d41d00041df1e57cd0b3bf64d18696fb4fce056610
1dd28d28d00028d1dc1dd28d1dd28d3fe87b802002478c27f1c0da514dbf80
21b10b00021b21b21b21b10b21b21b3b0d229d76f2fd7cb8e23bb87da38a20
21d10d00021d21d21c21d10d21d21d696c1bb221f80034f540b6754152d3b8
21d19d00021d21d21c42d43d000000624c0617d7b1f32125cdb5240cd23ec9
29d29d00029d29d00029d29d29d29de1a3c0d7ca6ad8388057924be83dfc6a
29d29d00029d29d08c29d29d29d29dcd113334714fbefb4b0aba4000bcef62
29d29d00029d29d21c29d29d29d29dce7a321e4956e8298ba917e9f2c22849
29d29d15d29d29d21c29d29d29d29d7329fbe92d446436f2394e041278b8b2
2ad00016d2ad2ad22c42d42d00042ddb04deffa1705e2edc44cae1ed24a4da
2ad2ad0002ad2ad0002ad2ad2ad2ade1a3c0d7ca6ad8388057924be83dfc6a
2ad2ad0002ad2ad00042d42d000000301510f56407964db9434a9bb0d4ee4a
2ad2ad0002ad2ad00042d42d0000005d86ccb1a0567e012264097a0315d7a7
2ad2ad0002ad2ad22c2ad2ad2ad2ad6a7bd8f51d54bfc07e1cd34e5ca50bb3
2ad2ad0002ad2ad22c2ad2ad2ad2adce7a321e4956e8298ba917e9f2c22849
2ad2ad16d2ad2ad00042d42d00042ddb04deffa1705e2edc44cae1ed24a4da
2ad2ad16d2ad2ad22c42d42d00042d58c7162162b6a603d3d90a2b76865b53
2ad2ad16d2ad2ad22c42d42d00042de4f6cde49b80ad1e14c340f9e47ccd3a
3fd3fd15d3fd3fd00042d42d00000061256d32ed7779c14686ad100544dc8d
3fd3fd15d3fd3fd21c3fd3fd3fd3fdc110bab2c0a19e5d4e587c17ce497b15
3fd3fd15d3fd3fd21c42d42d0000006f254909a73bf62f6b28507e9fb451b5
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
44
45
46
47
P
l
a
i
n
T
e
x
t
复
制
代
码
h
t
t
p
s
:
//g
i
t
h
u
b
.
c
o
m
/w
h
i
c
k
e
y
-
r
7
/g
r
a
b
_b
e
a
c
o
n
_c
o
n
f
i
g
<https://github.com/whickey-r7/grab_beacon_config>
⽔
印
对
每
个
客
户
端
来
说
是
独
⼀
⽆
⼆
的
,
有时
可
以
关
联
特
定
的
威
胁
组织
。
最
常
⻅
的
⽔
印
是
0
。
⽔
印
0
表
示
C
o
b
a
l
t
S
t
r
i
k
e
的破
解
版
本
,
威
胁
参
与
者
在
他们
的
活
动
中
通
常
使
⽤
这
些
版
本
。
更有
趣
的
是
305419896
、
1359593325
和
1
580103814
,
它
们
的
配
置
数
都
在
100
以
上
。
N
m
a
p
常
⻅
的
⽔
印
⽔
印
305419896
已
与
M
a
z
e
勒
索
软
件
相
关
联
:
h
t
t
p
s
:
//l
a
b
s
.
s
e
n
t
i
n
e
l
o
n
e
.
c
o
m
/e
n
t
e
r
-
t
h
e
-
m
a
z
e
-
d
e
m
y
s
t
i
f
y
i
n
g
-
a
n
-
a
f
f
i
l
i
a
t
e
-
i
n
v
o
l
v
e
d
-
i
n
-
m
a
z
e
-
s
n
o
w
/
<
h
t
t
p
s
:
//l
a
b
s
.
s
e
n
t
i
n
e
l
o
n
e
.
c
o
m
/e
n
t
e
r
-
t
h
e
-
m
a
z
e
-
d
e
m
y
s
t
i
f
y
i
n
g
-
a
n
-
a
f
f
i
l
i
a
t
e
-
i
n
v
o
l
v
e
d
-
i
n
-
m
a
z
e
-
s
n
o
w
/>
/s
ub
m
i
t
.
p
h
p
/j
q
ue
r
y
-
3
.
3
.
2
.
m
i
n
.
j
s
除
了
部
署
在团
队
服
务
器
本
身
上
的
SSL
证
书
外
,
信
标
还
与⼀个
额
外
的
S
S
L
公
钥
捆
绑
在
⼀
起
。
这
是
公
钥
/
私
钥
对
的
⼀
部
分
,
每
当
有
⼈
安
装
C
o
b
a
l
t
e
S
t
r
i
k
e
时
,
服
务
器
上
就
会
⽣
成
公
钥
/
私
钥
对
。
公
钥
随
后
嵌
⼊
在
同
⼀
服
务
器
上
⽣
成
并
⽤
于
C
2
签
到
。
需
要
注
意
的
是
,
此
密
钥
对
与
团
队
服
务
器
上
⽤
于
HT
T
P
S
证
书
的
S
S
L
密
钥
对完
全
不
同
。
与
⽔
印
不
同
,
存
储
在
Beac
o
n
配
置
中
的
S
S
L
公
钥
提
供了
⼀
种
聚
集
信
标
的
⽅
法
。
我
们
实
际
上
可
以保
证
每
个
团
队
服
务
器
安
装
的
密
钥
是
唯
⼀
的
,
但
它
们
经
常
会
被
重
⽤
,
例
如
通过
虚
拟
机
重
新
部
署
。
在
⼀
些
情
况
下,
攻
击
者
使
⽤
单
个
团
队
服
务
器
来
配
置
从
其
控
制
范
围
内
的
其
他
服
务
器
部
署
的
有
效
负
载
,
这
使
得
我
们
可
以
发
现
、
跟
踪
和
监
控
他们
的
基
础
设
施
。
总
的
来
说
,
37%
的
信
标
提
供了
前
5
个
SS
L
公
钥
。
有
⼏
个
最
受
欢
迎
的
密
钥
属
于
A
P
T
组织
。
当
从
订
阅
或
O
S
I
N
T
源
收
集
的
Bea
c
o
n
I
P
时
,
通
常
可
以
找
到
⼀
些
共
享
同
⼀个
S
S
L
公
钥
的
信
标
。
这
种
情
况
下,
除⾮
产
⽣
与
基
础
设
施
相
关
的
进
⼀
步
的
IP
地址
和
情报
,
否
则
可
能
是
不
相
关
的
。
利
⽤
这
种
集
群
技
术
对
扩
展
C2
基
础
设
施
的
情报
⾮
常
有
帮
助
。
它
帮
助
我
们
找
到
了
各
种
组织
和
攻
击
活
动
之
间
的
联
系
,
包
括
⽬
前
活
跃
的
和历史
活
跃
的
。
h
t
t
p
s
:
//w
w
w
.
s
h
o
d
a
n
.
i
o
/s
e
a
r
c
h
?
q
u
e
r
y
=
s
e
r
v
e
r
.
p
u
b
l
i
c
k
e
y
_m
d
5%
3A
+
d
e
f
b
5d
95c
e
99e
1
e
b
b
f
421
a
1
a
38d
9c
b
64
<https://www.shodan.io/search?
q
u
e
r
y
=
s
e
r
v
e
r
.
p
u
b
l
i
c
k
e
y
_m
d
5%
3A
+
d
e
f
b
5d
95c
e
99e
1
e
b
b
f
421
a
1
a
38d
9c
b
64>
s
e
r
v
e
r
.
p
u
b
l
i
c
k
e
y
_m
d
5:
d
e
f
b
5d
95c
e
99e
1
e
b
b
f
421
a
1
a
38d
9c
b
64
常
⻅
的
URI
●
●
s
s
l
p
u
b
l
i
c
k
e
y
s
已
知
威
胁
组织
使
⽤
的
⼏
个
流
⾏
的
SSL
公
钥
包
括
:
defb
5d
95ce
99e1ebbf
421a
1a
38d
9cb
64
e
9ae
865f
5ce
035176457188409f
6020a
81
a3
eeb8
ceb74
cf508
f6
bcfc408e0305
79
b6e333634
c506
f6
f710
dde179796
ed
1186914578623
be126e5
f3e8
c058
d719
8
ac540617
dddcdf575
f6
dc207
abb7344
f
61884abc
8f
4ba
7a
0caa
288b
326a
70ee
94
a0
ea78
a00
b04
d14
d25e55
dacba3
ac3
c
4fdbd
072a
73ab
1b
9087f
716d
5399807
0
ce7
b6482
c1
f24e42
f2935
f5026
d338
d
1
2
3
4
5
6
7
8
9
10
常
⻅
的
公
钥
m
d
5
J
S
O
N
复
制
代
码
M
D
5
B
e
a
c
o
n
数
量
组织
1
1
8
6
9
1
4
5
7
8
6
2
3
b
e
1
2
6
e
5
f
3
e
8
c
0
5
8
d
7
1
9
1
4
1
2
M
A
N
1
8
a
c
5
4
0
6
1
7
d
d
d
c
d
f
5
7
5
f
6
d
c
2
0
7
a
b
b
7
3
4
4
1
3
1
8
D
o
p
p
e
l
P
a
y
m
e
r
f
6
1
8
8
4
a
b
c
8
f
4
b
a
7
a
0
c
a
a
2
8
8
b
3
2
6
a
7
0
e
e
6
2
1
K
e
g
t
a
p
0
c
e
7
b
6
4
8
2
c
1
f
2
4
e
4
2
f
2
9
3
5
f
5
0
2
6
d
3
3
8
d
2
5
7
T
A
5
7
5
/D
r
i
d
e
x
b
3
e
6
b
9
d
d
8
4
d
a
e
6
b
e
6
8
c
b
4
0
c
d
a
4
3
6
6
b
7
7
2
3
A
P
T
4
1
e
9ae
865f
5ce
035176457188409f
6020a
defb
5d
95ce
99e1ebbf
421a
1a
38d
9cb
64
79
b6e333634
c506
f6
f710
dde179796
ed
58
c3
c0
a918
d473
ecd9
f39285
d17379
ef
c
4fdbd
072a
73ab
1b
9087f
716d
5399807
c
9e300c
118949adc
574287b
2a
1264ec
5
c
2897b
1cf
5ecaee
579935f
2a
31cd
35a
9
0
ce7
b6482
c1
f24e42
f2935
f5026
d338
d
8
ccc9
bf8410
deef2
f2008
cde472662
a5
13
eb42
adf1
b78
ea4e1
ac3
c87
b4e3
dd56
1
2
3
4
5
6
7
8
9
10
前
⼗
⼤
S
S
L
公
钥
m
d
5
J
S
O
N
复
制
代
码
绝
⼤多
数
从
Bea
c
o
n
配
置
集
合
中
提
取
的
S
S
L
公
钥
,
能
与
已
有
的
数据
库
的
⼀个
或
多
个
B
e
a
c
o
n
集
群
。
基
于
D
N
S
响
应
对
团
队
服
务
器
进
⾏
指
纹
识
别
的
⽅
法
:
De
t
e
c
t
i
n
g
E
x
p
o
s
e
d
C
o
b
a
l
t
S
t
r
i
k
e
D
N
S
R
e
d
i
r
e
c
t
o
r
s
:
h
t
t
p
s
:
//l
a
b
s
.
f
-
s
e
c
u
r
e
.
c
o
m
/b
l
o
g
/d
e
t
e
c
t
i
n
g
-
e
x
p
o
s
e
d
-
c
o
b
a
l
t
-
s
t
r
i
k
e
-
d
n
s
-
r
e
d
i
r
e
c
t
o
r
s
/
<https://labs.f-secure.com/blog/detecting-exposed-cobalt-strike-dns-redirectors/>
从
s
h
o
d
a
n
中
搜
索
Be
a
c
o
n
的
I
P
,
并
保
存
到
本
地
,
⻅
下
节
。
绝
⼤
部
分
信
标
被
配
置
为使
⽤
0.
0.
0.
0
作为
D
N
S
空
闲
I
P
。
正
如
F-
S
e
c
u
r
e
的研
究
⼈
员
所
提
到
的
,
0.
0.
0.
0
D
N
S
空
闲
值
是
默
认
值
,不
应
该
在
⽣
产
环
境
中使
⽤
。
因
此
,
我
们
可
以
在
a
记
录
中
探
测
DN
S
服
务
器
上
的
0.
0.
0.
0
响
应
,
这
可
以作为
在
野
外
识
别
团
队
服
务
器
的
另
⼀
种
可
靠
机
制
。
C
o
b
a
l
t
S
t
r
i
k
e
D
N
S
重
定
向
from
scapy.
all import
*
from
scapy.
layers.
dns import
DNSRR, DNS, DNSQR
from
scapy.
layers.
inet import
IP, UDPc
def
checkDNS(name):
ip
=
name
try:
ans
=
sr1(IP(dst=ip)/UDP(sport=RandShort(),
dport=53)/DNS(rd=1,qd=DNSQR(qname="google.com",qtype="TXT")),
verbose
=False, timeout
=0.5)
ansTXT
=
ans[DNSRR][0].rdata
ans
=
sr1(IP(dst=ip)/UDP(sport=RandShort(),
dport=53)/DNS(rd=1,qd=DNSQR(qname="amazon.com",qtype="A")),
ve
rbose
=False, timeout
=0.5)
ansA1
=
ans[DNSRR][0].rdata
ans
=
sr1(IP(dst=ip)/UDP(sport=RandShort(),
dport=53)/DNS(rd=1,qd=DNSQR(qname="google.com",qtype="A")),
ve
rbose
=False, timeout
=0.5)
ansA2
=
ans[DNSRR][0].rdata
if
ansTXT
==
ansA1
and
ansA1
==
ansA2
and
ansA2
!=
''
and
valid_ip(ansA1):
print(
"[+] Cs Detected: "
+
ip
+
" replied with: "
+
ansTXT)
except
Exception
as
e:
pass
def
nslookup(target: str) -> None
:
DNS_PORT
=
53
DNS_SERVER
=
"8.8.8.8"
msg
=
IP(dst=DNS_SERVER)
/
UDP(dport=DNS_PORT)
/
DNS(rd=1,
qd=DNSQR(qname=target))
ans
=
sr1(msg,
verbose=0)
print(ans[DNSRR].rdata)
if
__name__ ==
'__main__':
#name = "49.232.161.221"
#checkDNS(name)
#nslookup("google.com")
with
open("cobalt.txt",
'r',
encoding='UTF-8',
errors='ignore')
as
f:
while True:
line
=
f.readline()
if
not
line:
break
checkDNS(line.strip())
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
c
h
e
c
k
D
N
S
.
p
y
P
y
t
h
o
n
复
制
代
码
这
些信
息
有
助
于
监
控
⽹络
出
⼝
点
的
DN
S
请
求
,
以
确
定
信
标
DNS
活
动
的
迹
象
,
以
及
利
⽤
D
N
S
C
2
流
量
帮
助内
存
有
效
负
载
的
取
证调
查
。
h
t
t
p
s
:
//w
w
w
.
s
h
o
d
a
n
.
i
o
/s
e
a
r
c
h
?
q
u
e
r
y
=
p
r
o
d
u
c
t
%
3A
%
22C
o
b
a
l
t
+
S
t
r
i
k
e
+
B
e
a
c
o
n
%
22
<https://www.shodan.io/search?
q
u
e
r
y
=
p
r
o
d
u
c
t
%
3A
%
22C
o
b
a
l
t
+
S
t
r
i
k
e
+
B
e
a
c
o
n
%
22>
C
2
开
源
情报
S
h
o
d
a
n
> pip install shodan
> shodan init YOUR_API_KEY
> shodan search
--fields ip_str,port,org,hostnames server.publickey_md5: defb5d95ce99e1ebbf421a1a38d9cb64
101
.43.208.122 80
Tencent Cloud Computing (Beijing) Co., Ltd
110
.42.159.151 443
Tencent cloud computing (Beijing) Co., Ltd.
101
.43.208.122 8443
Tencent Cloud Computing (Beijing) Co., Ltd
147
.78.47.231 443
M Nets SAL undefined.hostname.localhost
31
.44.184.187 443
Petersburg Internet Network ltd.
39
.109.68.117 443
HONG KONG BRIDGE INFO-TECH LIMITED
47
.96.120.47 80
Aliyun Computing Co., LTD
116
.204.211.180 80
5
.199.162.174 80
UAB Cherry Servers
49
.232.161.221 443
Tencent cloud computing (Beijing) Co., Ltd.
5
.199.162.174 443
UAB Cherry Servers
81
.71.133.220 80
Tencent Cloud Computing (Beijing) Co., Ltd
103
.146.179.94 443
HONGKONG NEWS COMMENTARY AGENCY CO. ,LIMITED
117
.50.37.182 80
Shanghai UCloud Information Technology Company Limited
103
.146.179.94 80
HONGKONG NEWS COMMENTARY AGENCY CO. ,LIMITED
31
.44.184.73 80
Petersburg Internet Network ltd.
120
.53.232.55 443
Shandong Servsd Technology Co. Ltd.
82
.156.29.211 9999
Tencent Cloud Computing (Beijing) Co., Ltd
193
.201.9.199 443
Infolink LLC
31
.44.184.187 8080
Petersburg Internet Network ltd.
121
.41.89.180 443
Aliyun Computing Co., LTD
124
.222.177.70 82
Tencent cloud computing (Beijing) Co., Ltd.
47
.98.164.231 443
Aliyun Computing Co., LTD
31
.44.184.232 80
Petersburg Internet Network ltd.
101
.43.208.122 443
Tencent Cloud Computing (Beijing) Co., Ltd
81
.71.133.220 443
Tencent Cloud Computing (Beijing) Co., Ltd
31
.44.184.187 80
Petersburg Internet Network ltd.
175
.24.62.158 4443
Tencent cloud computing (Beijing) Co., Ltd.
103
.146.179.94 4433
HONGKONG NEWS COMMENTARY AGENCY CO. ,LIMITED
110
.42.159.151 8080
Tencent cloud computing (Beijing) Co., Ltd.
31
.44.184.84 443
Petersburg Internet Network ltd.
116
.204.211.180 443
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
B
a
s
h
复
制
代
码
h
t
t
p
s
:
//c
o
m
m
u
n
i
t
y
.
r
i
s
k
i
q
.
c
o
m
/s
e
a
r
c
h
/c
o
m
p
o
n
e
n
t
s
/C
o
m
m
a
n
d
%
20a
n
d
%
20C
o
n
t
r
o
l
%
20S
e
r
v
e
r
/C
o
b
a
l
t
%
20S
t
r
i
k
e
/
<
h
t
t
p
s
:
//c
o
m
m
u
n
i
t
y
.
r
i
s
k
i
q
.
c
o
m
/s
e
a
r
c
h
/c
o
m
p
o
n
e
n
t
s
/C
o
m
m
a
n
d
%
20a
n
d
%
20C
o
n
t
r
o
l
%
20S
e
r
v
e
r
/C
o
b
a
l
t
%
20S
t
r
i
k
e
/>
h
t
t
p
s
:
//q
u
a
k
e
.
360.
c
n
/q
u
a
k
e
/#/s
e
a
r
c
h
R
e
s
u
l
t
?
s
e
a
r
c
h
V
a
l
=
a
p
p
%
3A
%
22C
o
b
a
l
t
S
t
r
i
k
e
%
22&
s
e
l
e
c
t
I
n
d
e
x
=
q
u
a
k
e
_s
e
r
v
i
c
e
&
i
g
n
o
r
e
_c
a
c
h
e
=
f
a
l
s
e
&
t
i
m
e
R
a
n
g
e
=
2021
-
08-
25%
2000%
3A
00%
3A
00&t
i
m
e
Ra
n
g
e
=
2022-
08-
25%
2000%
3A
00%
3A
00&
t
=
1
661
39201
31
92
<https://quake.360.cn/quake/#/searchResult?
s
e
a
r
c
h
V
a
l
=
a
p
p
%
3A
%
22C
o
b
a
l
t
S
t
r
i
k
e
%
22&
s
e
l
e
c
t
I
n
d
e
x
=
q
u
a
k
e
_s
e
r
v
i
c
e
&
i
g
n
o
r
e
_c
a
c
h
e
=
f
a
l
s
e
&
t
i
m
e
R
a
n
g
e
=
2021
-
08-
25%
2000%
3A
00%
3A
00&t
i
m
e
Ra
n
g
e
=
2022-
08-
25%
2000%
3A
00%
3A
00&
t
=
1
661
39201
31
92>
r
i
s
k
i
q
3
6
0
q
u
a
k
e
S
l
e
e
p
T
i
m
e
{
"BeaconType": [
"HTTP"],
"Port":
81,
"SleepTime":
450000,
"MaxGetSize":
1048576,
"Jitter":
37, //
⼼
跳
存
在
37% *
450000
毫
秒
(
166500
毫
秒
)
的
随
机
抖
动
,
⼼
跳
间隔
可
能
在
毫
秒
283000
之
间
450000
(
4.7
- 7.5
分
钟
)
"MaxDNS":
"Not Found",
"PublicKey":
"MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCmmpL6y1jDqhxvFx5mTgprRUYNG2IchQmPW05GBhd5Gp0HhuY3JH7lfcecW6
pYLjDCx6WYubVwWY1mHj7+Ae8zbrhWVtlAlMcZOSpZqmqrJ03JS1B7grZsbcsfCptHZF+cTl4THGSfloBm2AsqNVN/93Y/6l8gt8YVauRlDbBzowID
AQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAA=="
, //Cobalt Strike TeamServer
使
⽤
该
字
段
来
加
密
服
务
器
和
信
标
之
间
的
通
信
。
这
与
使
⽤
浏
览
器
或
数据
传
输
库
(
如
curl
)
访
问
C
2
域
时
使
⽤
的
普
通
TLS
证
书
不
同
。
此
字
段
值
得
注
意
,
因
为
TeamServer
对
每
个
信
标
使
⽤
相
同
的
公
钥
,
因
此此
字
段
在
将
信
标
与
Teamserver
服
务
器
聚
类
时
很
有
价
值
,
因
为
威
胁
参
与
者
经
常
使
⽤
同
⼀个
TeamServer
进
⾏
多
个
活
动
,
因
此
配
置
中
的
这
些
数据
可
以
⽤
于
将
威
胁
组织
关
联
到
多
个
活
动
和
基
础
设
施
。
"PublicKey_MD5":
"fe1a19bb796adc7029eac04bc5d07139",
"C2Server":
"8.142.124.166,/j.ad",
"UserAgent":
"Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1)",
"HttpPostUri":
"/submit.php",
"Malleable_C2_Instructions": [],
"HttpGet_Metadata": {
"ConstHeaders": [],
"ConstParams": [],
"Metadata": [
"base64",
"header \"Cookie\""
],
"SessionId": [],
"Output": []
},
"HttpPost_Metadata": {
"ConstHeaders": [
"Content-Type: application/octet-stream"
],
"ConstParams": [],
"Metadata": [],
"SessionId": [
"parameter \"id\""
],
"Output": [
"print"]
},
"SpawnTo":
"AAAAAAAAAAAAAAAAAAAAAA==",
"PipeName":
"Not Found",
"DNS_Idle":
"Not Found",
"DNS_Sleep":
"Not Found",
"SSH_Host":
"Not Found",
"SSH_Port":
"Not Found",
"SSH_Username":
"Not Found",
"SSH_Password_Plaintext":
"Not Found",
"SSH_Password_Pubkey":
"Not Found",
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
J
S
O
N
复
制
代
码
"
S
l
e
e
p
T
i
m
e
"
:
450000,
"
J
i
t
t
e
r
"
:
37
,
⼼
跳
存
在
37
%
*
450000
毫
秒
(
166500
毫
秒
)
的
随
机
抖
动
,
⼼
跳
间隔
可
能
在
毫
秒
283000
之
间
450000
(
4.
7
-
7
.
5
分
钟
)
"
P
r
o
c
I
n
j
e
c
t
_S
t
u
b
"
:
"
B
O
C
h
G
+
W
RR6j
X
P
S
s
+
n
+
q
D
L
A
=
=
"
,
s
t
u
b
字
段
:
Co
b
a
l
t
S
t
r
i
k
e
J
a
r
包
的
⽂
件
MD5
值
,
经
Ba
s
e
64
编
码
。
最
后
,
我
们
可
以
通过
访
问
h
t
t
p
s
:
//v
e
r
i
f
y
.
c
o
b
a
l
t
s
t
r
i
k
e
.
c
o
m
/
<https://verify.cobaltstrike.com/>
,
并
搜
索
哈
希
来
使
⽤
C
o
b
a
l
t
S
t
r
i
k
e
验
证
S
H
A
2
5
6
哈
希
以
识
别
J
a
r
包
的
版
本
。
P
r
o
c
I
n
j
e
c
t
_S
t
u
b
W
a
t
e
r
m
a
r
k
(
l
i
c
e
n
s
e
_i
d
)
⽔
印
,
9
位
值
的
唯
⼀
许
可
证
,
虽
然
可
以修
改
此
值
,
但
它
仍
然
可
以
与
p
r
o
c
e
s
s
-
i
n
j
e
c
t
.
s
t
u
b
和
p
u
b
l
i
c
k
e
y
字
段
(上
⾯
讨论
过
)
结
合
使
⽤
,
以
集
群
基
础
设
施
和
活
动
组织
。
C
o
b
a
l
t
S
t
r
i
k
e
P
a
r
s
e
r
解
析
名
为
Wa
t
e
r
m
a
r
k
l
i
b
c
s
c
e
解
析
名
为
l
i
c
e
n
s
e
_i
d
,
0
代
表
破
解
版
●
●
获
取
st
a
g
e
#!/usr/bin/python3
import
requests
import
rstr
import
sys
import
urllib3
if
len(sys.
argv) <
2:
print(
"Usage: %s http[s]://<server_address>"
% (
sys.argv[0]))
sys.exit(1)
url
= sys
.argv[1]
urllib3
.disable_warnings(urllib3
.exceptions.InsecureRequestWarning)
headers
= {"User-Agent":""}
def
generate_checksum8_uri(arch):
# x86 = 92
# x64 = 93
value
=
0
while
value
!=
arch:
rand
=
rstr.xeger(r'[A-Za-z0-9]{4}')
value
= (
sum([ord(ch)
for
ch
in
rand])
%
0x100)
return
"/"
+
str(rand)
def
get_shellcode(url,uri):
f_url
=
url
+
uri
try:
resp
=
requests.get(f_url,
timeout=5,
headers=headers,
verify=False)
except
requests.exceptions.RequestException
as
e:
print(
'[!] Connection error %s'
% (
e))
sys.exit(1)
if(resp.status_code==200):
print(
'[+] Got response from %s'
% (
url))
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
g
e
t
_x
8
6
_s
t
a
g
e
P
y
t
h
o
n
复
制
代
码
以
如
下
指
令
开
始
:
F
C
-
>
c
l
d
指
令
,
将
标
志
寄存
器
Flag
的
⽅
向
标
志
位
D
F
清
零
。
E
8-
>
c
a
l
l
指
令
s
t
a
g
e
l
e
s
s
⽅
式
上
线
的
shel
l
c
o
d
e
或
者
b
e
a
c
o
n
⽂
件
,
能
够
利
⽤
C
o
b
a
l
t
S
t
r
i
k
e
P
a
r
s
e
r
提
取
配
置
(
S
t
a
g
e
d
和
S
t
a
g
e
l
e
s
s
的
区
别
.
前
者
的
实
际
功
能
只
是
和
C
2
建
⽴
连
接
并
接收
P
a
y
l
o
a
d
,
然
后
加
载
执
⾏
,
⽽
S
t
a
g
e
l
e
s
s
直
接
省
去
了
接收
P
a
y
l
o
a
d
的
步
骤
.
S
t
a
g
e
l
e
s
s
⽣
成
除
了
的
P
a
y
l
o
a
d
都
会
⽐
S
t
a
g
e
d
类
型
的
要
⼤
很
多
,
⽽
且
包
含
了
特
征
明
细
)
。
h
t
t
p
s
:
//g
i
t
h
u
b
.
c
o
m
/S
e
n
t
i
n
e
l
-
O
n
e
/C
o
b
a
l
t
S
t
r
i
k
e
P
a
r
s
e
r
<https://github.com/Sentinel-One/CobaltStrikeParser>
sh
e
l
l
c
od
e
特
征
b
e
a
c
o
n
配
置
提
取
PS E:\cs_beacon_conf> python .\get_x86_stage.py http://8.142.124.166:81
[
+
] Generating x86 check8 uri
[
+
] Making request to suspected C2 server
[
+
] Got response from http://8.142.124.166:81
[
+
] Response written to /out, response might be shellcode
1
2
3
4
5
B
a
s
h
复
制
代
码
%
E
%
E
%
A
%
E
%
B
%
B
%
%
E
%
F
%
%
E
%
F
%
%
E
%
%
D
%
E
%
B
D
%
A
E
%
%
C
%
C
o
b
a
l
t
%
其
他
⼯
具
:
h
t
t
p
s
:
//g
i
t
h
u
b
.
c
o
m
/s
t
r
o
z
f
r
i
e
d
b
e
r
g
/c
o
b
a
l
t
s
t
r
i
k
e
-
c
o
n
f
i
g
-
e
x
t
r
a
c
t
o
r
<https://github.com/strozfriedberg/cobaltstrike-config-extractor>
h
t
t
p
s
:
//w
w
w
.
a
n
q
u
a
n
k
e
.
c
o
m
/p
o
s
t
/i
d
/224535
<https://www.anquanke.com/post/id/224535>
h
t
t
p
s
:
//w
w
w
.
b
l
a
c
k
b
e
r
r
y
.
c
o
m
/u
s
/e
n
/f
o
r
m
s
/e
n
t
e
r
p
r
i
s
e
/e
b
o
o
k
-
b
e
a
c
o
n
s
-
i
n
-
t
h
e
-
d
a
r
k
<https://www.blackberry.com/us/en/forms/enterprise/ebook-
b
e
a
c
o
n
s
-
i
n
-
t
h
e
-
d
a
r
k
>
引
⽤
链
接
PS E:\tools\CobaltStrikeParser-master\CobaltStrikeParser-master\samples> python ..\parse_beacon_config.py
--json
.\8.142.124.166.shellcode
{
"BeaconType"
: [
"HTTP"
],
"Port"
:
81
,
"SleepTime"
:
60000
,
"MaxGetSize"
:
1048576
,
"Jitter"
:
0
,
"MaxDNS"
: "Not Found"
,
"PublicKey":
"MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCmmpL6y1jDqhxvFx5mTgprRUYNG2IchQmPW05GBhd5Gp0HhuY3JH7lfcecW6p
YLjDCx6WYubVwWY1mHj7+Ae8zbrhWVtlAlMcZOSpZqmqrJ03JS1B7grZsbcsfCptHZF+cTl4THGSfloBm2AsqNVN/93Y/6l8gt8YVauRlDbBzowIDAQ
ABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAA=="
, "PublicKey_MD5"
: "fe1a19bb796adc7029eac04bc5d07139"
, "C2Server"
: "8.142.124.166,/j.ad"
, "UserAgen
t"
: "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1)", "HttpPostUri"
: "/submit.php"
, "Malleable_C2_Instructions"
: [],
"HttpGet_Metadata": {
"ConstHeaders": [],
"ConstParams": [],
"Metadata": [
"base64",
"header \"Cookie\""],
"Ses
sionId"
: [], "Output"
: []}, "HttpPost_Metadata"
: {"ConstHeaders"
: ["Content-Type: application/octet-stream"], "Cons
tParams"
: [], "Metadata"
: [], "SessionId"
: ["parameter \"id\""], "Output"
: ["print"
]}, "SpawnTo"
: "AAAAAAAAAAAAAAAA
AAAAAA=="
, "PipeName"
: "Not Found", "DNS_Idle"
: "Not Found", "DNS_Sleep"
: "Not Found", "SSH_Host"
: "Not Found", "SS
H_Port"
: "Not Found", "SSH_Username"
: "Not Found", "SSH_Password_Plaintext"
: "Not Found", "SSH_Password_Pubkey"
: "N
ot Found"
,
"SSH_Banner"
:
""
,
"HttpGet_Verb"
:
"GET"
,
"HttpPost_Verb"
:
"POST"
,
"HttpPostChunk"
: 0,
"Spawnto_x86"
: "%w
indir%\\syswow64\\rundll32.exe"
, "Spawnto_x64"
: "%windir%\\sysnative\\rundll32.exe"
, "CryptoScheme"
:
0, "Proxy_Conf
ig"
: "Not Found", "Proxy_User"
: "Not Found", "Proxy_Password"
: "Not Found", "Proxy_Behavior"
: "Use IE settings", "W
atermark"
:
100000, "bStageCleanup"
: "False"
, "bCFGCaution"
: "False"
, "KillDate"
:
0, "bProcInject_StartRWX"
: "True"
,
"bProcInject_UseRWX":
"True",
"bProcInject_MinAllocSize":
0,
"ProcInject_PrependAppend_x86":
"Empty",
"ProcInject
_PrependAppend_x64"
: "Empty"
, "ProcInject_Execute"
: ["CreateThread"
, "SetThreadContext"
, "CreateRemoteThread"
, "Rtl
CreateUserThread"
], "ProcInject_AllocationMethod"
: "VirtualAllocEx"
, "ProcInject_Stub"
: "BOChG+WRR6jXPSs+n+qDLA=="
,
"bUsesCookies":
"True",
"HostHeader":
"",
"smbFrameHeader":
"AAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAA="
, "tcpFrameHeader"
: "AAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="
, "headersToRemove"
: "Not Foun
d"
, "DNS_Beaconing"
: "Not Found", "DNS_get_TypeA"
: "Not Found", "DNS_get_TypeAAAA"
: "Not Found", "DNS_get_TypeTXT"
:
"Not Found",
"DNS_put_metadata":
"Not Found",
"DNS_put_output":
"Not Found",
"DNS_resolver":
"Not Found",
"DNS_st
rategy"
: "round-robin"
, "DNS_strategy_rotate_seconds"
:
-1, "DNS_strategy_fail_x"
:
-1, "DNS_strategy_fail_seconds"
:
-1
}
PS E:\tools\CobaltStrikeParser-master\CobaltStrikeParser-master\samples> python ..\parse_beacon_config.py --json
.\8.142.124.166.shellcode > .\8.142.124.166.shellcode.conf
1
2
3
B
a
s
h
复
制
代
码
点击关注,共同学习!安全狗的自我修养