攻防世界_misc_steg没有py

环境

steg没有py,stegpy隐写,仿射密码

flag{4f71ne_C1ph3r_15_FFFFunny!!}

wp

下载stegpy隐写源码,修改lsb.py里面decode_message函数,然后再进行安装python setup.py install

def decode_message(host_data):
  ''' Decodes the image numpy array into a byte array. '''
  host_data = host_data.reshape(-1)
  bits = 2 ** ((host_data[0] & 48) >> 4)
  divisor = int(8 // bits)
  total_elements = int(host_data.size) 
  if total_elements % divisor != 0:
    new_size = total_elements + (divisor - total_elements % divisor)
    host_data = np.resize(host_data, new_size)
  msg = np.zeros(len(host_data) // divisor, dtype=np.uint8)
  for i in range(divisor):
    msg |= (host_data[i::divisor].astype(np.uint32) & (2 ** bits - 1)) << (bits * i)
  return msg

然后运行stegpy Do_you_like_misc.png -p密码为文件名Do_you_like_misc,得到密文

eyjd{4e71wf_H1uc3s_15_EEEEpwwl!!}

a,b∈(1,25]
a=x**2;
b=(x-2)**2;
print(a,b)

仿射密码解密遍历a和b即可,最后a=25,b=9,最后注意大小写

posted @ 2025-01-23 17:29  ra1nbowsea  阅读(55)  评论(0)    收藏  举报