一道图片隐写题

1 题目

题目来源[1]
学到的知识点:

  • stegslove 工具的使用
  • Pillow 库的使用
  • collections 库的使用
  • codemoji
  • Encrypto

2 分析

查看给的图片的基本信息,分辨率 560*560,宽高各 20 个色块(每个色块 28*28)。根据给的提示,“G is the best",
image

于是想到了查看每个色块的 G 色道的值,这里用到了 Python 的 Pillow 库。

二重循环遍历整个图片的所有色块,取中间位置的 G 色道的值:

lower = 14

upper = 560

step = int(560 / 20)

for x in range(lower, upper + 1, step):

    for y in range(lower, upper + 1, step):

        List.append(picture[x, y][1])

将 G 色道的值转成 ASCII 码

tmp = []
for item in List:
    tmp.append(chr(item).encode('utf-8').decode('gbk'))

print(tmp)

结果如下:
image

发现很多重复的字符,于是作者想到了统计字符频率,这个值得学习:

res = []
for x in List:
    res.append(chr(x))

counterres=Counter(res).most_common()

print(counterres)

for item in counterres:
    print(item[0],end='')

按照字符频率排序之后,出现次数最多的前几个字符明显就是 key,
image

用得到的 key 解密 flag.crypto 文件,用到了 Encrypto 这个软件。
image

解密得到一个 txt 文件,里面是一些 unicode 码。
image
将 unicode 码打印之后,发现是一串 emoji,
💙📟😽😂🍳✉💞📟💞🍸🌀📑🐮🏉😔🐶🌀🍨👈🌴🚅🌼🍸💙💾📥🍑🍑💇
逐一尝试 emoji 解密,最终发现是 Mozilla 的 codemoji 加密,解密之后最终得到 flag。


  1. https://mp.weixin.qq.com/s/88wPbWwnJum7z9S4BS9GVg ↩︎

posted @ 2021-08-12 23:04  Ainsliaea  阅读(207)  评论(0编辑  收藏  举报