steghide工具的使用

steghide的介绍:

Steghide 是一个用于隐写术(Steganography)的工具,它允许用户将文件(如文本、图片或音频)隐藏在另一个文件中,通常是图片或音频文件。隐写术是一种将信息隐藏在其它非机密文件中,以避免引起怀疑的方法。Steghide 支持的文件类型有限,通常用于图片(如 BMP, JPEG)和音频(如 WAV)文件。

下载:

kali Linux:

steghide在kali中是预安装的,在命令行界面输入steghide可以查看steghide是否安装,若没安装可以在命令行中输入:

sudo apt-get update
sudo apt-get install steghide
  • 这将更新你的包列表,然后安装 Steghide。

Windows:

在Windows中我就不做过多说明了,大家可以自行搜索。

用法:

该工具老版本不需要密码,但新版本需要密码,也可以设置成空密码
基本命令结构:
 

嵌入操作:

steghide --embed -ef hello.txt -cf hello.jpg

上面的意思是将hello.txt中的内容嵌入到hello.jpg照片中

其中

--embed     指的是嵌入操作,这个是必须有的。

-ef              选择要嵌入的文件。

-cf              嵌入到<filename>文件中。

注意:上面的命令会将原图覆盖,若想生成的新的图片而不是覆盖原图可以使用

-sf  参数。例如:

steghide --embed -ef hello.txt -cf hello.jpg -sf nihao.jpg

这样就不会覆盖原图而是将嵌入后的图片以新图片的方式出现。

提取操作:

steghide --extract -sf [要提取的图片] 

-sf                指定了包含嵌入式数据的隐写文件。

使用-xf来将提取的内容另存到其他地方。

-xf                指定了提取后的数据将保存到的文件名。

steghide --extract -sf [要提取的图片]  -xf nihao.txt

其他:

在新版本的steghide工具中,工具默认必须要设置密码,同时,提取时也是要密码,在CTF比赛中,出题放会提示密码。当然,可能我的脑子不太灵光,老是猜不到密码,于是写了一段python的代码用于暴力破解

#!/usr/bin/python3
# -*- coding:utf8 -*-

from subprocess import Popen, PIPE, STDOUT
import time

def foo():
    stegoFile='/path/to/your/stego_file.jpg'  # 更改为你的隐写文件路径
    extractFile='/path/to/your/extracted_data.txt'  # 更改为你的提取文件路径
    passFile='/path/to/your/password_list.txt'  # 更改为你的密码文件路径

    errors = ['could not extract', 'steghide --help', 'Syntax error']
    cmdFormat = "steghide extract -sf {} -xf {} -p {}"
    password_list = []

    with open(passFile, 'r') as f:
        password_list = f.readlines()

    password_list = [line.strip() for line in password_list]
    total_passwords = len(password_list)
    current_password = 0

    for line in password_list:
        cmd = cmdFormat.format(stegoFile, extractFile, line)
        start_time = time.time()
        p = Popen(cmd, shell=True, stdout=PIPE, stderr=STDOUT)
        content = p.stdout.read().decode()
        end_time = time.time()
        elapsed_time = end_time - start_time
        
        if not any(error in content for error in errors):
            print(f"Password found: {line}")
            return

        current_password += 1
        percentage = (current_password / total_passwords) * 100
        print(f"Password attempt: {current_password}/{total_passwords} - {percentage:.2f}% complete", end='\r')

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

注意:上面的代码用于kali系统中 

至于密码字典,大家可以自己搜索。不过kali是一个非常强大的系统,在kali中有一个工具crunch,它可以生成密码字典这一期并不打算教大家crunch的用法,感兴趣的小伙伴可以看我其他的作品。

  • 5
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值