1 Star 1 Fork 0

库玛/代码隐写库

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
WTFPL

该程序可以把代码隐写到图片里面 ,并且可以使用Import导入执行

隐写代码 hideCode

你可以在项目根目录编写你要隐藏的代码文件如

import random

print(random.randint(10))

然后使用

import hide_code
hide_code.write_code_to_image("图片路径", "代码")

即可隐写代码

想要读取代码可以使用

import reimport
import 图片名称

推荐使用.png隐写代码

核心功能的使用

支持导入方式 file.png为隐写代码图片时

隐写代码

import hide_code
hide_code.write_code_to_image("file.png", open("ineedhidecode.py", "r").read())

读取代码

import reimport # reimport是必须的 他会重构import的逻辑

import home.file as file # 在home包里面
import file # 在包里

import random
from datetime import datetime, date

if datetime.now() > datetime(2025, 6, 30, 23, 59, 59):
    print("设计已交付 无法运行")
    exit()
# 正常的导入不受影响

其他功能

图片导出Py

当Png的隐写代码import失败后会在图片所在的目录生成一个py文件。 该Py文件会在运行程序结束后自动删除。

隐写配置

用户可以在隐写到文件的代码中的第一行加入文档注释, 如

"""hide-code-config
{
    "配置信息": "JSON格式"
}
"""

值得注意的是:文档注释开头是"""hide-code-config,而不是简单的三个引号,支持单引号和双引号。配置信息采用JSON的格式

隐写配置属性

out

是否自动输出到py文件, 默认是 false , 值类型 boolean

path

当out为true的时候,输出py的路径, 默认是 隐写图片 所在的目录。

DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE Version 2, December 2004 Copyright (C) 2004 Sam Hocevar <sam@hocevar.net> Everyone is permitted to copy and distribute verbatim or modified copies of this license document, and changing it is allowed as long as the name is changed. DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. You just DO WHAT THE FUCK YOU WANT TO.

简介

可以把代码藏入图片之中进行运行的库 展开 收起
Python
WTFPL
取消

发行版 (1)

全部

贡献者

全部

近期动态

不能加载更多了
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/hello_kuma/code-steganography-library.git
git@gitee.com:hello_kuma/code-steganography-library.git
hello_kuma
code-steganography-library
代码隐写库
master

搜索帮助