zl程序教程

您现在的位置是:首页 >  其他

当前栏目

【愚公系列】2021年11月 攻防世界-进阶题-MISC-057(奇怪的TTL字段)

2023-04-18 14:26:11 时间

文章目录


一、奇怪的TTL字段

题目链接:https://adworld.xctf.org.cn/task/task_list?type=misc&number=1&grade=1&page=4

二、答题步骤

1.二进制

发现ttl.txt中的ttl只有4个值63,127,191,255,写出他们的二进制表示后发现只有最高两位不同 于是考虑做如下转换,发现写出来的16进制数开头是ffd8,应该是jpg,于是写入文件中:

```csharp
fp = open('ttl.txt','r')
a = fp.readlines()
p = []
for i in a:
    p.append(int(i[4:]))
s = ''
for i in p:
    if i == 63:
        a = '00'
    elif i == 127:
        a = '01'
    elif i == 191:
        a = '10'
    elif i == 255:
        a = '11'
    s += a
# print(s)

import binascii
flag = ''
for i in range(0,len(s),8):
    flag += chr(int(s[i:i+8],2))
flag = binascii.unhexlify(flag)
wp = open('res.jpg','wb')
wp.write(flag)
wp.close()
#00111111 63
#01111111 127
#10111111 191
#11111111 255

2.foremost

用foremost直接分开就好了,之后用ps拼在一块,扫描之后得到如下信息:

key:AutomaticKey cipher:fftu{2028mb39927wn1f96o6e12z03j58002p}

在线解密网址:https://www.wishingstarmoye.com/ctf/autokey

得到flag :flag{2028ab39927df1d96e6a12b03e58002e}


总结

  • 二进制
  • ps
  • foremost