文件隐写

文件隐写(Steganography)

文件头:List of file signatures

图片类

通用

  1. 图种(binwalk、foremost、某压缩软件)

  2. LSB

  3. stegseek

    https://github.com/RickdeJager/stegseek

    stegseek [stegofile.jpg] [wordlist.txt]

  4. openstego

    https://www.openstego.com/

  5. 盲水印(双图)

  6. Java盲水印

    https://github.com/ww23/BlindWatermark

    命令:java -jar BlindWatermark.jar decode -c img-ec.jpg img-dc.jpg

  7. 隐形水印(吾爱破解WaterMark隐形水印工具)

  8. NTFS(某压缩软件、NtfsStreamsEditor)

  9. Our Secret(文档加密)

    Steganography

    https://www.hyluz.cn/zb_users/upload/2021/02/202102201613815645350310.zip

    文件尾标志:l<9l0kl10n88j:8<

    参考:https://www.hyluz.cn/?id=208

  10. PixelJihad(JS加密)

    https://github.com/oakes/PixelJihad

    http://tools.jb51.net/aideddesign/img_add_info

  11. Steganography.js(JS加密)

    https://www.peter-eigenschink.at/projects/steganographyjs/showcase/

  12. DeEgger Embedder

  13. bftools

    命令:

    bftools decode braincopter 1.png > 1.txt

    bftools run 1.txt

png

文件头:89 50 4E 47 0D 0A 1A 0A 00 00 00 0D 49 48 44 52

文件尾:00 00 00 00 49 45 4E 44 AE 42 60 82

  1. zsteg

    https://github.com/zed-0xff/zsteg

    命令:

    zsteg -a xxx.png

    zsteg -E "[Pattern]" xxx.png > out.xxx

  2. LSB(带密码,弱口令123456)

    https://github.com/livz/cloacked-pixel

    https://github.com/fjh1997/cloacked-pixel

  3. stegpy

    安装:pip install stegpy

    命令:stegpy xx.webp (-p)

jpg / jpeg

文件头:FF D8 FF

文件尾:FF D9

  1. steghide

    http://steghide.sourceforge.net/

    命令:steghide extract -sf 1.jpg (需密码 或 空密码)

    密码爆破:

    stegseek

    https://github.com/RickdeJager/stegseek

    stegseek [stegofile.jpg] [wordlist.txt]

  2. StegCracker(爆破)

    https://github.com/Paradoxis/StegCracker

    命令:stegcracker <file> [<wordlist>]

  3. jsteg

    https://github.com/lukechampine/jsteg

  4. F5

    https://github.com/matthewgao/F5-steganography

    命令:java Extract 123456.jpg -p 123456

  5. outguess

    https://github.com/crorvick/outguess

    命令:outguess -r file.jpg -k password -t out.txt

  6. JPHS

    https://www.scanwith.com/JPHS_for_Windows_download.htm

bmp

  1. zsteg

    https://github.com/zed-0xff/zsteg

    命令:

    zsteg -a xxx.bmp

    zsteg -E "[Pattern]" xxx.bmp > out.xxx

  2. wbStego

    wbstego43open:http://wbstego.wbailer.com/

  3. stegpy

    安装:pip install stegpy

    命令:stegpy xx.webp (-p)

gif

文件头:47 49 46 38GIF87aGIF89a

  1. 分帧(NamoGIF)

  2. 时间轴(每一帧间的时间间隔)

    identify -format "%s %T \n" 100.gif

  3. stegpy

    安装:pip install stegpy

    命令:stegpy xx.webp (-p)

  4. 相同图像比对

webp

  1. stegpy

    安装:pip install stegpy

    命令:stegpy xx.webp (-p)

其他在线工具

StegOnline

在线图片添加/解密隐藏信息(隐写术)工具

Magic Eye Solver / Viewer

Aperi’Solve

npiet


音频类

通用

  1. Audacity(波形、频谱)
  2. DeEgger Embedder

mp3

  1. mp3stego

    https://www.petitcolas.net/steganography/mp3stego/

    命令:decode -X -P pass svega_stego.mp3

  2. MP3 Steno

  3. 帧头private_bit

    参考:

    某工控 CTF 线上赛隐信道数据安全分析题解

    De1CTF mc_easybgm

wav

文件头:52 49 46 46 EE AD 25 03 57 41 56 45 66 6D 74 20

  1. steghide

    http://steghide.sourceforge.net/

    命令:steghide extract -sf 1.wav (需密码 或 空密码)

    密码爆破:

    stegseek

    https://github.com/RickdeJager/stegseek

    stegseek [stegofile.wav] [wordlist.txt]

  2. LSB

    Silenteye:

    https://silenteye.v1kings.io/

    脚本:

    https://github.com/sniperline047/Audio-Steganography

  3. SSTV

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

    工具:

  4. DeepSound

  5. stegpy

    安装:pip install stegpy

    命令:stegpy xx.webp (-p)

mid

  1. Velato

    http://velato.net/

其他在线工具

摩斯密码识别:Morse Code Adaptive Audio Decoder

拨号音识别:Detect DTMF Tones

音频反转:Reverse Audio Online


视频类

通用

  1. MSU StegoVideo / VirtualDub+插件

    https://zhaokaifeng.com/?p=1305


压缩包类

zip

文件头:50 4B 03 04PK

  1. 伪加密(某压缩软件)

  2. 密码爆破(ARCHPR)

  3. 明文攻击工具

    bkcrack / rbkcrack

    攻击:

    1
    2
    3
    4
    5
    6
    7
    8
    bkcrack -C xxx.zip -c xxx.png -p yyy.png

    -C 要攻击的压缩包
    -c 要攻击的压缩包里面的文件
    -p 刚创建的明文文件名

    *部分位置已知明文:
    bkcrack -C flag.zip -c flag.txt -p plain.txt -x 16 2d -x 21 2d -x 26 2d -x 31 2d -x 44 7d

    得到三个key解码:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    #获取密码
    bkcrack -k [key1 key2 key3] -r [密码最大位数] ?[a-所有/p-可打印字符/d-数字/-l小写字母/-u大写字母]
    bkcrack -k be056038 0a143c0c 1ea08ca5 -r 16 ?a

    #还原
    bkcrack -C xxx.zip -c xxx.png -k be056038 0a143c0c 1ea08ca5 -d xxx.png

    -C 要攻击的压缩包
    -c 要攻击的压缩包里面的文件
    -k 刚生成的三个key
    -d 最终还原的文件名

rar

文件头:52 61 72 21Rar!

参考:https://blog.csdn.net/Claming_D/article/details/105899397

  1. 伪加密

    查看第24个16进制数后面的数是0还是4,是4表示进行了伪加密,将4改为0就可以解除伪加密(修改对应RarBlock的CRC值)。

  2. 爆破工具

    hashcat

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    获得hash值
    rar2john xxx.rar > rar.hash

    爆破
    hashcat -m 12500 -a 3 $RAR3$*0*a4243df9ba2d6023*b84a539412288864a2d6a9bfdcf2dd97 ?d?d?d?d?d?d -o out.txt
    hashcat -m 13000 -a 3 $RAR5$*0*a4243df9ba2d6023*b84a539412288864a2d6a9bfdcf2dd97 ?d?d?d?d?d?d -o out.txt

    -m 根据rar类型进行选择,hashcat官方提供的参数有两种,RAR3-hp类型为12500,RAR5类型为13000
    -a 3 为掩码方式破解,掩码格式如下
    ?d?d?d?d?d?d 表示为6位数字
    内置的掩码规则有:
    ?l :表示小写字母
    ?u :表示大写字母
    ?d :表示数字
    ?s :表示特殊字符
    ?a :表示上面四种的并集
    -o out.txt是输出结果

文本类

txt

  1. 零宽

  2. whitespace

    https://vii5ard.github.io/whitespace/

  3. snow隐写

    http://fog.misty.com/perry/ccs/snow/snow/snow.html

    snow -C -p password filename

word

  1. 解压

  2. word选项-显示-隐藏文字-勾选

  3. 解密

    提取hash值:python3 office2john.py 1.docx > hash.txt

    hashcat破解:hashcat -m 9400 --username hash.txt -a 3 ?d?d?d?d?d?d?d?d -o cracked_pass.txt

excel

  1. 解压

pdf

  1. wbStego4open

    http://wbstego.wbailer.com/

  2. 密码爆破

    • pdfcrack

pyc / pyo

  1. stegosaurus(字节码)

    https://github.com/AngelKitty/stegosaurus

    命令(尽量用Python3.6运行):

    python3 stegosaurus.py -x main.pyc

    python3 -m stegosaurus main.pyc -x


常用脚本

图片处理

CRC宽高爆破(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
import binascii
import struct
import sys

fr = open('flag.png','rb').read()
data = bytearray(fr[0x0c:0x1d])
crc32key = eval('0x'+str(binascii.b2a_hex(fr[0x1d:0x21]))[2:-1])

n = 4095
for w in range(n):
width = bytearray(struct.pack('>i', w))
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]
crc32result = binascii.crc32(data) & 0xffffffff
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('flag2.png','wb')
fw.write(newpic)
fw.close
sys.exit()

快速傅里叶变换(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()

音频处理

1
2
import scipy.io.wavfile as wav
sample_rate, data = wav.read("1.wav")

压缩包处理

解压缩

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

# 要解压的带密码的 zip 文件
zip_filename = 'DontCome0ver.zip'

# 解压目标文件夹
output_dir = './zip'

# 设置密码
password = '123456'

# 解压文件
with pyzipper.AESZipFile(zip_filename, 'r') as zf:
zf.pwd = password.encode('utf-8')
zf.extractall(output_dir)

遍历zip压缩包

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import os.path
import zipfile
import re
dir_path='xxxxxxxx'
files= os.listdir(dir_path)
newfiles = files[::-1]
print(newfiles)
setee = []
for file in newfiles: #遍历文件夹
position = dir_path+'\\'+ file #构造绝对路径,"\\",其中一个'\'为转义符
print (position)
z = zipfile.ZipFile(position, 'r')
for filename in z.namelist():
bytes = z.read(filename)
if b'Zmxh' in bytes:
print(filename)

zlib解压字符串

1
2
3
4
5
6
import zlib
data = open("zlib_hex_data.txt", 'r', encoding="utf-8").read().replace(" ", "").replace("\n", "").strip()
data_dec = zlib.decompress(bytes.fromhex(data))
print(data_dec[:100])
with open("zlib_data.rar", 'wb') as wf:
wf.write(data_dec)

其他在线工具

解码

社会主义核心价值观:http://www.atoolbox.net/Tool.php?Id=850

佛曰:https://ctf.bugku.com/tool/todousharp

新佛曰:http://hi.pcmoe.net/buddha.html

emoji-AES:https://aghorler.github.io/emoji-aes/

其他

wordle 填字:https://www.wsolver.com/

sokudo 数独:https://shudu.gwalker.cn/

virustotal 文件检测:https://www.virustotal.com/gui/home/upload

Tupper自指公式:https://tuppers-formula.ovh/

base-decode 任意base解码:https://basecrack.herokuapp.com/

brainfuck分析:http://pablojorge.github.io/brainfuck/

金笛短信PDU编码解码工具:http://www.sendsms.cn/pdu/

汉信码识别器:https://tuzim.net/hxdecode/