0%

Misc

我的壁纸

1.图片分离得到一个压缩包,一个文本一个图片,一个音频,压缩包有个注释snowday,是snow隐写的密钥

对flag.txt解snow得一部分flag

2.音频解SSTV得二维码,解二维码的部分flag

3.图片的备注信息里有一个password,尝试steghide解出另外一部分flag

snow隐写

1
SNOW.EXE  -C -p 他朝若是同淋雪  flag.txt

F5隐写

1
java Extract “待提取的图片路径” -p 密码

outguess隐写

输入outguess -help即可获得相关命令。
加密:

1
outguess -k “my secret key” -d hidden.txt demo.jpg out.jpg

加密之后,demo.jpg会覆盖out.jpg,hidden.txt的内容是要隐藏的东西。
解密:

1
outguess -k “my secret key” -r out.jpg hidden.txt

解密之后,紧密内容放在hidden.txt中

栅栏里的大帝

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
def decode(string,number):
for i in string:
if 'a' <= i <= 'z':
print(chr(ord('a')+(ord(i)-ord('a')-space2)%26),end = '')
elif 'A' <= i <= 'Z':
print(chr(ord('A')+(ord(i)-ord('A')-space2)%26),end = '')
else:
print(i,end = '')
print("\n")

def decipherin(string,space1,space2):
str1 = ''
if space1 >= len(string):
decode(string,space2)
elif len(string)%space1 == 0:
for i in range(0,len(string)//space1):
str1 += string[i:len(string)+1:len(string)//space1]
else:
for i in range(0,len(string)//space1+1):
str1 += string[i:len(string)+1:len(string)//space1+1]

decode(str1,space2)

text = input('请输入密文')

for space1 in range(1,15):
for space in range(26):
space2 = space%26
if ' ' in text:
print('密文有误')
else:
decipherin(text,space1,space2)

flag{th1s_1s_f149}

LSB

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import binascii
import struct
crcbp = open("e:\Desktop\python\丁真和他的小马.png", "rb").read()
crc32frombp = int(crcbp[29:33].hex(),16)
print(crc32frombp)

for i in range(4000):
for j in range(4000):
data = crcbp[12:16] + \
struct.pack('>i', i)+struct.pack('>i', j)+crcbp[24:29]
crc32 = binascii.crc32(data) & 0xffffffff
print(crc32)
if(crc32 == crc32frombp):
print(i, j)
print('hex:', hex(i), hex(j))
exit(0)

修复图片后LSB隐写查看可以zhi_shi_xue_bao,包上flag{},提交

png宽高爆破

1
2
3
4
5
6
7
8
9
10
#判断谁被修改了
import zlib

image_data=open('图片路径','rb')
bin_data=image_data.read()
crc32key = zlib.crc32(bin_data[12:29]) #使用函数计算
if crc32key==int(bin_data[29:33].hex(), 16):#对比算出的CRC和原本的CRC
print('宽高没有问题')
else:
print('宽高被改了')
1
2
3
4
5
6
7
8
9
10
#爆破高,需要自查查图片信息。Python2运行
import binascii
import struct
crc32key = 0xFF800203
for i in range(0, 65535):
height = struct.pack('>i', i)
data = '\x49\x48\x44\x52\x00\x00\x00\x64' + height + '\x08\x02\x00\x00\x00'
crc32result = binascii.crc32(data) & 0xffffffff
if crc32result == crc32key:
print ''.join(map(lambda c: "%02X" % ord(c), height))
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#只需要填写图片路径,爆破宽和高,有点费电脑
import binascii
import struct
crcbp = open("E:\Desktop\cd83c00e-130c-47ba-b4d8-c0c0b8d8de31.png", "rb").read()
crc32frombp = int(crcbp[29:33].hex(),16)
print(crc32frombp)

for i in range(4000):
for j in range(4000):
data = crcbp[12:16] + \
struct.pack('>i', i)+struct.pack('>i', j)+crcbp[24:29]
crc32 = binascii.crc32(data) & 0xffffffff
print(crc32)
if(crc32 == crc32frombp):
print(i, j)
print('hex:', hex(i), hex(j))
exit(0)
1
2
3
4
5
6
7
8
9
10
11
12
13
#单爆破宽度,只需输入图片地址
import struct
import binascii
import os
fi=open('d21007e64ba84021875c3556ece71173.png','rb').read()
#12-15字节代表固定的文件头数据块的标示,16-19字节代表宽度,20-23字节代表高度,24-28字节分别代表
# Bit depth、ColorType、Compression method、Filter method、Interlace method
#29-32字节为CRC校验和
for i in range(10000):#宽度0-9999搜索
data=fi[12:16]+struct.pack('>I',i)+fi[20:29] #pack函数将int转为bytes,>表示大端00 00 00 02,I表示4字节无符号int;<表示小端 02 00 00 00
crc=binascii.crc32(data)&0xffffffff #byte的大小为8bits而int的大小为32bits,转换时进行与运算避免补码问题0x932f8a6b
if crc==struct.unpack('>I',fi[29:33])[0]&0xffffffff : #解开为无符号整数
print(i)

base64隐写

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
d=open("文件路径","r").read()
e=d.splitlines()
binstr=""
base64="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
for i in e :
if i.find("==")>0:
temp=bin((base64.find(i[-3])&15))[2:]
#取倒数第3个字符,在base64找到对应的索引数(就是编码数),取低4位,再转换为二进制字符
binstr=binstr + "0"*(4-len(temp))+temp #二进制字符补高位0后,连接字符到binstr
elif i.find("=")>0:
temp=bin((base64.find(i[-2])&3))[2:] #取倒数第2个字符,在base64找到对应的索引数(就是编码数),取低2位,再转换为二进制字符
binstr=binstr + "0"*(2-len(temp))+temp #二进制字符补高位0后,连接字符到binstr
str=""
for i in range(0,len(binstr),8):
str=str+chr(int(binstr[i:i+8],2)) #从左到右,每取8位转换为ascii字符,连接字符到字符串
print(str) #结果是 Base_sixty_four_point_five转换为

stegdetect

stegdetect 就是用来检测jpg类型的图片是否隐藏着其他文件或内容

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
q – 仅显示可能包含隐藏内容的图像

n – 启用检查JPEG文件头功能,以降低误报率。如果启用,所有带有批注区域的文件将被视为没有被嵌入信息。如果JPEG文件的JFIF标识符中的版本号不是1.1,则禁用OutGuess检测。

s – 修改检测算法的敏感度,该值的默认值为1。检测结果的匹配度与检测算法的敏感度成正比,算法敏感度的值越大,检测出的可疑文件包含敏感信息的可能性越大。

d – 打印带行号的调试信息。

t – 设置要检测哪些隐写工具(默认检测jopi),可设置的选项如下:

j – 检测图像中的信息是否是用jsteg嵌入的。

o – 检测图像中的信息是否是用outguess嵌入的。

p – 检测图像中的信息是否是用jphide嵌入的。

i – 检测图像中的信息是否是用invisible secrets嵌入的。

梅花香自苦寒来(坐标画二维码)

提示图穷匕现,010打开,拉到最下方不是FF D9 ,搜FFD9 后面跟着一大串好像16进制的文本,进行16进制转字符串,得到很多坐标,用gnuplot,来绘制坐标得到二维码

1
2
3
4
5
6
7
8
9
10
11
12
#十六进制转文本
with open("E:\Desktop\data.txt", 'r') as h: # hex.txt为要转换的文本文件
val = h.read()
h.close()

with open('result.txt', 'w') as re: # 转换完成后写入result.txt
tem = ''
for i in range(0, len(val), 2):
tem = '0x' + val[i] + val[i+1]
tem = int(tem, base=16)
re.write(chr(tem))
re.close()
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#转换成gnuplotTXt能看懂的格式
with open('result.txt', 'r') as res: # 坐标格式文件比如(7,7)
re = res.read()
res.close()

with open('gnuplotTxt.txt', 'w') as gnup: # 将转换后的坐标写入gnuplotTxt.txt
re = re.split()
tem = ''
for i in range(0, len(re)):
tem = re[i]
tem = tem.lstrip('(')
tem = tem.rstrip(')')
for j in range(0, len(tem)):
if tem[j] == ',':
tem = tem[:j] + ' ' + tem[j+1:]
gnup.write(tem + '\n')
gnup.close()

http://wenming.xinye.gov.cn/robots.txt

218.28.78.118

excel破解

下载xls文件有密码,改成rar,用010打开搜flag,直接用010打开xls文件会有乱码,但也能找到flag,一般ofiice文件都可以尝试把文件改成压缩包查看,同时有的压缩包文件可能是office文件转换的。

CTF{office_easy_cracked}

取证volatility

volatility参数

volatility -f 文件名 imageinfo 得到镜像的基本信息。
volatility -f 文件名 –profile=系统 pslist 查看进程信息
volatility -f 文件名 –profile=系统 pstree 查看进程树
volatility -f 文件名 –profile=系统 hashdump 查看用户名密码信息
volatility -f 文件名 –profile=系统 john 爆破密码
volatility -f 文件名 –profile=系统 lsadump 查看用户强密码
volatility -f 文件名 –profile=系统 svcscan 查看服务
volatility -f 文件名 –profile=系统 iehistory 查看IE浏览器历史记录
volatility -f 文件名 –profile=系统 netscan 查看网络连接
volatility -f 文件名 –profile=系统 cmdscan cmd历史命令
volatility -f 文件名 –profile=系统 consoles 命令历史记录
volatility -f 文件名 –profile=系统 cmdline 查看cmd输出, 获取命令行下运行的程序
volatility -f 文件名 –profile=系统 envars 查看环境变量,一般很多配合grep筛选,可也是使用-p指定pid
volatility -f 文件名 –profile=系统 filescan 查看文件
volatility -f 文件名 –profile=系统 notepad 查看当前展示的notepad内容
volatility -f 文件名 –profile=系统 hivelist 查看注册表配置单元
volatility -f 文件名 –profile=系统 userassist 查看运行程序相关的记录,比如最后一次更新时间,运行过的次数等。
volatility -f 文件名 –profile=系统 clipboard 查看剪贴板的信息
volatility -f 文件名 –profile=系统 timeliner 最大程序提取信息
volatility -f 文件名 –profile=系统 Dumpregistry 提取日志文件
volatility -f 文件名 –profile=系统 dlllist 进程相关的dll文件列表
volatility -f 文件名 –profile=系统 memdump -p xxx –dump-dir=./ 提取进程
volatility -f 文件名 –profile=系统 dumpfiles -Q 0xxxxxxxx -D ./ 提取文件
volatility -f 文件名 –profile=系统 procdump -p pid -D ./ 转存可执行程序
volatility -f 文件名 –profile=系统 screenshot –dump-dir=./ 屏幕截图
volatility -f 文件名 –profile=系统 hivedump -o 0xfffff8a001032410 查看注册表键名
volatility -f 文件名 –profile=系统 printkey -K “xxxxxxx” 查看注册表键值
volatility -f /root/hacker.raw –profile=Win7SP1x64 filescan |grep Desktop 查看桌面文件

amcache 查看AmCache应用程序痕迹信息
apihooks 检测内核及进程的内存空间中的API hook
atoms 列出会话及窗口站atom表
atomscan Atom表的池扫描(Pool scanner)
auditpol 列出注册表HKLMSECURITYPolicyPolAdtEv的审计策略信息
bigpools 使用BigPagePoolScanner转储大分页池(big page pools)
bioskbd 从实时模式内存中读取键盘缓冲数据(早期电脑可以读取出BIOS开机密码)
cachedump 获取内存中缓存的域帐号的密码哈希
callbacks 打印全系统通知例程
clipboard 提取Windows剪贴板中的内容
cmdline 显示进程命令行参数
cmdscan 提取执行的命令行历史记录(扫描_COMMAND_HISTORY信息)
connections 打印系统打开的网络连接(仅支持Windows XP 和2003)
connscan 打印TCP连接信息
consoles 提取执行的命令行历史记录(扫描_CONSOLE_INFORMATION信息)
crashinfo 提取崩溃转储信息
deskscan tagDESKTOP池扫描(Poolscaner)
devicetree 显示设备树信息
dlldump 从进程地址空间转储动态链接库
dlllist 打印每个进程加载的动态链接库列表
driverirp IRP hook驱动检测
drivermodule 关联驱动对象至内核模块
driverscan 驱动对象池扫描
dumpcerts 提取RAS私钥及SSL公钥
dumpfiles 提取内存中映射或缓存的文件
dumpregistry 转储内存中注册表信息至磁盘
editbox 查看Edit编辑控件信息 (Listbox正在实验中)
envars 显示进程的环境变量
eventhooks 打印Windows事件hook详细信息
evtlogs 提取Windows事件日志(仅支持XP/2003)
filescan 提取文件对象(file objects)池信息
gahti 转储用户句柄(handle)类型信息
gditimers 打印已安装的GDI计时器(timers)及回调(callbacks)
gdt 显示全局描述符表(Global Deor Table)
getservicesids 获取注册表中的服务名称并返回SID信息
getsids 打印每个进程的SID信息
handles 打印每个进程打开的句柄的列表
hashdump 转储内存中的Windows帐户密码哈希(LM/NTLM)
hibinfo 转储休眠文件信息
hivedump 打印注册表配置单元信息
hivelist 打印注册表配置单元列表
hivescan 注册表配置单元池扫描
hpakextract 从HPAK文件(Fast Dump格式)提取物理内存数据
hpakinfo 查看HPAK文件属性及相关信息
idt 显示中断描述符表(Interrupt Deor Table)
iehistory 重建IE缓存及访问历史记录
imagecopy 将物理地址空间导出原生DD镜像文件
imageinfo 查看/识别镜像信息
impscan 扫描对导入函数的调用
joblinks 打印进程任务链接信息
kdbgscan 搜索和转储潜在KDBG值
kpcrscan 搜索和转储潜在KPCR值
ldrmodules 检测未链接的动态链接DLL
lsadump 从注册表中提取LSA密钥信息(已解密)
machoinfo 转储Mach-O 文件格式信息
malfind 查找隐藏的和插入的代码
mbrparser 扫描并解析潜在的主引导记录(MBR)
memdump 转储进程的可寻址内存
memmap 打印内存映射
messagehooks 桌面和窗口消息钩子的线程列表
mftparser 扫描并解析潜在的MFT条目
moddump 转储内核驱动程序到可执行文件的示例
modscan 内核模块池扫描
modules 打印加载模块的列表
multiscan 批量扫描各种对象
mutantscan 对互斥对象池扫描
notepad 查看记事本当前显示的文本
objtypescan 扫描窗口对象类型对象
patcher 基于页面扫描的补丁程序内存
poolpeek 可配置的池扫描器插件
printkey 打印注册表项及其子项和值
privs 显示进程权限
procdump 进程转储到一个可执行文件示例
pslist 按照EPROCESS列表打印所有正在运行的进程
psscan 进程对象池扫描
pstree 以树型方式打印进程列表
psxview 查找带有隐藏进程的所有进程列表
qemuinfo 转储 Qemu 信息
raw2dmp 将物理内存原生数据转换为windbg崩溃转储格式
screenshot 基于GDI Windows的虚拟屏幕截图保存
servicediff Windows服务列表(ala Plugx)
sessions _MM_SESSION_SPACE的详细信息列表(用户登录会话)
shellbags 打印Shellbags信息
shimcache 解析应用程序兼容性Shim缓存注册表项
shutdowntime 从内存中的注册表信息获取机器关机时间
sockets 打印已打开套接字列表
sockscan TCP套接字对象池扫描
ssdt 显示SSDT条目
strings 物理到虚拟地址的偏移匹配(需要一些时间,带详细信息)
svcscan Windows服务列表扫描
symlinkscan 符号链接对象池扫描
thrdscan 线程对象池扫描
threads 调查_ETHREAD 和_KTHREADs
timeliner 创建内存中的各种痕迹信息的时间线
timers 打印内核计时器及关联模块的DPC
truecryptmaster Recover 恢复TrueCrypt 7.1a主密钥
truecryptpassphrase 查找并提取TrueCrypt密码
truecryptsummary TrueCrypt摘要信息
unloadedmodules 打印卸载的模块信息列表
userassist 打印注册表中UserAssist相关信息
userhandles 转储用户句柄表
vaddump 转储VAD数据为文件
vadinfo 转储VAD信息
vadtree 以树形方式显示VAD树信息
vadwalk 显示遍历VAD树
vboxinfo 转储Virtualbox信息(虚拟机)
verinfo 打印PE镜像中的版本信息
vmwareinfo 转储VMware VMSS/VMSN 信息
volshell 内存镜像中的shell
windows 打印桌面窗口(详细信息)
wintree Z顺序打印桌面窗口树
wndscan 池扫描窗口站
yarascan 以Yara签名扫描进程或内核内存

1.例子(忘了是哪个比赛的题目了)

你作为 A 公司的应急响应人员,请分析提供的内存文件按照下面的要求找到 相关关键信息,完成应急响应事件。

1、从内存中获取到用户admin的密码并且破解密码,以Flag{admin,password} 形式提交(密码为 6 位);

2、获取当前系统 ip 地址及主机名,以 Flag{ip:主机名}形式提交;

3、获取当前系统浏览器搜索过的关键词,作为 Flag 提交;

4、当前系统中存在挖矿进程,请获取指向的矿池地址,以 Flag{ip:端口}形式 提交;

5、恶意进程在系统中注册了服务,请将服务名以 Flag{服务名}形式提交。

上题已经看到进程

解析
1.从内存中获取到用户admin的密码并且破解密码,以Flag{admin,password} 形式提交(密码为 6 位);
不管什么题内存取证的第一步肯定是去判断当前的镜像信息,分析出是哪个操作系统 使用参数 imageinfo 查看系统信息

  volatility -f 1.vmem imageinfo

操作系统我们一般取第一个就可以了

接下来就可以输入参数

可以先查看当前内存镜像中的用户

volatility -f 1.vmem –profile=Win7SP1x64 printkey -K “SAM\Domains\Account\Users\Names”

使用hashdump获取sam

volatility -f 1.vmem –profile=Win7SP1x64 hashdump

可以通过john工具来进行爆破,但是好像跑不出来结果。应该是设定了强密码。于是只能使用了lasdump命令来查看

volatility -f 1.vmem –profile=Win7SP1x64 lsadump

flag{admin.dfsddew}

2.获取当前系统 ip 地址及主机名,以 Flag{ip:主机名}形式提交;
Netscan 可以查ip

volatility -f 1.vmem –profile=Win7SP1x64 netscan

Ip:192.168.85.129

主机名需要通过查询注册表,先用hivelist

Volatility -f 1.vmem –profile=Win7SP1x64 hivelist

然后我们需要一步一步去找键名

volatility -f 1.vmem –profile=Win7SP1x64 -o 0xfffff8a000024010 printkey

volatility -f 1.vmem –profile=Win7SP1x64 -o 0xfffff8a000024010 printkey -K “ControlSet001”

继续

volatility -f 1.vmem –profile=Win7SP1x64 -o 0xfffff8a000024010 printkey -K “ControlSet001\Control “

继续

volatility -f 1.vmem –profile=Win7SP1x64 -o 0xfffff8a000024010 printkey -K “ControlSet001\Control\ComputerName”

再来

volatility -f 1.vmem –profile=Win7SP1x64 -o 0xfffff8a000024010 printkey -K “ControlSet001\Control\ComputerName\ComputerName”

得到主机名WIN-9FBAEH4UV8C

也可以直接通过 hivedump查询相应的键名 但比较慢

volatility -f 1.vmem –profile=Win7SP1x64 hivedump -o 0xfffff8a000024010 > system.txt

3.获取当前系统浏览器搜索过的关键词,作为 Flag 提交;
这里使用iehistory

volatility -f 1.vmem –profile=Win7SP1x64 iehistory

flag{admin@file:///C:/Users/admin/Desktop/flag.txt}

4.当前系统中存在挖矿进程,请获取指向的矿池地址,以 Flag{ip:端口}形式 提交;
volatility -f 1.vmem –profile=Win7SP1x64 netscan

唯一一个已建立的

flag{54.36.109.161:2222}

5.恶意进程在系统中注册了服务,请将服务名以 Flag{服务名}形式提交。
上一题中已经知道了进程号为2588

volatility -f 1.vmem –profile=Win7SP1x64 pslist -p 2588

查到父进程是3036

然后在通过通过svcscan可以查询服务名称,找到对应服务名

volatility -f 1.vmem –profile=Win7SP1x64 svcscan

flag{VMnetDHCP}

wireshark的使用

1.使用wireshark进行抓包,学会用混淆模式抓包

2.(1)过滤器使用时 过滤arp udp tcp dns http等协议时要输入小写字母进行过滤

​ (2)对ip进行过滤:ip.src_host == 192.168.1.53 表示源 IP 地址

​ ip.dst_host == 192.168.1.1 表示目的地址

​ (3)or和and的使用

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
48
49
50
51
52
53
54
55
56
基于名称的HTTP显示过滤器
1、让wireshark只显示访问某指定域名(www.bt2bn.cn)的HTTP请求数据包:http.host == “www.bt2bn.cn”.

2、让wireshark只显示访问包含了指定字符串的域名(比如,包含bt2bn的域名)的HTTP请求数据包:http.host contains “bt2bn”.

3、让wireshark只显示Referer头部内容为“http://www.bt2bn.cn/“的HTTP请求数据包:http.referer == “http://www.bt2bn.cn/”

基于HTTP请求方法的显示过滤器
1、要让wireshark显示包含GET请求的所有HTTP数据包,显示过滤器的写法为:http.request.method == GET。

2、要让Wireshark显示所有HTTP请求数据包,显示过滤器的写法为:http.request。

3、要让Wireshark显示所有HTTP响应数据包,显示过滤器的写法为:http.response。

4、要让Wireshark显示包含所有HTTP数据包,但包含GET方法的HTTP请求数据包除外,显示过滤器的写法为:http.request and not http.request.method == GET。

基于HTTP状态码的显示过滤器
1、要让Wireshark显示包含HTTP错误状态码的HTTP响应数据包:http.request.code >= 400。

2、要让Wireshark只显示包含HTTP客户端错误状态码的HTTP响应数据包:http.response.code >=400 and http.response.code <= 499。

3、要让Wireshark只显示包含HTTP服务器端错误状态码的HTTP响应数据包:http.response.code <=599。

4、要让Wireshark只显示状态码为404的HTTP响应数据包:http.response.code == 404。

5、过滤所有的http响应包:http.response==1

6、过滤所有的http请求,貌似也可以使用http.request:http.request==1

7、wireshark过滤所有请求方式为POST的http请求包,注意POST为大写:http.request.method==POST

8、过滤含有指定cookie的http数据包:http.cookie contains guid

9、过滤请求的uri,取值是域名后的部分:http.request.uri==”/online/setpoint”

10、过滤含域名的整个url则需要使用http.request.full_uri:http.request.full_uri==” http://task.browser.360.cn/online/setpoint”

11、过滤http头中server字段含有nginx字符的数据包:http.server contains “nginx”

12、过滤content_type是text/html的http响应、post包,即根据文件类型过滤http数据包:http.content_type == “text/html”

13、过滤content_encoding是gzip的http包:http.content_encoding == “gzip”

14、根据transfer_encoding过滤:http.transfer_encoding == “chunked”

15、根据content_length的数值过滤:http.content_length == 279 或 http.content_length_header == “279″

16、过滤所有含有http头中含有server字段的数据包:http.server

17、过滤HTTP/1.1版本的http包,包括请求和响应:http.request.version == “HTTP/1.1″

18、过滤http响应中的phrase:http.response.phrase == “OK”

19、显示前1000个数据包:fream.number <= 1000

20、显示序列号10-20内的数据包:fream.number <= 10 and fream.number <= 20

​ 我们中间用 or 进行了拼接,表示或 当然我们也可以使用 and 表示与,or 表示满足左右其中一个条 件就会显示符合条件的数据包,and 表示左右 2 个条件都满足才会显示

3.常用协议分析。

​ icmp,http,tcp,dns

常见流量分析题目

1. 直接搜flag(flag明文)
2.flag(编码)

flag十六进制:666c6167

asiic转Unicode:

1
&#102;&#108;&#97;&#103;

base64: Zmxh

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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# encoding:utf-8
import os
import os.path
import sys
import subprocess


# 打印可打印字符串
def str_re(str1):
str2 = ""
for i in str1.decode('utf8', 'ignore'):
try:
# print(ord(i))
if ord(i) <= 126 and ord(i) >= 33:
str2 += i
except:
str2 += ""
# print(str2)
return str2


# 写入文本函数
def txt_wt(name, txt1):
with open("output.txt", "a") as f:
f.write('filename:' + name)
f.write("\n")
f.write('flag:' + txt1)
f.write("\n")


# 第一次运行,清空output文件
def clear_txt():
with open("output.txt", "w") as f:
print("clear output.txt!!!")


# 递归遍历的所有文件
def file_bianli():
# 路径设置为当前目录
path = os.getcwd()
# 返回文件下的所有文件列表
file_list = []
for i, j, k in os.walk(path):
for dd in k:
if ".py" not in dd and "output.txt" not in dd:
file_list.append(os.path.join(i, dd))
return file_list


# 查找文件中可能为flag的字符串

def flag(file_list, flag):
for i in file_list:
try:
with open(i, "rb") as f:
for j in f.readlines():
j1 = str_re(j) # 可打印字符串
# print j1
for k in flag:
if k in j1:
txt_wt(i, j1)
print('filename:', i)
print('flag:', j1)
except:
print('err')


#这里可以自行添加一些flag编码后的形式
flag_txt = ['flag{', '666c6167', 'flag', 'Zmxh', '&#102', '666C6167']

# 清空输出的文本文件
clear_txt()
# 遍历文件名
file_lt = file_bianli()
# 查找flag关键字
flag(file_lt, flag_txt)


3.压缩包

找到压缩包对应的字节流

红色就是发送包,蓝色就是返回包

菜刀流量的一个特征应该是有 X@Y

4、不可打印字符(telnet协议)
5.蓝牙协议
6.usb键盘鼠标流量
7.无线流量
8.流量包修复

题目:第一届 “百度杯” 信息安全攻防总决赛 线上选拔赛:find the flag

WP:https://www.cnblogs.com/ECJTUACM-873284962/p/9884447.html

首先我们拿到这样一道流量包的题目,题目名称为 find the flag 。这里面给了很多提示信息,要我们去找到 flag

第一步,搜索 flag 字样

我们先去搜索看看流量包里面有没有 flag 。我们使用 strings 命令去找一下流量包, Windows 的朋友可以用 notepad++ 的搜索功能去寻找。

搜索命令如下:

1
strings findtheflag.cap | grep flag

搜索结果如下:

我们发现搜出了一大堆的东西,我们通过管道去过滤出 flag 信息,似乎没有发现我们所需要找的答案。

第二步,流量包修复

我们用 wireshark 打开这个流量包

我们发现这个流量包出现了异常现象,我们可以修复一下这个流量包。

这里我们用到一个在线工具:http://f00l.de/hacking/pcapfix.php

这个工具可以帮助我们快速地将其流量包修复为 pcap 包。

我们对其进行在线修复。

修复完毕后点击 Get your repaired PCAP-file here. 即可下载流量包,然后我们用 wireshark 打开。

既然还是要找 flag ,我们可以先看看这个流量包。

第三步,追踪 TCP 流

我们追踪一下 TCP 流,看看有没有什么突破?

我们通过追踪 TCP 流,可以看到一些版本信息, cookie 等等,我们还是发现了一些很有意思的东西。

tcp.stream eq 29tcp.stream eq 41 只显示了 where is the flag? 这个字样,难道这是出题人在告诉我们 flag 在这里嘛?

第四步,查找分组字节流

我们追踪到 tcp.stream eq 29 的时候,在 Identification 信息中看到了 flag 中的 lf 字样,我们可以继续追踪下一个流,在 tcp.stream eq 30Identification 信息中看到了 flag 中的 ga 字样,我们发现将两个包中 Identification 信息对应的字段从右至左组合,恰好就是 flag !于是我们可以大胆地猜测, flag 肯定是藏在这里面。

我们直接通过搜索 -> 字符串搜索 -> 分组字节流 -> 搜索关键字 flag 即可,按照同样的方式连接后面相连数据包的 Identification 信息对应的字段,即可找到最终的 flag!

下面是搜索的截图:

所以最终的 flag 为:flag{aha!_you_found_it!}

sql盲注

提取数据

1
tshark -r hack.pcap -T fields -e http.request.full_uri|tr -s '\n'|grep flag > log

处理数据

1
2
3
4
5
6
7
8
9
10
11
12
13
14
import re

with open('log') as f:
tmp = f.read()
flag = ''
data = re.findall(r'=(\d*)%23',tmp)
data = [int(i) for i in data]
for i,num in enumerate(data):
try:
if num > data[i+1]:
flag += chr(num)
except Exception:
pass
print flag

一、文件头文件尾

1、图片
  • JPEG 文件头:FF D8 FF 文件尾:FF D9
  • TGA 未压缩的前4字节 00 00 02 00 RLE压缩的前5字节 00 00 10 00 00
  • PNG 文件头:89 50 4E 47 0D 0A 1A 0A 文件尾:AE 42 60 82
  • GIF 文件头:47 49 46 38 39(37) 61 文件尾:00 3B
  • BMP 文件头:42 4D 文件头标识(2 bytes) 42(B) 4D(M)
  • TIFF (tif) 文件头:49 49 2A 00
  • ico 文件头:00 00 01 00
  • Adobe Photoshop (psd) 文件头:38 42 50 53
2、office文件
  • MS Word/Excel (xls.or.doc) 文件头:D0 CF 11 E0
  • MS Access (mdb) 文件头:53 74 61 6E 64 61 72 64 20 4A
  • WordPerfect (wpd) 文件头:FF 57 50 43
  • Adobe Acrobat (pdf) 文件头:25 50 44 46 2D 31 2E
  • application/vnd.visio(vsd) 文件头:D0 CF 11 E0 A1 B1 1A E1
  • Email [thorough only] (eml) 文件头:44 65 6C 69 76 65 72 79 2D 64 61 74 65 3A
  • Outlook Express (dbx) 文件头:CF AD 12 FE C5 FD 74 6F
  • Outlook (pst) 文件头:21 42 44 4E
  • Rich Text Format (rtf) 文件头:7B 5C 72 74 66
  • txt 文件(txt) 文件头:Unicode:FE FF / Unicode big endian:FF FE / UTF-8:EF BB BF /ANSI编码是没有文件头的
3、压缩包文件
  • ZIP Archive (zip) 文件头:50 4B 03 04 文件尾:50 4B
  • RAR Archive (rar) 文件头:52 61 72 21
4、音频文件
  • Wave (wav) 文件头:57 41 56 45
  • audio(Audio) 文件头: 4D 54 68 64
  • audio/x-aac(aac)
  • 文件头:FF F1(9)
5、视频文件
  • AVI (avi) 文件头:41 56 49 20
  • Real Audio (ram) 文件头:2E 72 61 FD
  • Real Media (rm) 文件头:2E 52 4D 46
  • MPEG (mpg) 文件头:00 00 01 BA(3)
  • Quicktime (mov) 文件头:6D 6F 6F 76
  • Windows Media (asf) 文件头:30 26 B2 75 8E 66 CF 11
  • MIDI (mid) 文件头:4D 54 68 64
6、代码文件
  • XML (xml) 文件头:3C 3F 78 6D 6C
  • HTML (html) 文件头:68 74 6D 6C 3E
  • Quicken (qdf) 文件头:AC 9E BD 8F
  • Windows Password (pwl) 文件头:E3 82 85 96
7、其他类型
  • windows证书文件(der) 文件头:30 82 03 C9
  • CAD (dwg) 文件头:41 43 31 30
  • Windows Shortcut (lnk) 文件头:4C 00 00 00
  • Windows reg(reg) 文件头:52 45 47 45 44 49 54 34

rar,zip伪加密

找到第24个字节,该字节尾数为4表示加密,0表示无加密,将尾数改为0即可破解伪加密。