图片

PNG

文件格式详解

png图片是misc里经常出现的文件格式,熟悉它的结构是很有必要的。

首先,PNG由文件头和数据块组成,这个文件头做久了就熟悉了

89 50 4E 47 0D 0A 1A 0A

数据块分为两种,一种是关键数据块,就是必须含有的块,另外一种是辅助数据块,不一定会出现,这里先列出所有种类的块

数据块符号 数据块名称 多数据块 可选否 位置限制
IHDR 文件头数据块 第一块
cHRM 基色和白色点数据块 在PLTE和IDAT之前
gAMA 图像γ数据块 在PLTE和IDAT之前
sBIT 样本有效位数据块 在PLTE和IDAT之前
PLTE 调色板数据块 在IDAT之前
bKGD 背景颜色数据块 在PLTE之后IDAT之前
hIST 图像直方图数据块 在PLTE之后IDAT之前
tRNS 图像透明数据块 在PLTE之后IDAT之前
oFFs (专用公共数据块) 在IDAT之前
pHYs 物理像素尺寸数据块 在IDAT之前
sCAL (专用公共数据块) 在IDAT之前
IDAT 图像数据块 与其他IDAT连续
tIME 图像最后修改时间数据块 无限制
tEXt 文本信息数据块 无限制
zTXt 压缩文本数据块 无限制
fRAc (专用公共数据块) 无限制
gIFg (专用公共数据块) 无限制
gIFt (专用公共数据块) 无限制
gIFx (专用公共数据块) 无限制
IEND 图像结束数据 最后一个数据块

其中每个数据块都由下表的4个域组成

名称 字节数 说明
Length(长度) 4字节 指定数据块中数据域的长度,其长度不超过(231−1)(231−1)字节
Chunk Type Code(数据块类型码) 4字节 数据块类型码由ASCII字母(A-Z和a-z)组成
Chunk Data(数据块实际内容 可变长度 存储按照Chunk Type Code指定的数据
CRC(循环冗余检测 4字节 存储用来检测是否有错误的循环冗余码

其中CRC是非常重要的一个部分,出题人可以直接改掉每个块的CRC内容来往里面隐藏信息或者让你去爆破原来的CRC值,CRC域中的值是对Chunk Type Code域和Chunk Data域中的数据进行计算得到的,可以看做一种校验码。

IDHR

它包含有PNG文件中存储的图像数据的基本信息,并要作为第一个数据块出现在PNG数据流中,而且一个PNG数据流中只能有一个文件头数据块。

文件头数据块由13字节,组成结构如下:

域的名称 字节数 说明
Width 4 bytes 图像宽度,以像素为单位
Height 4 bytes 图像高度,以像素为单位
Bit depth 1 byte 图像深度:索引彩色图像:1,2,4或8 ;灰度图像:1,2,4,8或16 ;真彩色图像:8或16
ColorType 1 byte 颜色类型:0:灰度图像, 1,2,4,8或16;2:真彩色图像,8或16;3:索引彩色图像,1,2,4或84:带α通道数据的灰度图像,8或16;6:带α通道数据的真彩色图像,8或16
Compression method 1 byte 压缩方法(LZ77派生算法)
Filter method 1 byte 滤波器方法
Interlace method 1 byte 隔行扫描方法:0:非隔行扫描;1: Adam7(由Adam M. Costello开发的7遍隔行扫描方法)

这里经常会出现修改宽高的题目,可以直接在十六进制里面改数值来修改图片的高度来看有没有隐藏内容

IDAT

它存储实际的数据,在数据流中可包含多个连续顺序的图像数据块,

IDAT存放着图像真正的数据信息。

可能出现的考点方式是,前面连续几个IDAT块是一个图片,然后后面几个连续的IDAT块是另外一张图片,也可能直接在里面塞入其它文件。

所以要特别关注IDAT块的大小,一般图片的IDAT块大小除了最后一块都是一样的,如果出现几个大小明显不一样的,可以看看是不是塞了其它文件

IEND

它用来标记PNG文件或者数据流已经结束,并且必须要放在文件的尾部,也需要记住这些格式

00 00 00 00 49 45 4E 44 AE 42 60 82

同样可能在文件尾后面隐藏文件

tEXT和zTxt

这两个数据块都可以写入数据,不过可以通过工具exiftools查看

工具

Stegslove

关于这个工具这里有使用的方法

可以应对常见的图片隐写,导入图片后可以查看不同色阶,还可以以下几个功能

File Format:文件格式

Data Extract:数据提取

Steregram Solve:立体试图 可以左右控制偏移

Frame Browser:帧浏览器

Image Combiner:拼图,图片拼接

可以在Data Extract里面去解决lsb隐写问题,有挺多选项可以选择的,例如以下

  • Extra By(额外的):分为row(行)和column(纵)

每个像素用R,G,B三个分量表示,那么一张图片就像一个矩阵,矩阵的每个单位就是(0255,0255,0~255)也就会有是纵排列和行排列了,一般事先访问行再访问列(如果相反会引起ve使用方法)

  • Bit Order(位顺序):MSB是一串数据的最高位,LSB是一串数据的最低位。
  • Bit Plane Order(位平面的顺序)

整个图像分解为8个位平面,从LSB(最低有效位0)到MSB(最高有效位7)随着从位平面0 到位平面7,位平面图像的特征逐渐变得复杂,细节不断增加。(一般我们的图片如果是RGB那么就是24位 3乘8嘛)

  • Bit Plane Order(位平面的顺序):一般图片是24位 也就是3个8 大家可以想像成三明治 比如BGR就是B为三明治第一层 G为第二层 R为第三层。
exiftool

查看图片的附加信息,直接cmd

.\exiftool.exe xxx.png

LSB隐写
Zsteg

kali下的神器,可以查看各种各样的lsb隐写

安装

1
2
3
git clone https://github.com/zed-0xff/zsteg
cd zsteg/
gem install zsteg

查看帮助

1
zsteg -h

查看LSB信息

1
zsteg pcat.png

检测zlib

1
2
# -b的位数是从1开始的
zsteg zlib.bmp -b 1 -o xy -v

显示细节

1
zsteg pcat.png -v

尝试所有已知的组合

1
zsteg pcat.png -a

导出内容

1
zsteg -E "b1,bgr,lsb,xy" pcat.png > p.exe
脚本

这里贴几个脚本

https://github.com/livz/cloacked-pixel 可加密码

https://github.com/RobinDavid/LSB-Steganography

https://github.com/ragibson/Steganography 对wav,png

https://github.com/dhsdshdhk/stegpy 对png,bmp,gif,Webp,wav

pngcheck

官网

pngcheck.exe -v xxx.png

可以检查IDAT块内容,再贴一下解压zlib(文件头是789C)的脚本

1
2
3
4
5
6
7
8
9
10
11
import zlib

import binascii

IDAT = "IDAT_data".decode('hex')

result = binascii.hexlify(zlib.decompress(IDAT))

print (result.decode('hex'))

print (len(result.decode('hex')))
TweakPNG

它允许查看和修改一些PNG图像文件的原信息存储

如果文件头是正常的,但却无法打开,可以使用TweakPNG修改CRC。出现校验信息错误时,可以根据错误的CRC去十六进制中搜索,然后改成正确的CRC。(CRC上一行之后的 8个字节,前四个为宽度,后四个为高度(十六进制下的第二行前八位))

PngDebugger

https://github.com/rvong/png-debugger

可以自动修补坏的crc

PCRT

https://github.com/sherlly/PCRT

它可以实现:

1
2
3
4
5
6
7
8
9
10
显示图片文件信息
修复PNG文件头错误
修复由于错误的图片长度或宽度导致的IHDR块crc校验出错
修复由于DOS->UNIX平台自动格式转换导致的部分IDAT块数据长度出错
修复由于自身错误导致的IDAT块crc校验出错
修复丢失的IEND块
提取追加在IEND块后的数据(恶意程序常使用的传播方式)
自动显示修复后的图片
添加payload到图片文件
解析图片压缩数据并显示
CRC修复脚本

可以得到正确的宽高

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
import zlib
import struct
#读文件
file = '1.png'
fr = open(file,'rb').read()
data = bytearray(fr[12:29])
crc32key = eval(str(fr[29:33]).replace('\\x','').replace("b'",'0x').replace("'",''))
#crc32key = 0xCBD6DF8A #补上0x,copy hex value
#data = bytearray(b'\x49\x48\x44\x52\x00\x00\x01\xF4\x00\x00\x01\xF1\x08\x06\x00\x00\x00') #hex下copy grep hex
n = 4095 #理论上0xffffffff,但考虑到屏幕实际,0x0fff就差不多了
for w in range(n):#高和宽一起爆破
width = bytearray(struct.pack('>i', w))#q为8字节,i为4字节,h为2字节
for h in range(n):
height = bytearray(struct.pack('>i', h))
for x in range(4):
data[x+4] = width[x]
data[x+8] = height[x]
#print(data)
crc32result = zlib.crc32(data)
if crc32result == crc32key:
print(width,height)
#写文件
newpic = bytearray(fr)
for x in range(4):
newpic[x+16] = width[x]
newpic[x+20] = height[x]
fw = open(file+'.png','wb')#保存副本
fw.write(newpic)
fw.close
# return None
盲水印

一般会出现两个看起来一样的图片,这里要用工具对比得到对应的水印(应该bmp也适用)

这里一般会用到这两个脚本

https://github.com/chishaxie/BlindWaterMark

记住python2和python3的脚本有时候得到的水印不一样!

https://github.com/linyacool/blind-watermark

https://github.com/ww23/BlindWatermark

同时有一个叫WaterMarkH的软件也可以试试

这个是java的盲水印脚本,只用一张图,而且可以同时对jpg和png使用

频域盲水印,直接贴脚本

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
import cv2
import numpy as np
import random
import os
from argparse import ArgumentParser

ALPHA = 5

def build_parser():
parser = ArgumentParser()
parser.add_argument('--original', dest='ori', required=True)
parser.add_argument('--image', dest='img', required=True)
parser.add_argument('--result', dest='res', required=True)
parser.add_argument('--alpha', dest='alpha', default=ALPHA)
return parser

def main():
parser = build_parser()
options = parser.parse_args()
ori = options.ori
img = options.img
res = options.res
alpha = options.alpha
if not os.path.isfile(ori):
parser.error("original image %s does not exist." % ori)
if not os.path.isfile(img):
parser.error("image %s does not exist." % img)
decode(ori, img, res, alpha)

def decode(ori_path, img_path, res_path, alpha):
ori = cv2.imread(ori_path)
img = cv2.imread(img_path)
ori_f = np.fft.fft2(ori)
img_f = np.fft.fft2(img)
height, width = ori.shape[0], ori.shape[1]
watermark = (ori_f - img_f) / alpha
watermark = np.real(watermark)
res = np.zeros(watermark.shape)
random.seed(height + width)
x = range(height / 2)
y = range(width)
random.shuffle(x)
random.shuffle(y)
for i in range(height / 2):
for j in range(width):
res[x[i]][y[j]] = watermark[i][j]
cv2.imwrite(res_path, res, [int(cv2.IMWRITE_JPEG_QUALITY), 100])

if __name__ == '__main__':
main()

使用

python pinyubwm.py –original 1.png –image 2.png –result out.png

WebP

安装(kali)

apt install webp

使用

  • cwebp-编码器工具:可以把png转为webp

    cwebp 1.png -o 2.webp

  • dwebp-解码器工具:把webp转为png

    dwebp 1.webp -o 2.png

  • vwebp-查看器工具:可以直接查看webp格式图片

    vwebp 1.webp

  • webpinfo-格式查看工具:可以打印出webp文件的块级结构以及基本完整性检查

    webpinfo 1.webp

也可以用在线网站转换webp为png

Steghide
  • 安装(kali中)
1
apt-get install steghide
  • 使用(加密)

将 flag.txt 文件隐藏到 out.jpg 中:

1
steghide embed -cf out.jpg -ef flag.txt [-p 123456] # -p后接密码,可无
  • 使用(解密)

查看图片中嵌入的文件信息:

1
steghide info out.jpg

提取含有密码的隐藏内容:

1
steghide extract -sf out.jpg -p 123456

提取不含有密码的隐藏内容:

1
steghide extract -sf out.jpg

直接按回车即可

  • steghide爆破密码

有些题目用steghide加密文件但是不给密码,此时就需要爆破,steghide本身并不支持爆破,需要一些其他的方法:https://github.com/Va5c0/Steghide-Brute-Force-Tool

1
python steg_brute.py -b -d [字典] -f [jpg_file]

需要安装的库:progressbar

1
pip install progressbar2
快速傅里叶变换(FFT)脚本
1
2
3
4
5
6
7
8
9
10
11
12
13
14
import cv2 as cv
import numpy as np
import matplotlib.pyplot as plt
img = cv.imread('FFT.png', 0) #读为灰度图像
f = np.fft.fft2(img) #做频率变换
fshift = np.fft.fftshift(f) #转移像素做幅度谱
s1 = np.log(np.abs(fshift))#取绝对值:将复数变化成实数取对数的目的为了将数据变化到0-255
plt.subplot(121)
plt.imshow(img, 'gray')
plt.title('original')
plt.subplot(122)
plt.imshow(s1,'gray')
plt.title('center')
plt.show()

也可以用ImageJ试试

补充一道红帽杯2021misc的题目PicPic

题目给了1.mkv 2.mkv create.py 和一个rar

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
import os
import cv2
import struct
import numpy as np


def mapping(data, down=0, up=255, tp=np.uint8):
data_max = data.max()
data_min = data.min()
interval = data_max - data_min
new_interval = up - down
new_data = (data - data_min) * new_interval / interval + down
new_data = new_data.astype(tp)
return new_data


def fft(img):
fft = np.fft.fft2(img)
fft = np.fft.fftshift(fft)
m = np.log(np.abs(fft))
p = np.angle(fft)
return m, p


if __name__ == '__main__':
os.mkdir('m')
os.mkdir('p')
os.mkdir('frame')
os.system('ffmpeg -i secret.mp4 frame/%03d.png')

files = os.listdir('frame')
r_file = open('r', 'wb')

for file in files:
img = cv2.imread(f'frame/{file}', cv2.IMREAD_GRAYSCALE)

m, p = fft(img)
r_file.write(struct.pack('!ff', m.min(), m.max()))

new_img1 = mapping(m)
new_img2 = mapping(p)

cv2.imwrite(f'm/{file}', new_img1)
cv2.imwrite(f'p/{file}', new_img2)

r_file.close()
os.system('ffmpeg -i m/%03d.png -r 25 -vcodec png 1.mkv')
os.system('ffmpeg -i p/%03d.png -r 25 -vcodec png 2.mkv')

这里可以看出是把一个mp4按帧分解,一个频域一个相位,这里贴一下snowywar大佬的脚本

写脚本进行fft变换,由于fft进行多次变换的时候信号方向只会发生旋转,所以理论上原帧直接进行fft也不是不行,所以把题目给的脚本拿过来再fft一次就可

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
import os
import cv2
import struct
import numpy as np


def mapping(data, down=0, up=255, tp=np.uint8):
data_max = data.max()
data_min = data.min()
interval = data_max - data_min
new_interval = up - down
new_data = (data - data_min) * new_interval / interval + down
new_data = new_data.astype(tp)
return new_data


def fft(img):
fft = np.fft.fft2(img)
fft = np.fft.fftshift(fft)
m = np.log(np.abs(fft))
p = np.angle(fft)
return m, p


if __name__ == '__main__':
os.mkdir('m')
os.mkdir('p')
# os.mkdir('frame')
# os.system('ffmpeg -i secret.mp4 frame/%03d.png')
#
files = os.listdir('test')
r_file = open('r', 'wb')

for file in files:
img = cv2.imread(f'test1/{file}', cv2.IMREAD_GRAYSCALE)

m, p = fft(img)
r_file.write(struct.pack('!ff', m.min(), m.max()))

new_img1 = mapping(m)
new_img2 = mapping(p)

cv2.imwrite(f'm/{file}', new_img1)
cv2.imwrite(f'p/{file}', new_img2)

r_file.close()
# os.system('ffmpeg -i m/%03d.png -r 25 -vcodec png 1.mkv')
# os.system('ffmpeg -i p/%03d.png -r 25 -vcodec png 2.mkv')

Jpg

JFIF格式的JPEG文件(*.jpg)的一般顺序为:

SOI(0xFFD8)文件头

APP0(0xFFE0)

[APPn(0xFFEn)]可选

DQT(0xFFDB)

SOF0(0xFFC0)

DHT(0xFFC4)

SOS(0xFFDA)

压缩数据

EOI(0xFFD9)文件尾

记得查看jpg的属性,看看有没有什么信息,也可以用exiftool看

隐写工具

Stegdetect

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

q – 仅显示可能包含隐藏内容的图像

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

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

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

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

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

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

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

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

使用

.\stegdetect.exe -tjopi -s 10.0 .\xxx.jpg

f5-steganography (F5隐写,需要passwd)
  • 安装

kali中安装: git clone https://github.com/matthewgao/F5-steganography

1
2
> git clone https://github.com/matthewgao/F5-steganography
......
  • 使用(解密)

进入 F5-steganography 文件夹 打开终端

1
2
> java Extract 1.jpg -p 123456
# -p后接f5的key

打开 output.txt 文件即可

  • 使用(加密)
1
> java Embed 原图.jpg 生成图.jpg -e 隐藏的文件.txt -p 密码
outguess (可需要passwd)
  • 安装

打开终端输入: git clone https://github.com/crorvick/outguess

1
2
> git clone https://github.com/crorvick/outguess
......

下载成功后进入outguess文件夹,在文件夹中打开终端输入:**./configure && make && make install**

1
2
> ./configure && make && make install
......

成功后即可使用

  • 使用(加密)

右键打开终端

1
2
3
4
5
> outguess -k 12345 -d hidden.txt 1.jpg 2.jpg
......
# -k后接密码
# -d后接要隐藏的内容
# 加密后1.jpg会覆盖2.jpg
  • 使用(解密)

右键打开终端(接上述)

1
2
> outguess -k 12345 -r 2.jpg out.txt
......

out.txt 中内容即为想要隐藏的 hidden.txt 中内容

也可不需要密码,即

1
> outguess -r 2.jpg out.txt
JPHS

图形化界面,没啥好说的

BMP

BMP文件格式,又称为Bitmap(位图)或是DIB(Device-Independent Device,设备无关位图),是Windows系统中广泛使用的图像文件格式。由于它可以不作任何变换地保存图像像素域的数据,因此成为我们取得RAW数据的重要来源。Windows的图形用户界面(graphical user interfaces)也在它的内建图像子系统GDI中对BMP格式提供了支持。

BMP文件的数据按照从文件头开始的先后顺序分为四个部分:

  • bmp文件头(bmp file header):提供文件的格式、大小等信息

  • 位图信息头(bitmap information):提供图像数据的尺寸、位平面数、压缩方式、颜色索引等信息

  • 调色板(color palette):可选,如使用索引来表示图像,调色板就是索引与其对应的颜色的映射表

  • 位图数据(bitmap data)

bmp文件格式

00-01 为424D ascii为BM 这个是文件头固定格式

02-05为文件的大小

06-09保留为0

0A-0D 记录图像数据区的起始位置。各字节的信息含义依次为:文件头信息块大小,图像描述信息块的大小,图像颜色表的大小,保留(为01)

000E-0011:图像描述信息块的大小,常为28H。

0012-0015:图像宽度。

0016-0019:图像高度。

001A-001B:图像的plane总数(恒为1)。

001C-001D:记录像素的位数,很重要的数值,图像的颜色数由该值决定。(18就是24位)

001E-0021:数据压缩方式(数值位0:不压缩;1:8位压缩;2:4位压缩)。

0022-0025:图像区数据的大小。

0026-0029:水平每米有多少像素,在设备无关位图(.DIB)中,每字节以00H填写。

002A-002D:垂直每米有多少像素,在设备无关位图(.DIB)中,每字节以00H填写。

002E-0031:此图像所用的颜色数,如值为0,表示所有颜色一样重要。

BMP特点

若是24位bmp

宽x高x3=大小

若是32位bmp

图像分辨率 x 颜色深度/8 = 图像所占的字节数

分辨率(width x height) x (颜色深度/8)+ bmp文件头(共14Bytes) + 位图信息头(共40Bytes) + 文件尾(共2bytes: 00 00) = 图像文件大小

GIF

可以使用Stegsolve一帧一帧查看图片,这里推荐看ga1axy大佬的博客,这里直接贴一下

  • 空间轴:

由于gif的动态特性,由一帧一帧的图片构成,所以每一帧的图片,多帧图片间的结合,都成了隐藏信息的一种载体,对于空间轴隐写,我们可以将gif文件每一帧的图片分离开来,可以在kali中使用convert命令来实现:

1
convert 1.gif out.png

在 1.gif 所在文件夹就会出现一系列 out.png 图片

  • 时间轴:

gif文件的每一帧之间的时间间隔也可以作为信息隐藏的载体,可以用identify命令打印出gif每一帧的时间间隔:

1
identify -format '%s %T \n' 1.gif

一般此种题在打印出时间间隔后,时间间隔会有明显的规律,比如:

1
2
3
4
5
6
7
8
9
10
11
12
0 10 
1 20
2 20
3 20
4 10
5 10
6 10
7 10
8 10
9 20
10 20
...

此种情况即可把时间间隔 20 & 10 转化为 0 & 1 字符串(或 1 & 0)然后转化成 ASCII码 即可,此时建议使用以下命令,更为方便:

1
2
3
identify -format '%T' 1.gif

10202020101010101020201010101020102020201010201010202020102010101010202010202020101020202010201010102020102020101010202010101020101020201020102010102020102020101010202010102010
  • 以上两个命令基于 ImageMagick ,安装方法如下:
1
sudo apt-get install imagemagick

测试是否安装成功:

1
convert -version

如果出现下面的信息,则表示安装成功:

1
2
3
4
5
Version: ImageMagick 6.9.10-23 Q16 x86_64 20190101 https://imagemagick.org
Copyright: © 1999-2019 ImageMagick Studio LLC
License: https://imagemagick.org/script/license.php
Features: Cipher DPC Modules OpenMP
...

压缩包

ZIP

文件格式详解

ZIP文件一般分为数据区与目录区。数据区的开头标识为504B0304,而目录区开始的标识为504B0102

avater

avater

给个例子参考一下

avater

  • 在misc中经常会遇到使用winhex或者010editor来查看文件来知道是什么类型的文件,像zip文件标识头为504B0304,有些题目会将文件标识头去掉或者写错,可以用工具修改后就可以正常打开,
伪加密

一个比较重要的就是可以查看该zip文件是否加密,zip文件格式中存在两个加密标志位,前面的加密标志位为数据区的加密标志位,后面的加密标志位为目录区的加密标志位

这里涉及了三种情况,

1.数据区的加密标志位前两位为基数,目录区的加密标志位前两位也为基数,这样子是真加密。

2.数据区的加密标志位前两位为偶数,目录区的加密标志位前两位也为偶数,这样子没有加密,可以直接打开

3.数据区的加密标志位前两位为偶数,目录区的加密标志位前两位也为基数,这样子是伪加密,打开时提醒要密码,只需要修改为偶数就可以打开了

也可以用工具ZipCenOp

java -jar ZipCenop.jar r xxx.zip

密码爆破

详分有暴力,掩码,字典

  • 暴力:选择密码范围,长度等,由软件组合生成密码进行爆破
  • 掩码:知道密码中的一部分,只需按规则构造其余部分
  • 字典:通常是多数用户常用的一些密码集合,导入字典文件用其中的密码进行爆破
  • 明文攻击: 如果得到了加密压缩包中的某个文件,那么就可以通过明文攻击来获取压缩密码

大致原理是当你不知道一个zip的密码,但是你有zip中的一个已知文件(文件大小要大于12Byte)时,因为同一个zip压缩包里的所有文件都是使用同一个加密密钥来加密的,所以可以用已知文件来找加密密钥,利用密钥来解锁其他加密文件

  • 具体操作:假如你有一个flag.zip,里面的文件是1.txt和2.txt,然后你有1.txt,你需要得到2.txt的内容,这个时候你需要用和flag.zip一样的压缩软件而且必须是一样的压缩方式把1.txt压缩,这里可以查看压缩包里面文件的CRC32值知道是否用同一种压缩方式(hgame2021出过类似的题目)

这里建议用advanced zip password recovery进行爆破,或者Ziperello

CRC32碰撞

CRC校验实用程序库 在数据存储和数据通讯领域,为了保证数据的正确,就不得不采用检错的手段。在诸多检错手段中,CRC是最著名的一种。CRC的全称是循环冗余校验。总之每个文件都有唯一的CRC32值,即便数据中一个bit发生变化,也会导致CRC32值不同。若是知道一段数据的长度和CRC32值,便可穷举数据,与其CRC32对照,以此达到暴力猜解的目的。但通常只适用于较小文本文件。比如这里有一个加密的rar,直接双击就可以看见其中信息,便可写脚本爆破,一般用于压缩包里面是一个大小小于6个字节的txt文件

直接上脚本

使用

python crc32.py reverse 你的crc32密文

这里再贴一个在csdn发现的一个不错的脚本

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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
# coding:utf-8

"""
Author:spaceman
"""

import binascii
import string
from time import sleep

def is_number(s):
try:
float(s)
return True
except ValueError:
pass

try:
import unicodedata
unicodedata.numeric(s)
return True
except (TypeError, ValueError):
pass

return False

# 进度条
def progress(percent=0, width=40):
left = width * percent // 95
right = width - left
print ('\r[', '#' * left, ' ' * right, ']',f' {percent:.0f}%',sep='', end='', flush=True)

# 一位字节
def crc1(strs,dic):
strs = hex(int(strs,16))
rs = ''
for i in dic:
s = i
if hex(binascii.crc32(s.encode())) == strs:
rs += s
print (strs+' : '+s)
return rs

# 两位字节
def crc2(strs,dic):
strs = hex(int(strs,16))
rs = ''
for i in dic:
for j in dic:
s = i + j
if hex(binascii.crc32(s.encode())) == strs:
rs += s
print (strs+' : '+s)
return rs

# 三位字节
def crc3(strs,dic):
strs = hex(int(strs,16))
rs = ''
for i in dic:
for j in dic:
for k in dic:
s = i+j+k
if hex(binascii.crc32(s.encode())) == strs:
rs += s
print (strs+' : '+s)
return rs

# 四位字节
def crc4(strs,dic):
strs = hex(int(strs,16))
rs = ''
it = 1
for i in dic:
for j in dic:
for k in dic:
for m in dic:
s = i+j+k+m
if hex(binascii.crc32(s.encode())) == strs:
rs += s
print ()
print (strs+' : '+s)
print ('\n')
progress(it)
sleep(0.1)
it += 1
return rs


# 五位字节
def crc5(strs,dic):
strs = hex(int(strs,16))
rs = ''
it = 1
for i in dic:
progress(it)
for j in dic:
for k in dic:
for m in dic:
for n in dic:
s = i+j+k+m+n
if hex(binascii.crc32(s.encode())) == strs:
rs += s
print ()
print (strs+' : '+s)
print ('\n')
sleep(0.1)
it += 1
return rs

# 计算碰撞 crc
def CrackCrc(crclist,length):
print ()
print ("正在计算...")
print ()
dic = ''' !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~''' # 碰撞需要的字符字典
dic = dic[::-1]
text = ''
for i in crclist:
if length == '1':
text += crc1(i,dic)
if length == '2':
text += crc2(i,dic)
if length == '3':
text += crc3(i,dic)
if length == '4':
text += crc4(i,dic)
if length == '5':
text += crc5(i,dic)
print ('\n')
if text == '':
print ("碰撞失败,无结果")
exit()
print ("字符顺序组合:",end=' ')
print ()
print (text)
print ()
input("回车确认结束程序...")

# 主函数
print ('''
##############################

###### Author:spaceman ######

### Thank you for your use ###

##############################
''')
listcrc = [] # 用于存储crc值
length = (input("请输入文本字节大小(1-5):")) # 即文本内容大小,如文本内容为flag,大小即为4
if is_number(length) == False or length not in ("1,2,3,4,5"):
exit("非指定数字,退出")
print ()
while 1:
crc = input('请输入crc值(例如:d1f4eb9a,输入n完成输入):')
if crc == 'n':
break
crc = '0x'+crc
if len(crc) != 10:
print ("rcr长度不对,请重新输入")
continue
listcrc.append(crc)

CrackCrc(listcrc,length)

RAR

文件格式详解

参考

下面的文件格式分析是基于RAR4.x,并不是RAR5.0
RAR 5.0签名和RAR4.x的签名不一样
RAR 5.0签名由8个字节组成:
0x52 0x61 0x72 0x21 0x1A 0x07 0x01 0x00
比较一下
RAR 4.x 签名由7字节组成:
0x52 0x61 0x72 0x21 0x1A 0x07 0x00

一个RAR4.x压缩文件由若干可变长度的块组成
常见块类型如下:

标记块:HEAD_TYPE=0x72
压缩文件头:HEAD_TYPE=0x73
文件头:HEAD_TYPE=0x74
旧风格的注释头:HEAD_TYPE=0x75
旧风格的用户身份信息:HEAD_TYPE=0x76
旧风格的子块:HEAD_TYPE=0x77
旧风格的恢复记录:HEAD_TYPE=0X78
旧风格的用户身份信息:HEAD_TYPE=0X79
子块:HEAD_TYPE=0x7A
最后的结束块:HEAD_TYPE=0x7B

avater

头类型是0x73表示压缩文件头块
位标记为0x0000 没有位被置为1 ,如果块头被加密,则位标记应该为:0x8000
文件头大小为0x0D00,由上图可以看出这个压缩文件头块占13个字节

结尾块

C4 3D 7B 00 40 07 00

伪加密

看第24个十六进制数后面是0还是4,是4就是伪加密

视频

这里还是看hgame一道题

音频

Audacity

一般的都音频都可以丢进去分析,可以查看音频的波形,频谱,

有的时候会隐藏莫斯密码

Deepsound

需要密码的一种加密方法

这里贴一下破解密码的脚本

SSTV

百科

慢扫描电视Slow-scan television)是业余无线电爱好者的一种主要图片传输方法,慢扫描电视通过无线电传输和接收单色或彩色静态图片。

得到的音频听起来有点像莫斯电码那种滴滴滴滴的,可以用工具解码得到图片

kali下面安装

apt-get install qsstv

使用

Options->Configuration->Sound勾选From file

然后点击播放得到图片

Morse2ascii(莫斯密码转换)

安装(kali)

apt-get install morse2ascii

使用

morse2ascii xxx.wav

dtmf2num

可以识别电话音

下载地址

使用

dtmf2num xxx.wav

MP3stego

直接

.\Decode.exe -X -p [password] [stego_mp3]

steghide

使用方法同前文图片隐写

Silenteye

图形化界面,隐写方式类似lsb,可以改变密码

密码&加密方法&骚操作

工具

在线网站有完整的base系列

参考奇奇怪怪的编码和密码学

CaptfEncoder很好用的编解码软件

CyberChefyyds,很多题目都是在这里编码的flag,很推荐使用这个

千千秀字有一些国产的奇奇怪怪的编码

国外奇怪的编码这个网站可以说非常全了

base系列

Base64:A-Z 、a-z、+、/ (由于特性末尾可能会有一个或者两个=) Base58:相比Base64,不使用数字0,字母大写OI和小写l以及符号+/ Base32:A-Z、2-7、可以出现两个以上的=

Base16:0-9、A-F(和十六进制不是一样吗)

base100:Emoji表情符号编码/解码,可将文本内容编码为Emoji表情符号;同时也可以将编码后的Emoji表情符号内容解码为文本。

base91:顾名思义,Base91需要91个字符来表示ASCII编码的二进制数据。

Base91编码是从94个可打印ASCII字符(0x21-0x7E)中,以下三个字符被省略以构建Base91编码表:

    -(破折号,0x2D)

    \(反斜杠,0x5C)

    ‘(撇号,0x27)Base91是将二进制数据编码为ASCII字符的高级方法。 它类似于UUencode或base64,但效率更高。 Base91产生的开销取决于输入数据。 它的数量最多为23%(而base64为33%),范围可以降低到14%,通常发生在0字节块上。

base85:Base85是一种类似于Base64的二进制文本编码形式,通过使用五个ASCII字符来表示四个字节的二进制数据。例如,它用于将图像嵌入到Adobe PDF文件中。

Base85也称为Ascii85,是Paul E. Rutter为btoa实用程序开发的一种二进制文本编码形式。通过使用五个ASCII字符来表示四个字节的二进制数据(使编码量1 / 4比原来大,假设每ASCII字符8个比特),它比更有效UUENCODE或Base64的,它使用四个字符来表示三个字节的数据(1 / 3的增加,假设每ASCII字符8个比特)。

用途是Adobe的PostScript和Portable Document Format文件格式,以及Git使用的二进制文件的补丁编码。

与Base64一样,Base85编码的目标是对二进制数据可打印的ASCII字符进行编码。但是它使用了更大的字符集,因此效率更高一些。具体来说,它可以用5个字符编码4个字节(32位)。

base62:Base62使用了62个字符编码,包括0-9,a-z,A-Z。

现在各个社交网站的短URL,基本都是用Base62来编码的。

Base64和Base62的目的在都在于将需要传输的内容进行编码,尤其是一些特殊字符(如不可见字符、传输时与协议头冲突的字符)。 在安全领域,base62的编码使用较多。

词频分析

在线网站在线网络国产

脚本

1
2
3
4
from collections import Counter
f=open('hidden.txt','r')
f_read=f.read()
print Counter(f_read)

0宽字符隐写

在线网站

unicode隐写

零宽度字符是一种字节宽度为0的不可打印的Unicode字符, 在浏览器等环境不可见, 但是真是存在, 获取字符串长度时也会占位置, 表示某一种控制功能的字符,参考资料

  • 零宽度空格符 (zero-width space) U+200B : 用于较长单词的换行分隔
  • 零宽度非断空格符 (zero width no-break space) U+FEFF : 用于阻止特定位置的换行分隔
  • 零宽度连字符 (zero-width joiner) U+200D : 用于阿拉伯文与印度语系等文字中,使不会发生连字的字符间产生连字效果
  • 零宽度断字符 (zero-width non-joiner) U+200C : 用于阿拉伯文,德文,印度语系等文字中,阻止会发生连字的字符间的连字效果
  • 左至右符 (left-to-right mark) U+200E : 用于在混合文字方向的多种语言文本中(例:混合左至右书写的英语与右至左书写的希伯来语),规定排版文字书写方向为左至右
  • 右至左符 (right-to-left mark) U+200F : 用于在混合文字方向的多种语言文本中,规定排版文字书写方向为右至左

一般情况下,用vim打开就可以发现这些原本看不到的文字,然后在前面的在线网站勾选对应的选项就可以解码了

emoji加密

https://emojipedia.org/

办公软件的隐写

word文档或者Excel表格等等办公软件形成的文件,大多都是一个压缩包。可以修改后缀为zip然后解压来查看隐藏的信息。

隐藏文字

avater

  • 一般勾选图中的选项可以看到隐藏的文字,不过有一次遇到一道题目是,你不勾选这个隐藏文字才能看到隐藏的内容。
  • 还有一种是本来就看不到文字,可能藏在图片下面,可以把图片拖走或者移动一下图片看看有没有文字,一般的操作是直接Ctrl+A全选然后黏贴到记事本看看,(不过上次遇到一个pdf在wps里面打开复制出来的flag是乱码,用chrome把pdf打开就复制到想要的内容了,有的时候得到乱码可以换几个软件试试看)
  • 有的时候这些文件可能还有密码,可能会用到Accent OFFICE Password Recovery或者Advanced PDF Password Recovery
  • 有的时候可能隐藏的文字和背景颜色一样,这里可以通过修改背景颜色得到flag
wbstego

pdf文件的加密工具

NTFS数据流

NTFS交换数据流是NTFS磁盘格式的一个特性,在NTFS文件系统中,每个文件都可以包含多个数据流。除了主文件以外,还可以有几个非主文件流寄存在主文件流中,其使用自有派生来维持与文件相关的信息。虽然我们无法直接看到数据流文件,但是他确实存在系统当中。

反正用人话说就是隐藏了看不见的文件,这里码几个工具

  • ntfsstreamseditor

  • alternatestreamview

  • 命令 notepad xxx.txt:flag.txt

异或修补文件

有的时候得到一个打不开的文件,查看十六进制发现有一些重复的十六进制数,这里可以尝试去异或它来修复文件

(真是让人异或呢)

Strings

kali下用这个命令可以直接查看文件的字符串,推荐用法

strings xxx | grep ‘flag’

pyc文件隐写

直接上脚本

建议使用python3.6

snow隐写

snow隐写一般是对于txt文件或者html文件的隐写,贴一下在线网站

推荐使用离线软件

xortool

https://github.com/raddyfiy/xortool-for-Windows

一个多字节异或加密破解工具

分析文件

python xortool.py binary_xored_cmd

假如概率最大是2

解密

python xortool.py binary_xored_cmd -l 2

拼图工具gaps

https://github.com/nemanja-m/gaps

gaps –image=out.jpg –generations=50 –population=120 –size=50

–image 指向拼图的路径

–size 拼图块的像素尺寸

–generations 遗传算法的代的数量

–population 个体数量

–verbose 每一代训练结束后展示最佳结果

–save 将拼图还原为图像

根据坐标画图工具 gnuplot

如果你得到类似的数字

3 3

3 4

3 5

3 6

你可以使用gnuplot去打印它

奇奇怪怪的文件格式

BPG

一种图片的格式,直接去官网在线转换或者下载离线工具就可以

SWF

swf后缀格式的文件是Flash的专用格式,被广泛应用于网页设计、动画制作等领域,因此可以使用Flash打开

可以用jpexs-decompiler进行反编译

FAT

FAT是文件配置表(英语:File Allocation Table,首字母缩略字:FAT),是一种由微软发明并拥有部分专利的文件系统,供MS-DOS使用,也是所有非NT核心的微软窗口使用的文件系统。

里面码一个神器VeraCrypt,可以用它打开fat后缀文件,有的时候可能需要密码

apng

wiki

APNGAnimated Portable Network Graphics格式PNG位图动画扩展,但未获PNG组织官方认可。其扩展方法类似GIF 89a,仍对原版PNG保持向下兼容。APNG第1帧为标准PNG图像,剩余的动画和帧速等数据放在PNG扩展数据块,因此只支持原版PNG的软件会正确显示第1帧。APNG与Mozilla社区关系密切,格式标准文档设在Mozilla网站。

可以直接拖进chrome里面

错误的文件头

码一下常见文件头,这里参考

扩展名 文件头标识(HEX) 文件描述
123 00 00 1A 00 05 10 04 Lotus 1-2-3 spreadsheet (v9) file
3gg; 3gp; 3g2 00 00 00 nn 66 74 79 70 33 67 70 3rd Generation Partnership Project 3GPP (nn=0x14) and 3GPP2 (nn=0x20) multimedia files
7z 37 7A BC AF 27 1C 7-ZIP compressed file
aba 00 01 42 41 Palm Address Book Archive file
abi 41 4F 4C 49 4E 44 45 58 AOL address book index file
aby; idx 41 4F 4C 44 42 AOL database files: address book (ABY) and user configuration data (MAIN.IDX)
accdb 00 01 00 00 53 74 61 6E 64 61 72 64 20 41 43 45 20 44 42 Microsoft Access 2007 file
ACM 4D 5A MS audio compression manager driver
ADF 44 4F 53 Amiga disk file
adx 03 00 00 00 41 50 50 52 Lotus Approach ADX file
AIFF 46 4F 52 4D 00 Audio Interchange File
ain 21 12 AIN Compressed Archive File
ami 5B 76 65 72 5D Lotus Ami Pro
amr 23 21 41 4D 52 Adaptive Multi-Rate ACELP (Algebraic Code Excited Linear Prediction) Codec, commonly audio format with GSM cell phones
ANI 52 49 46 46
API 4D 5A 90 00 03 00 00 00 Acrobat plug-in
arc 1A 0x LH archive file, old version(where x = 0x2, 0x3, 0x4, 0x8 or 0x9 for types 1-5, respectively)
arc 41 72 43 01 FreeArc compressed file
arj 60 EA ARJ Compressed Archive
ARJ 60 EA 27
ART 4A 47 03 0E 00 00 00 AOL ART file
ART 4A 47 04 0E 00 00 00 AOL ART file
asf 30 26 B2 75 8E 66 CF 11 Windows Media
asf; wma; wmv 30 26 B2 75 8E 66 CF 11 A6 D9 00 AA 00 62 CE 6C Microsoft Windows Media Audio/Video File(Advanced Streaming Format)
asx 3C Advanced Stream redirector file
au 2E 73 6E 64 SoundMachine Audio File NeXT/Sun Microsystems μ-Law audio file
avi 41 56 49 20 Audio Video Interleave (AVI)
AX 4D 5A Library cache file
AX 4D 5A 90 00 03 00 00 00 DirectShow filter
bag 41 4F 4C 20 46 65 65 64 62 61 67 AOL and AIM buddy list file
BAS 20 20 20
bin 42 4C 49 32 32 33 51 Thomson Speedtouch series WLAN router firmware
bmp 42 4D Windows Bitmap
BMP 42 4D 3E
bz; bz2 42 5A 68 BZIP Archive
BZ2; TAR.BZ2; TBZ2; TB2 42 5A 68 bzip2 compressed archive
CAB 49 53 63
CAB; HDR 49 53 63 28 Install Shield v5.x or 6.x compressed file
CAB 4D 53 43 46 Microsoft CAB File Format
cat 30 Microsoft security catalog file
CBD 43 42 46 49 4C 45 WordPerfect dictionary file (unconfirmed)
CCD 5B 43 6C
cdr CDR Corel Draw
CDR 45 4C 49 54 45 20 43 6F 6D 6D 61 6E 64 65 72 20 Elite Plus Commander saved game file
CDR, DVF 4D 53 5F 56 4F 49 43 45 Sony Compressed Voice File
CHI; CHM 49 54 53 46 Microsoft Compiled HTML Help File
CHM 49 54 53
CLB 43 4D 58 31 Corel Binary metafile
CLB 43 4F 4D 2B COM+ Catalog file
cnt 3A 42 61 73 65
COM, DLL, DRV, EXE, PIF, QTS, QTX, SYS 4D 5A Windows/DOS executable file
COM 4D 5A EE
COM E9 3B 03
CPE 46 41 58 43 4F 56 45 52 2D 56 45 52 Microsoft Fax Cover Sheet
CPL 4D 5A Control panel application
CPT 43 50 54 37 46 49 4C 45 Corel Photopaint file
CPT 43 50 54 46 49 4C 45 Corel Photopaint file
CPX 5B 57 69
cru; crush 43 52 55 53 48 CRUSH Archive File
CRU 43 52 55 53 48 20 76 Crush compressed archive
CRW 49 49 1A 00 00 00 48 45 41 50 43 43 44 52 02 00 Canon digital camera RAW file
CTF 43 61 74 61 6C 6F 67 20 33 2E 30 30 00 WhereIsIt Catalog file
CUR 00 00 02 00 01 00 20 20 Windows cursor file
dat 03 MapInfo Native Data Format
dat 1A 52 54 53 20 43 4F 4D 50 52 45 53 53 45 44 20 49 4D 41 47 45 20 56 31 2E 30 1A Runtime Software disk image
dat 41 56 47 36 5F 49 6E 74 65 67 72 69 74 79 5F 44 61 74 61 62 61 73 65 AVG6 Integrity database file
DAT 43 52 45 47 Windows 9x registry hive
DAT 43 6C 69 65 6E 74 20 55 72 6C 43 61 63 68 65 20 4D 4D 46 20 56 65 72 20 IE History DAT file
DAT 45 52 46 53 53 41 56 45 44 41 54 41 46 49 4C 45 Kroll EasyRecovery Saved Recovery State file
DAT 49 6E 6E 6F 20 53 65 74 75 70 20 55 6E 69 6E 73 74 61 6C 6C 20 4C 6F 67 20 28 62 29 Inno Setup Uninstall Log file
db 00 06 15 61 00 00 00 02 00 00 04 D2 00 00 10 00 Netscape Navigator (v4) database file
DB 44 42 46 48 Palm Zire photo database
db 08 dBASE IV or dBFast configuration file
db3 03 dBASE III file
db4 04 dBASE IV data file
dba 00 01 42 44 Palm DateBook Archive file
dbx CF AD 12 FE
dbx CF AD 12 FE C5 FD 74 6F Outlook Express
dci 3C 21 64 6F 63 74 79 70 AOL HTML mail file
dcx 3A DE 68 B1 DCX Graphic File
DDB 00 01 00
dib 42 4D device-independent bitmap image
DLL 4D 5A 90
DMP 4D 44 4D 50 93 A7 Windows minidump file
DMS 44 4D 53 21 Amiga DiskMasher compressed archive
doc 0D 44 4F 43 DeskMate Document file
doc 12 34 56 78 90 FF MS Word 6.0
doc 31 BE 00 00 00 AB 00 00 MS Word for DOS 6.0
doc 7F FE 34 0A MS Word
dot; ppt; xla; ppa; pps; pot; msi; sdw; db D0 CF 11 E0 MS Office/OLE2
doc; dot; xls; xlt; xla; ppt; apr ;ppa; pps; pot; msi; sdw; db D0 CF 11 E0 A1 B1 1A E1 MS Compound Document v1 or Lotus Approach APR file
DPL 4D 5A 50
DRV 4D 5A 16
drw 07 A common signature and file extension for many drawing programs.
drw 01 FF 02 04 03 02 Micrografx vector graphic file
ds4 4D 47 58 20 69 74 70 64 Micrografix Designer 4
DSN 4D 56 CD Stomper Pro label file
dsp 23 20 4D 69 63 72 6F 73 6F 66 74 20 44 65 76 6 56C 6F 70 65 72 20 53 74 75 64 69 6F Microsoft Developer Studio project file
dss 02 64 73 73 Digital Speech Standard (Olympus, Grundig, & Phillips)
dtd 07 64 74 32 64 64 74 64 DesignTools 2D Design file
dtd 3C 21 45 4E 54 49 54 59 XML DTD
DVR 44 56 44 DVR-Studio stream file
dwg 41 43 31
Enn (where nn are numbers) 45 56 46 EnCase evidence file
ECO 2A 50 52
elf 7F 45 4C 46 01 01 01 00 ELF Executable
emf 01 00 00 00 58 00 00 00 Extended (Enhanced) Windows Metafile Format, printer spool file
eml 44 65 6C 69 76 65 72 79 2D 64 61 74 65 3A Email
EML 46 72 6F 6D 20 20 20 A commmon file extension for e-mail files. Signatures shown here are for Netscape, Eudora, and a generic signature, respectively. EML is also used by Outlook Express and QuickMail.
EML 46 72 6F 6D 20 3F 3F 3F A commmon file extension for e-mail files. Signatures shown here are for Netscape, Eudora, and a generic signature, respectively. EML is also used by Outlook Express and QuickMail.
EML 46 72 6F 6D 3A 20 A commmon file extension for e-mail files. Signatures shown here are for Netscape, Eudora, and a generic signature, respectively. EML is also used by Outlook Express and QuickMail.
EML 52 65 63
enc 00 5C 41 B1 FF Mujahideen Secrets 2 encrypted file
enl [32 byte offset] 40 40 40 20 00 00 40 40 40 40 EndNote Library File
eps 25 21 50 53 Adobe EPS File
eps 25 21 50 53 2D 41 64 6F 62 65 Postscript
eps 25 21 50 53 2D 41 64 6F 62 65 2D 33 2E 30 20 45 50 53 46 2D 33 20 30 Adobe encapsulated PostScript file (If this signature is not at the immediate beginning of the file, it will occur early in the file, commonly at byte offset 30)
EPS C5 D0 D3
eth 1A 35 01 00 GN Nettest WinPharoah capture file
evt 30 00 00 00 4C 66 4C 65 Windows Event Viewer file
evt 03 00 00 00 C4 66 C4 56
EVTX 45 6C 66 46 69 6C 65 00 Windows Vista event log file
exe; dll; drv; vxd; sys; ocx; vbx 4D 5A Win32 Executable
exe; dll; drv; vxd; sys; ocx; vbx 4D 5A Win16 Executable
exe; com; 386; ax; acm; sys; dll; drv; flt; fon; ocx; scr; lrc; vxd; cpl; x32 4D 5A Executable File
EXE, DLL, OCX, OLB, IMM, IME 4D 5A 90
fli 00 11 AF FLIC Animation file
flt 00 01 01 OpenFlight 3D file
FLT 4D 5A 90 00 03 00 00 00 Audition graphic filter file (Adobe)
FLV 46 4C 56 01 Flash video file
fm 3C 4D 61 6B 65 72 46 69 6C 65 20 Adobe FrameMaker file
fm3 00 00 1A 00 07 80 01 00 Lotus 123 v3 FMT file
fmt 20 00 68 00 20 0 Lotus 123 v4 FMT file
FNT 43 48 41
FON 4D 5A Font file
GBC 87 F5 3E
gid 3F 5F 03 00 Windows Help Index File
GID 4C 4E 02 00 Windows Help index file
GIF 47 49 46 38
gif 47 49 46 38 37 61 Graphics interchange format file (GIF 87A)
gif 47 49 46 38 39 61 Graphics interchange format file (GIF89A)
GTD 7B 50 72
GX2 47 58 32 Show Partner graphics file (not confirmed)
gz; tar; tgz 1F 8B Gzip Archive File
gz; tgz 1F 8B 08 GZ Compressed File
hap 91 33 48 46 HAP Archive File
HDMP 4D 44 4D 50 93 A7 Windows heap dump file
hdr 23 3F 52 41 44 49 41 4E 43 45 0A adiance High Dynamic Range image file
HLP 3F 5F 03
hlp 3F 5F 03 00 Windows Help file
HLP 4C 4E 02 00 Windows Help file
hlp [7 byte offset] 00 00 FF FF FF FF Windows Help file
hqx 28 54 68 69 73 20 66 69 6C 65 Macintosh BinHex 4 Compressed Archive
hqx 28 54 68 69 73 20 66 69 6C 65 20 6D 75 73 74 20 62 65 20 63 6F 6E 76 65 72 74 65 64 20 77 69 74 68 20 42 69 6E 48 65 78 20 Macintosh BinHex 4 Compressed Archive
HTM 3C 21 44
htm; html 3C 21 44 4F 43 54 HyperText Markup Language 3
htm; html 3C 48 54 4D 4C 3E HyperText Markup Language 2
htm; html 3C 68 74 6D 6C 3E HyperText Markup Language 1
html 68 74 6D 6C 3E HTML
ico 00 00 01 00 00 Icon File
ico 00 00 01 00 01 00 20 20 Icon File
IFF 46 4F 52 4D
IFO 44 56 44 DVD info file
IME 4D 5A 90
img 00 01 00 08 00 01 00 01 01 Ventura Publisher/GEM VDI Image Format Bitmap file
IMG 00 FF FF
IMM 4D 5A 90
ind 41 4F 4C 49 44 58 AOL client preferences/settings file (MAIN.IND)
ISO 43 44 30 30 31 ISO-9660 CD Disc Image (This signature usually occurs at byte 8001, 8801, or 9001.)
ivr 2E 52 45 43 RealPlayer video file (V11 and later)
JAR 4A 41 52 43 53 00 JARCS compressed archive
jar 5F 27 A8 89 JAR Archive File
jpg; jpeg FF D8 FF
jpg; jpe; jpeg FF D8 FF E0 00 JPG Graphic File
jpg; jpe; jpeg FF D8 FF FE 00 JPG Graphic File
KGB 4B 47 42 5F 61 72 63 68 20 2D KGB archive
KOZ 49 44 33 03 00 00 00 Sprint Music Store audio file (for mobile devices)
LDB 42 49 4C
lha 2D 6C 68 35 2D LHA Compressed
lha; lzh [2 byte offset] 2D 6C 68 Compressed archive file
LHP 3F 5F 03
lhp 3F 5F 03 00 Windows Help File
lib 21 3C 61 72 63 68 3E 0A Unix archiver (ar) files and Microsoft Program Library Common Object File Format (COFF)
LIB 2A 24 20
LIT 49 54 4F 4C 49 54 4C 53 Microsoft Reader eBook file
LNK 4C 00 00
lnk 4C 00 00 00 Windows Shortcut (Link File)
lnk 4C 00 00 00 01 14 02 Windows Link File
LNK 4C 00 00 00 01 14 02 00 Windows shortcut file
log 2A 2A 2A 20 20 49 6E 73 74 61 6C 6C 61 74 69 6F 6E 20 53 74 61 72 74 65 64 20 Symantec Wise Installer log file
lzh lh Lz compression file
lwp 57 6F 72 64 50 72 6F Lotus WordPro v9
m3u 23 45 58
m4a 00 00 00 20 66 74 79 70 4D 34 41 20 00 00 00 00 Apple Lossless Audio Codec file
m4a; m4v 00 00 00 20 66 74 79 70 4D 34 41 20 00 00 00 00 QuickTime M4A/M4V file
manifest 3C 3F 78 6D 6C 20 76 65 72 73 69 6F 6E 3D Windows Visual Stylesheet XML file
MAR 4D 41 52 31 00 Mozilla archive
MAR 4D 41 52 43 Microsoft/MSN MARC archive
MAR 4D 41 72 30 00 MAr compressed archive
max D0 CF 11
mdb 00 01 00 00 53 74 61 6E 64 61 72 64 20 4A 65 74 20 44 42 Microsoft Access file
mdb; mda; mde; mdt 53 74 61 6E 64 61 72 64 20 4A MS Access
MDF 00 FF FF
mdf 00 FF FF FF FF FF FF FF FF FF FF 00 00 02 00 01 Alcohol 120% CD image
mdf 01 0F 00 00 Microsoft SQL Server 2000 database
MDI 45 50 Microsoft Document Imaging file
MDS 4D 45 44
MID; MIDI 4D 54 68 64 Musical Instrument Digital Interface (MIDI) sound file
mkv 1A 45 DF A3 93 42 82 88 6D 61 74 72 6F 73 6B 61 Matroska stream file
MLS 4D 49 4C 45 53 Milestones v1.0 project management and scheduling software (Also see “MV2C” and “MV214” signatures)
MLS 4D 4C 53 57 Skype localization data file
MLS 4D 56 32 31 34 Milestones v2.1b project management and scheduling software (Also see “MILES” and “MV2C” signatures)
MLS 4D 56 32 43 Milestones v2.1a project management and scheduling software (Also see “MILES” and “MV214” signatures)
MMF 4D 4D 4D 44 00 00 Yamaha Corp. Synthetic music Mobile Application Format (SMAF) for multimedia files that can be played on hand-held devices.
mny 00 01 00 00 4D 53 49 53 41 4D 20 44 61 74 61 62 61 73 65 Microsoft Money file
MOV 00 00 0F
MOV 00 00 77
mov 6D 6F 6F 76 Quicktime
mov 6D 64 61 74 QuickTime Movie
mp 0C ED Monochrome Picture TIFF bitmap file (unconfirmed)
MP3 49 44 33 MPEG-1 Audio Layer 3 (MP3) audio file
MP3 FF FB 50
mp4 00 00 00 18 66 74 79 70 33 67 70 35 MPEG-4 video files
MPA 00 00 01
mpg; mpeg 00 00 01 B3 MPEG Movie
mpg 00 00 01 BA MPEG
MSC 3C 3F 78
msc 3C 3F 78 6D 6C 20 76 65 72 73 69 6F 6E 3D 22 31 2E 30 22 3F 3E 0D 0A 3C 4D 4D 43 5F 43 6F 6E 73 6F 6C 65 46 69 6C 65 20 43 6F 6E 73 6F 6C 65 56 65 72 73 69 6F 6E 3D 22 Microsoft Management Console Snap-in Control file
msi 23 20 Cerius2 file
MSV 4D 53 5F 56 4F 49 43 45 Sony Memory Stick Compressed Voice file
NES 4E 45 53
NLS C2 20 20
nri 0E 4E 65 72 6F 49 53 4F Nero CD Compilation
ntf 1A 00 00 Lotus Notes database template
nsf; ntf 1A 00 00 03 00 00 Lotus Notes Database/Template
nsf 1A 00 00 03 00 00 11 00 Notes Database
nsf 1A 00 00 04 00 00 Lotus Notes database
ntf 30 31 4F 52 44 4E 41 4E 43 45 20 53 55 52 56 45 59 20 20 20 20 20 20 20 National Transfer Format Map File
obj 4C 01 Microsoft Common Object File Format (COFF) relocatable object code file for an Intel 386 or later/compatible processors
OCX 4D 5A ActiveX or OLE Custom Control
OCX 4D 5A 90
OLB 4D 5A OLE object library
OLB 4D 5A 90
org; pfc 41 4F 4C 56 4D 31 30 30 AOL personal file cabinet (PFC) file
pak 1A 0B Compressed archive file
PAT 47 46 31 50 41 54 43 48 Advanced Gravis Ultrasound patch file
PAT 47 50 41 54 GIMP (GNU Image Manipulation Program) pattern file
PBK 5B 41 44
PCB 17 A1 50
PCS 0A 05 01
pcx 0A nn 01 01 ZSOFT Paintbrush file(where nn = 0x02, 0x03, or 0x05)
pcx 0A 05 01 08 PC Paintbrush(often associated with Quake Engine games)
pdb [11 byte offset] 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 Palmpilot Database/Document File
PDF 25 50 44
pdf; fdf 25 50 44 46 Adobe Portable Document Format and Forms Document file
pdf 25 50 44 46 2D 31 2E Adobe Acrobat
PDG 48 48 02
pf 11 00 00 00 53 43 43 41 Windows prefetch file
pic 01 00 00 00 01 Unknown type picture file
PJT 00 00 07
PLL 24 53 6F
PNG 89 50 4E
PNG 89 50 4E 47
png 89 50 4E 47 0D 0A PNG Image File
png 89 50 4E 47 0D 0A 1A 0A PNG Image File
PPC 52 65 63
PPT D0 CF 11
ppt [512 byte offset] 00 6E 1E F0 PowerPoint presentation subheader (MS Office)
ppt [512 byte offset] 0F 00 E8 03 PowerPoint presentation subheader (MS Office)
PPZ 4D 53 43 46 Powerpoint Packaged Presentation
prc 42 4F 4F 4B 4D 4F 42 49 Palmpilot resource file
PRG 23 44 45
ps 25 21 50 53 2D 41 64 6F 62 65 Postscript
PSD 38 42 50
psd 38 42 50 53 Adobe Photoshop image file
psp 7E 42 4B 00 PaintShop Pro Image File
pst 21 42 44 4E Microsoft Outlook Personal Folder file
pwl E3 82 85 96 Windows Password
qbb 45 86 00 00 06 00 Intuit QuickBooks Backup file
qdf AC 9E BD 8F Quicken
qph 03 00 00 00 Quicken price history file
qt 6D 64 61 74 Quicktime Movie File
qxd 00 00 4D 4D 58 50 52
ra 2E 52 4D 46 00 00 00 12 00 Real Audio file
ra; ram 2E 72 61 FD Real Audio File
ra 2E 72 61 FD 00 RealAudio streaming media file
RAR 52 61 72
rar 52 61 72 21 RAR Archive File
RAW 06 05 00
reg 52 45 47 45 44 49 54 34
rgb 01 DA 01 01 00 03 Silicon Graphics RGB Bitmap
RM 2E 52 4D
rm; rmvb 2E 52 4D 46 Real Media streaming media file
rpm ED AB EE DB RPM Archive File
RTD 43 23 2B 44 A4 43 4D A5 48 64 72 RagTime document file
RTF 7B 5C 72
rtf 7B 5C 72 74 66 Rich Text Format File
sav 24 46 4C 32 40 28 23 29 20 53 50 53 53 20 44 41 54 41 20 46 49 4C 45 SPSS Data file
SBV 46 45 44 46 (Unknown file type)
SCH 2A 76 65
scm 80 53 43
SH3 48 48 47 42 31 Harvard Graphics presentation file
SHD 4B 49 00 00 Windows 9x printer spool file
sit 53 49 54 21 Stuffit v1 Archive File
sit 53 74 75 66 66 49 74 Stuffit v5 Archive File
sle 3A 56 45 52 53 49 4F 4E Surfplan kite project file
sle 41 43 76 teganos Security Suite virtual secure drive
sly; srt; slt 53 52 01 00 Sage sly.or.srt.or.slt
SMD 00 FF FF
snm 00 1E 84 90 00 00 00 00 Netscape Communicator (v4) mail folder
SNP 4D 53 43 46 Microsoft Access Snapshot Viewer file
sol 00 BF Adobe Flash shared object file (e.g., Flash cookies)
spl 00 00 01 00 Windows NT/2000/XP printer spool file
SCR 4D 5A Screen saver
SUB FF FF FF
SWF 43 57 53 Shockwave Flash file (v5+)
SWF 46 57 53 Macromedia Shockwave Flash player file
sxc calc OpenOffice Calc
sxd draw OpenOffice Draw
sxi impress OpenOffice Impress
sxm math OpenOffice Math
sxw writer OpenOffice Writer
syw 41 4D 59 4F Harvard Graphics symbol graphic
TAG 00 00 02
tar; cpio 30 37 30 37 30 37 CPIO Archive File
tar.z 1F 9D 90 Compressed tape archive file
tga 00 00 10 00 00 RLE压缩的前5字节
TGA 00 00 02
tga 00 00 02 00 00 未压缩的前5字节
TIF; TIFF 49 20 49 Tagged Image File Format file
tif; tiff 49 49 2A TIFF (Intel)
tif; tiff 49 49 2A 00 Tagged Image File Format file (little endian, i.e., LSB first in the byte; Intel)
TIF; TIFF 4D 4D 00 2A Tagged Image File Format file (big endian, i.e., LSB last in the byte; Motorola)
tif; tiff 4D 4D 2A TIFF (Motorola)
TIF; TIFF 4D 4D 00 2B BigTIFF files; Tagged Image File Format files >4 GB
TLB 4D 53 46 54 02 00 01 00 OLE, SPSS, or Visual C++ type library file
tr1 01 10 Novell LANalyzer capture file
TST 00 01 00
TTF 00 01 00
ufa 55 46 41 UFA Archive File
VBX 4D 5A VisualBASIC application
VCD 45 4E 54 52 59 56 43 44 02 00 00 01 02 00 18 58 VideoVCD (GNU VCDImager) file
vcf 42 45 47 49 4E 3A 56 43 41 52 44 0D 0A vCard file
vob 00 00 01 BA DVD Video Movie File (video/dvd, video/mpeg)
VXD, 386 4D 5A Windows virtual device drivers
WAV 52 49 46
wav 57 41 56 45 Wave
wav 57 41 56 45 66 6D 74 Wave Files
wb2 00 00 02 00 QuattroPro for Windows Spreadsheet file
wb3 [24 byte offset] 3E 00 03 00 FE FF 09 00 06 Quatro Pro for Windows 7.0 Notebook file
wk1; wks 20 00 60 40 60 Lotus 123 v1 Worksheet
wk1 00 00 02 00 06 04 06 00 08 00 00 00 00 00 Lotus 1-2-3 spreadsheet (v1) file
wk3 00 00 1A 00 00 10 04 00 Lotus 123 spreadsheet (v3) file
wk4; wk5 00 00 1A 00 02 10 04 00 Lotus 1-2-3 spreadsheet (v4, v5) file
wks 0E 57 4B 53 DeskMate Worksheet
WMA 30 26 B2
wmf 01 00 09 00 Graphics Metafile
wmf 01 00 09 00 00 03 Windows Metadata file (Win 3.x format)
wmf 02 00 09 00 Graphics Metafile
wmf D7 CD C6 9A Windows Meta File
WMV 30 26 B2
wp FF 57 50 43 WordPerfect v5 or v6
wpd FF 57 50 43 WordPerfect
wpg FF 57 50 47 WordPerfect Graphics
wri 31 BE Microsoft Write file
WRI 31 BE 00
wri 32 BE Microsoft Write file
ws 1D 7D WordStar Version 5.0/6.0 document
XBE 58 42 45
xdr 3C BizTalk XML-Data Reduced Schema file
xls 09 02 06 00 00 00 10 00 B9 04 5C 00 MS Excel v2
xls 09 04 06 00 00 00 10 00 F6 05 5C 00 MS Excel v4
XLS D0 CF 11
xls D0 CF 11 E0 MS Excel
xls [512 byte offset] 09 08 10 00 00 06 05 00 Excel spreadsheet subheader (MS Office)
XML 3C 3F 78
xml 3C 3F 78 6D 6C XML Document
xml FF FE 3C 00 52 00 4F 00 4F 00 54 00 53 00 54 00 55 00 42 00 XML Document (ROOTSTUB)
XMV 00 50 01
XSL FF FE 3C
xul 72 73 69 6F 6E 3D 22 31 3C 3F 78 6D 6C 20 76 65 2E 30 22 3F 3E XML User Interface Language file
z 1F 9D TAR Compressed Archive File
Z 1F 9D 8C
ZIP 50 4B 03
zip; jar; zipx 50 4B 03 04 ZIP Archive
zip 50 4B 30 30 ZIP Archive (outdated)
Zip 50 4B 30 30 50 4B 03 04 WINZIP Compressed
zoo 5A 4F 4F 20 ZOO Archive File

内存取证

volatility

独立volatility安装方法
1.下载volatility
https://www.volatilityfoundation.org/26
选择下载Linux系统的,下载下来之后解压
然后把解压出来的文件夹改名为volatility,使用指令移动到/usr/local
顺便把那个可执行文件的文件名也改成volatility

sudo mv volatility/ /usr/local/

2.然后添加环境变量,通过修改profile

sudo vim /etc/profile
然后在最后,换行添加一句
export PATH=/usr/local/volatility:$PATH
重启即可

之后直接输入volatility,即可发现已经成功安装

  • imageinfo 分析获取内存镜像的基本信息

volatility -f raw.raw imageinfo

volatility 建议当做 Win7SP1x64 的镜像,后面的参数使用–profile(两根横杠)

  • pslist 知道镜像信息后,一般就会pslist
    pslist:查看镜像中正在运行的进程

volatility -f raw.raw –profile=Win7SP1x64 pslist 当然,也可以用psxview,psxview可查看一些隐藏进程

  • pstree 以树的形式来列出正在进行的进程,当然pstree也不会显示出隐藏或未链接的进程

volatility -f raw.raw –profile=Win7SP1x64 pslist

还有psscan指令,它是以pool tag来扫描,很少用;还有psdispscan、dlllist、dlldump、handles、getsids,这里不做描述

  • cmdscan cmdscan是搜索XP / 2003 / Vista / 2008和conhost.exe上搜索csrss.exe的内存,对于win7是搜索cmd.exe。是搜索命令行的输入历史记录

volatility -f raw.raw –profile=Win7SP1x64 cmdscan

  • consoles 相似与cmdscan,但是他扫描的不是COMMAND_HISTORY,而是CONSOLE_INFORMATION,而且还有个显著的优点是cmdscan只能查看到输入的指令,而consoles能查看到输入的指令以及缓冲区的输出(即键入和键出)

volatility -f raw.raw –profile=Win7SP1x64 consoles

  • cmdline 此指令将会列出所有命令行下运行的程序

volatility -f raw.raw –profile=Win7SP1x64 cmdline

除此之外,简单讲一些不常见的指令

privs:显示进程权限
envars:显示进程环境变量
verinfo:显示PE文件中嵌入的版本信息
enumfunc:列出进程,dll和内核驱动程序导入和导出

  • filescan 扫描文件指令,一般呢会根据正在进行的进程来定向扫描,也常常会扫描桌面文件。

volatility -f raw.raw –profile=Win7SP1x64 filescan
volatility -f raw.raw –profile=Win7SP1x64 filescan | grep “flag”
volatility -f raw.raw –profile=Win7SP1x64 filescan | grep “Desktop”(有的可能是中文把Desktop改成桌面即可)
volatility -f raw.raw –profile=Win7SP1x64 filescan | grep -E “png”(查找png后缀文件)

  • dumpfiles dump出指定PID的文件,一般只要是做内存题都会用到的指令。

volatility -f raw.raw –profile=Win7SP1x64 dumpfiles -Q [PID] -D ./
将PID的文件保存在当前目录

  • procdump 转储进程的可执行文件,后跟PID

volatility -f mal.raw –profile=Win7SP1x64 procdump -p 3468 -D ./

  • memdump 可以将内存中的某个进程保存出来

volatility -f win7.vmem –profile=Win7SP1x64 memdump -p [PID] -D ./

  • editbox/notepad
    显示出有关编辑控件的信息
    在XP中,正在运行的notepad程序,使用notepad指令就可以看到notepad.exe的内容,而在win7中,将不支持notepad,只能使用editbox,这里举例editbox

volatility -f raw.raw –profile=Win7SP1x64 editbox

  • netscan 查看网络连接的连接情况

volatility -f raw.raw –profile=Win7SP1x64 netscan

  • svcscan 扫描windows服务列表

volatility -f raw.raw –profile=Win7SP1x64 svcscan

  • screenshot 显示GDI样式的截屏

volatility -f raw.raw –profile=Win7SP1x64 screenshot -D ./

  • userassist 查看运行的进程和次数

volatility -f raw.raw –profile=Win7SP1x64 userassist

  • clipboard 剪贴板数据,加参数-v可以导出

volatility -f raw.raw –profile=Win7SP1x64 clipboard
volatility -f raw.raw –profile=Win7SP1x64 clipboard -v >clip.txt

  • hivelist 列出注册表

volatility -f raw.raw –profile=Win7SP1x64 hivelist
dumpregistry -o virtual地址可以导出,如volatility -f raw.raw –profile=Win7SP1x64 dumpregistry -o 0xfffff8a003696010

  • malfind malfind 查找隐藏或注入的代码/ DLL

volatility -f raw.raw –profile=Win7SP1x64 malfind

可以查找出存在异常的进程

  • handles
    查看文件句柄,如上面malfind发现PID为2233

volatility -f raw.raw –profile=Win7SP1x64 handles -p 620 -t file

  • iehistory 获取浏览器的浏览历史,这个指令也经常用到。

volatility -f raw.raw –profile=Win7SP1x64 iehistory

  • dlldump 将指定PID的进程的所有DLL导出

volatility -f raw.raw –profile=Win7SP1x64 dlldump -p [PID] -D ./

使用插件找到密码
不像printkey一样,用hash来获取密码,这里可以直接使用mimikatz.py插件来获取内存中的密码,无论多复杂都彳亍。当然也可以用最新版的passware kit来获取密码,原理同样是从内存中直接获取密码。
插件地址
https://github.com/ruokeqx/tool-for-CTF/tree/master/volatility_plugins
若不会装插件,可看这篇文章
命令也很简单,直接在后面加个mimikatz即可,如:

volatility -f raw.raw –profile=Win7SP1x64 mimikatz

  • printkey 常常是用来列举用户及密码、查看获取最后登陆系统的用户。

获取用户:volatility -f raw.raw –profile=Win7SP1x64 printkey -K “SAM\Domains\Account\Users\Names”

获取最后登陆系统的用户:volatility -f raw.raw –profile=Win7SP1x64 printkey -K “SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon”

获取密码哈希:
1.获取system 的 virtual 地址,SAM 的 virtual 地址:
volatility -f raw.raw –profile=Win7SP1x64 hivelist

2.hashdump:
volatility -f raw.raw –profile=Win7SP1x64 hashdump -y 0xfffff8a000024010 -s 0xfffff8a001390010

3.碰运气解hash(一般题都是能用cmd5、somd5解出来的)

配合Gimp
dump出正在运行的内存,然后配合Gimp

1.dump出正在运行的程序,随便dump都行
volatility -f raw.raw –profile=Win7SP1x64 memdump -p [PID] -D ./
2.将dump出来的文件(如1234.dmp)重命名为.data拓展名(即1234.data)
3.使用Gimp打开(ubuntu)

4.这里请放大,进行如下操作
(1).将图像类型RGB修改为RGB Alpha
(2).调整高度(建议调稍微高一点)、确定一个看着合适的宽度、调整位移,可以使用鼠标滑轮和键盘来快速调整,也可以拖动调整
例如这里我就找到文字信息(请注意,在宽度和偏移下,可能会出现不同的界面)
经过调整,当宽度为264的时候,就会出现我想要的信息

当然,这里是倒过来的,脑补一下就行了。

DiskGenius

这个软件可以打开xxx.vhd文件,可以恢复文件

取证大师

这个应该是最好用的,不过俺没找到破解版

流量题

推荐先看一下这个人的视频,有个基本的了解

1、直接输入协议名来过滤想要的报文

过滤IP

如源ip或者目标ip

ip.src eq x.x.x.x or ip.dst eq x.x.x.x

(src是sorce的缩写,eq可以用=代替,dst是destination的缩写)

ip.addr eq x.x.x.x 直接过滤ip地址

过滤端口

tcp.port eq 80 or udp.port eq 80

tcp.dstport == 80 只显示tcp协议的目标端口为80

tcp.srcport == 80 只显示tcp协议的源端口为80

tcp.port >= 1 and tcp.port <= 80

筛选出1到80的端口

过滤协议

直接输入协议就行了

过滤mac地址

eth.dst == xx:xx:xx:xx:xx:xx

过滤包长度

udp.length == 26

这个长度是指udp本身长度8加上udp下面那块数据包之和

tcp.len >= 7 指的是ip数据包(tcp下面那块数据),不包括tcp本身

ip.len == 94

除了以太网头固定长度14,其它都算是ip.len,即从ip本身到最后

frame.len == 119 整个数据包长度,从eth开始到最后

http模式过滤

http.request.method == “GET”

http.requset.method == “POST”

https.request.uri == “/img/logo-edu.gif”

http contains “GET”

http contains “HTTP/1”

http contains “flag”

http contains “key”

tcp contains “flag”

wireshark协议分析

统计>协议分级

usb流量分析

键盘流量

tshark -r xxx.pcap -T fields -e usb.capdata > usbdata.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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
normalKeys = {"04": "a", "05": "b", "06": "c", "07": "d", "08": "e", "09": "f", "0a": "g", "0b": "h", "0c": "i",
"0d": "j", "0e": "k", "0f": "l", "10": "m", "11": "n", "12": "o", "13": "p", "14": "q", "15": "r",
"16": "s", "17": "t", "18": "u", "19": "v", "1a": "w", "1b": "x", "1c": "y", "1d": "z", "1e": "1",
"1f": "2", "20": "3", "21": "4", "22": "5", "23": "6", "24": "7", "25": "8", "26": "9", "27": "0",
"28": "<RET>", "29": "<ESC>", "2a": "<DEL>", "2b": "\t", "2c": "<SPACE>", "2d": "-", "2e": "=", "2f": "[",
"30": "]", "31": "\\", "32": "<NON>", "33": ";", "34": "'", "35": "<GA>", "36": ",", "37": ".", "38": "/",
"39": "<CAP>", "3a": "<F1>", "3b": "<F2>", "3c": "<F3>", "3d": "<F4>", "3e": "<F5>", "3f": "<F6>",
"40": "<F7>", "41": "<F8>", "42": "<F9>", "43": "<F10>", "44": "<F11>", "45": "<F12>"}

shiftKeys = {"04": "A", "05": "B", "06": "C", "07": "D", "08": "E", "09": "F", "0a": "G", "0b": "H", "0c": "I",
"0d": "J", "0e": "K", "0f": "L", "10": "M", "11": "N", "12": "O", "13": "P", "14": "Q", "15": "R",
"16": "S", "17": "T", "18": "U", "19": "V", "1a": "W", "1b": "X", "1c": "Y", "1d": "Z", "1e": "!",
"1f": "@", "20": "#", "21": "$", "22": "%", "23": "^", "24": "&", "25": "*", "26": "(", "27": ")",
"28": "<RET>", "29": "<ESC>", "2a": "<DEL>", "2b": "\t", "2c": "<SPACE>", "2d": "_", "2e": "+", "2f": "{",
"30": "}", "31": "|", "32": "<NON>", "33": "\"", "34": ":", "35": "<GA>", "36": "<", "37": ">", "38": "?",
"39": "<CAP>", "3a": "<F1>", "3b": "<F2>", "3c": "<F3>", "3d": "<F4>", "3e": "<F5>", "3f": "<F6>",
"40": "<F7>", "41": "<F8>", "42": "<F9>", "43": "<F10>", "44": "<F11>", "45": "<F12>"}
output = []
keys = open('usbdata.txt')
for line in keys:
try:
if line[0]!='0' or (line[1]!='0' and line[1]!='2') or line[3]!='0' or line[4]!='0' or line[9]!='0' or line[10]!='0' or line[12]!='0' or line[13]!='0' or line[15]!='0' or line[16]!='0' or line[18]!='0' or line[19]!='0' or line[21]!='0' or line[22]!='0' or line[6:8]=="00":
continue
if line[6:8] in normalKeys.keys():
output += [[normalKeys[line[6:8]]],[shiftKeys[line[6:8]]]][line[1]=='2']
else:
output += ['[unknown]']
except:
pass
keys.close()

flag=0
print("".join(output))
for i in range(len(output)):
try:
a=output.index('<DEL>')
del output[a]
del output[a-1]
except:
pass
for i in range(len(output)):
try:
if output[i]=="<CAP>":
flag+=1
output.pop(i)
if flag==2:
flag=0
if flag!=0:
output[i]=output[i].upper()
except:
pass
print ('output :' + "".join(output))

鼠标流量

tshark -r 1.pcap -T fields -e usb.capdata > usbdata.txt

鼠标流量每行是四个数据

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
nums = []
keys = open('usbdata.txt','r')
file = open('xy.txt','w')
posx = 0
posy = 0
for line in keys:
if len(line) != 12 :
continue
x = int(line[3:5],16)
y = int(line[6:8],16)
if x > 127 :
x -= 256
if y > 127 :
y -= 256
posx += x
posy += y
btn_flag = int(line[0:2],16) # 1 for left , 2 for right , 0 for nothing
if btn_flag == 1 :
string = str(posx) + ' '+str(posy) +'\n'
file.write(string)
keys.close()
file.close()

然后得到一个txt里面都是坐标,然后用gunplot生成图片就行