红联Linux门户
Linux帮助

为steghide实现字典破解功能

发布时间:2016-06-02 09:50:48来源:linux网站作者:>pcat<

steghide是一个隐写术软件,可以在图片、音频等文件里隐藏数据。

鉴于原始的steghide在解密数据时不能选择字典文件破解,于是本人就用python简单地为其实现字典破解功能。


1、安装steghide

由于steghide太老了,不建议源码安装,我尝试在Kali、Ubuntu上安装各种失败,github上那个实现-pf字典文件破解的项目安装源码也是失败。(当然如果你有好法子,烦请不吝赐教。)


linux安装法子:

apt-get install steghide

windows安装法子:

打开https://sourceforge.net/projects/steghide/ 下载steghide-0.5.1-win32.zip,解压后就可以用。


2、实现字典破解功能

这里以一个实验吧的隐写题为例,里面的rose.jpg是用steghide加上一个密码来隐藏数据的,而这个密码我们不知道,所以只能爆破。

这里我用AAPR(Advanced Archive Password Recovery)软件里的english.dic作为这次破解需要的字典文件(你们也可以准备别的字典,这题密码很简单的)


指定输出的文件为hide.txt

# -*- coding: utf8 -*-
#author:pcat
#http://pcat.cnblogs.com
from subprocess import *

def foo():
stegoFile='rose.jpg'
extractFile='hide.txt'
passFile='english.dic'

errors=['could not extract','steghide --help','Syntax error']
cmdFormat='steghide extract -sf "%s" -xf "%s" -p "%s"'
f=open(passFile,'r')

for line in f.readlines():
cmd=cmdFormat %(stegoFile,extractFile,line.strip())
p=Popen(cmd,shell=True,stdout=PIPE,stderr=STDOUT)
content=unicode(p.stdout.read(),'gbk')
for err in errors:
if err in content:
break
else:
print content,
print 'the passphrase is %s' %(line.strip())
f.close()
return

if __name__ == '__main__':
foo()
print 'ok'
pass


在windows里除非把steghide所在文件夹加入系统变量Path里,否则上面py代码文件、rose.jpg、english.dic得放在steghide所在文件夹里。

本程序在windows和linux都可以使用。


本文永久更新地址:http://www.linuxdiyf.com/linux/21163.html