【攻防世界】简单的图片

⭕、知识点
图片lsb隐写(BGR通道)/陌生文本分析/五进制转十进制

一、题目
给了一张图片

二、解题
1、zsteg扫描一下发现有一些规律的文本

2、用stegosolve进行提取,LSB BGR通道,保存文本并提取出来

3、把这段字符串列表用脚本分析一下(本人的尝试)

总共31个字符串,转为Set仅有21个,从字母出现的频次来看并没有什么特别

观察特征发现所有字符串的开头都是“xx”

如果隐藏信息,是否就是后面不同的三字节?

于是脚本后面就对后三字节的数据进行提取,并且观察了后三字节的二进制数据,想起来前面做过一题就是在字节数据的某几位提取出数据再进行拼接,用同样的思路编写脚本但是没有收获

import textwrap
a=['xxfxc','xxfst','xxtfc','xxfxt','xxfft','xxttc','xxffs','xxsft','xxftc','xxtfx','xxtfc','xxfcf','xxfxs','xxtfx','xxctx','xxfcx','xxtfx','xxsff','xxfsf','xxtfc','xxfxt','xxcxs','xxtfx','xxfsf','xxtfc','xxftx','xxfts','xxfxs','xxfcf','xxsfc','xsxxx']
print(len(a))

print(set(a))

print(len(set(a)))

from collections import Counter

a = ['xxfxc','xxfst','xxtfc','xxfxt','xxfft','xxttc','xxffs','xxsft','xxftc','xxtfx',
     'xxtfc','xxfcf','xxfxs','xxtfx','xxctx','xxfcx','xxtfx','xxsff','xxfsf','xxtfc',
     'xxfxt','xxcxs','xxtfx','xxfsf','xxtfc','xxftx','xxfts','xxfxs','xxfcf','xxsfc','xsxxx']

# 合并所有字符串成一个长字符串
all_chars = ''.join(a)

# 使用Counter统计每个字母出现次数
counter = Counter(all_chars)

# 打印结果
for letter, freq in sorted(counter.items()):
    print(f"{letter}: {freq}")

b = ["x","s","c","t","f"]

for i in b:
    print(bin(ord(i)))

c = []

for i in a:
    c.append(i[2:])

print(c)

result = ""

for i in c:
    for j in range(len(i)):
        result += bin(ord(i[j]))[5:]

print(result)
print(len(result))

re = ""

l = textwrap.wrap(result, width=8)

print(l)
for i in l:
    re += chr(int(i,2))
print(re)

4、看了wp才知道是把xsctf映射为0~4,得到五进制数,再转为10进制,再转为ascii码。。。

看来思路没想对,但积累了经验

a=['xxfxc','xxfst','xxtfc','xxfxt','xxfft','xxttc','xxffs','xxsft','xxftc','xxtfx','xxtfc','xxfcf','xxfxs','xxtfx','xxctx','xxfcx','xxtfx','xxsff','xxfsf','xxtfc','xxfxt','xxcxs','xxtfx','xxfsf','xxtfc','xxftx','xxfts','xxfxs','xxfcf','xxsfc','xsxxx']

mapping ={
    "x" : "0",
    "s" : "1",
    "c" : "2",
    "t" : "3",
    "f" : "4",
}

word_list = []

for i in a:
    word = ""
    for e in i:
        word +=mapping.get(e)
    word_list.append(word)

print(word_list)

result = ""

for i in word_list:
    result += chr(int(i,5))
print(result)

三、答案
flag{\y0u_are_An_1mag3_master/}

四、总结

1、如果一段未知分块文本,出现的总字符都是固定几个,考虑将其映射为数字并进行进制转换,又是一种新的思路

2、字频分析函数

from collections import Counter
counter = Counter(all_chars) # 传入字符串

3、创建字符映射:mapping

mapping.get(ch)
posted @ 2025-04-13 16:25  wyuu101  阅读(124)  评论(0)    收藏  举报