Code Monkey home page Code Monkey logo

steganographytool's Introduction

1 隐写与提取 运行指南

  1. 在线体验网址 http://120.27.143.171:19191/ 由于云服务器配置有限,可能会一定卡顿
  2. 由于当前隐写算法决定,隐写后的载体如果被压缩或修改,则无法提取被隐写信息

1.1 实现功能

  • 图像文件隐写
  • LSB隐写
  • gradio服务中消息隐写与提取
  • 隐写算法批量写入
  • 隐写算法批量读取
  • gradio服务中文件隐写与提取
  • 更多的隐写算法支持
  • 更多的隐写载体支持

1.2 环境安装

pip install -r requirements.txt

1.3 运行gradio服务

python service_gradio.py

1.4 python代码调用隐写消息

    # 隐写信息
    import cv2
    import os
    from gstego import Steganography
    
    # 初始化隐写器
    stego_opt = Steganography()
    # 读取载体信息
    carrier_path = r"**.png"
    image_file = cv2.imread(carrier_path)
    # 设置隐写消息
    hide_info = "我好像曾经见过你"
    # 隐写
    carrier_data = stego_opt.hide_message(image_file, hide_info)
    # 保存隐写的载体
    cv2.imwrite("output.png", carrier_data)
    
    # 读取载体
    img_in = cv2.imread(r"output.png")
    # 提取隐写信息
    extract_info = stego_opt.extract(img_in)
    # 展示隐写消息
    print(extract_info["message"])

1.5 python代码调用隐写文件

    # 隐写文件
    import cv2
    import os
    from gstego import Steganography
    
    # 初始化隐写器
    stego_opt = Steganography()
    # 读取载体信息
    carrier_path = r"**.png"
    image_file = cv2.imread(carrier_path)
    # 读取隐写文件
    hide_file_path = r"**.txt"
    hide_buffer = open(hide_file_path, "rb")
    # 隐写
    carrier_data = stego_opt.hide_file(image_file, hide_buffer)
    cv2.imwrite("output.png", carrier_data)

    # 读取载体
    img_in = cv2.imread(r"output.png")
    extract_info = stego_opt.extract(img_in)
    # 保存提取出的文件
    with open("out." + extract_info["file"]["suffix"], "wb") as fw:
        fw.write(extract_info["file"]["bytes_data"])

steganographytool's People

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.