Misc_01转二维码(不是二进制)

例题ctfhub/隐写v2.0

image-20241115002433749

打开是一张图片

image-20241115002519329

文件分离得到zip,爆破密码得到7878

打开得到0和1,

!!!不是二进制转图片,直接是二维码

缩小能看到

image-20241115002644330

000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000
0011111111111110110000111110000001001111110000000110000011111111111100
0011111111111110110000111110000001001111110000000110000011111111111100
0011000000000110110000001111100110111111001111111001110011000000000100
0011000000000110110000001111100110111111001111111001110011000000000100
0011001111100110111111110001100111000011110111100111110011011111100100
0011001111100110001111001000011111001111111000011111110011011111100100
0011001111100110001111001000011111001111111000011111110011011111100100
0011001111100110000011000000011001110011000111111000000011011111100100
0011001111100110000011000000011001110011000111111000000011011111100100
0011000000000110110000000110011111000011110001111111110011000000000100
0011000000000110110000000110011111000011110001111111110011000000000100
0011111111111110110011001001100110110011001001100110110011111111111100
0011111111111110110011001001100110110011001001100110110011111111111100
0000000000000000111100000110000110111100000111111000000000000000000000
0000001111100110110000001110000111110011111000000111111111100001111100
0000001111100110110000001110000111110011111000000111111111100001111100
0000110111100001110011110000000000000011000110000001001100111110011000
0000110111100001110011110000000000000011000110000001001100111110011000
0011000000000110000011111110011000110000001000011111111111100111100100
0011000000000110000011111110011000110000001000011111111111100111100100
0000000001111001000011110110011111000000001001100001001100100000000000
0000000001111001000011110110011111000000001001100001001100100000000000
0000001110011110000011110111100000110000000110011001111111111001100100
0000000001111001000011110000011000001111000000011110001100000000011000
0000000001111001000011110000011000001111000000011110001100000000011000
0011111110011110111111001001100111111111001111100001110011011111100100
0011111110011110111111001001100111111111001111100001110011011111100100
0011001000011000001100000001111111111111110001100001111111100000000100
0011001000011000001100000001111111111111110001100001111111100000000100
0011001001100111111100111110011111001100000111111111110011011111100100
0011001001100111111100111110011111001100000111111111110011011111100100
0000110110011001111111000111100001110011001001100000001100100110000000
0011001110000111110011001111100000000011110000000111111111011111111100
0011001110000111110011001111100000000011110000000111111111011111111100
0011000001100000111100000001111000111100110110000000000000100110011000
0011000001100000111100000001111000111100110110000000000000100110011000
0000001000011110111100000111111000110000000000011111110011011001111000
0000001000011110111100000111111000110000000000011111110011011001111000
0000111111111001000000111110011111001111110001100000001100100111111100
0000111111111001000000111110011111001111110001100000001100100111111100
0000111001111110110000111110000001000011000111100001111111100000011100
0011001111111001000011000001111000111111000111100111000011000000011000
0011001111111001000011000001111000111111000111100111000011000000011000
0000110000000110001100110000011110001111111000000001000011000111100000
0000110000000110001100110000011110001111111000000001000011000111100000
0011000001100001110011001110011000001100111001100111110011000110000000
0011000001100001110011001110011000001100111001100111110011000110000000
0011001000000111000011001110011110110011110000000110000000000001111100
0011001000000111000011001110011110110011110000000110000000000001111100
0011001111111001111100111111100111001111001001100110111100000110011100
0011001000011111110011110111111001001111001000011110111111111000000100
0011001000011111110011110111111001001111001000011110111111111000000100
0000000000000000111111110000000111110011110001100001110000011001111000
0000000000000000111111110000000111110011110001100001110000011001111000
0011111111111110000011001000011000001111000001111000110011011110000100
0011111111111110000011001000011000001111000001111000110011011110000100
0011000000000110000011110000000110111111111001100000110000011000000000
0011001111100110111111110001100001111111001001111111111111111111100100
0011001111100110111111110001100001111111001001111111111111111111100100
0011001111100110110011001001111110110011001000000001001111011000011100
0011001111100110110011001001111110110011001000000001001111011000011100
0011001111100110110000000110011001000011001111100001110000100000000100
0011001111100110110000000110011001000011001111100001110000100000000100
0011000000000110001111001111100110110011111110000111110011100000000100
0011000000000110001111001111100110110011111110000111110011100000000100
0011111111111110001111110110000000000011001110000000001100000111111100
0000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000

exp1:0为黑色像素,1为白色像素,70行,70列

image-20241115002954179

image-20241115003008761

from PIL import Image

# 二进制字符串
binary_nums = """0000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000
0011111111111110110000111110000001001111110000000110000011111111111100
0011111111111110110000111110000001001111110000000110000011111111111100
0011000000000110110000001111100110111111001111111001110011000000000100
0011000000000110110000001111100110111111001111111001110011000000000100
0011001111100110111111110001100111000011110111100111110011011111100100
0011001111100110001111001000011111001111111000011111110011011111100100
0011001111100110001111001000011111001111111000011111110011011111100100
0011001111100110000011000000011001110011000111111000000011011111100100
0011001111100110000011000000011001110011000111111000000011011111100100
0011000000000110110000000110011111000011110001111111110011000000000100
0011000000000110110000000110011111000011110001111111110011000000000100
0011111111111110110011001001100110110011001001100110110011111111111100
0011111111111110110011001001100110110011001001100110110011111111111100
0000000000000000111100000110000110111100000111111000000000000000000000
0000001111100110110000001110000111110011111000000111111111100001111100
0000001111100110110000001110000111110011111000000111111111100001111100
0000110111100001110011110000000000000011000110000001001100111110011000
0000110111100001110011110000000000000011000110000001001100111110011000
0011000000000110000011111110011000110000001000011111111111100111100100
0011000000000110000011111110011000110000001000011111111111100111100100
0000000001111001000011110110011111000000001001100001001100100000000000
0000000001111001000011110110011111000000001001100001001100100000000000
0000001110011110000011110111100000110000000110011001111111111001100100
0000000001111001000011110000011000001111000000011110001100000000011000
0000000001111001000011110000011000001111000000011110001100000000011000
0011111110011110111111001001100111111111001111100001110011011111100100
0011111110011110111111001001100111111111001111100001110011011111100100
0011001000011000001100000001111111111111110001100001111111100000000100
0011001000011000001100000001111111111111110001100001111111100000000100
0011001001100111111100111110011111001100000111111111110011011111100100
0011001001100111111100111110011111001100000111111111110011011111100100
0000110110011001111111000111100001110011001001100000001100100110000000
0011001110000111110011001111100000000011110000000111111111011111111100
0011001110000111110011001111100000000011110000000111111111011111111100
0011000001100000111100000001111000111100110110000000000000100110011000
0011000001100000111100000001111000111100110110000000000000100110011000
0000001000011110111100000111111000110000000000011111110011011001111000
0000001000011110111100000111111000110000000000011111110011011001111000
0000111111111001000000111110011111001111110001100000001100100111111100
0000111111111001000000111110011111001111110001100000001100100111111100
0000111001111110110000111110000001000011000111100001111111100000011100
0011001111111001000011000001111000111111000111100111000011000000011000
0011001111111001000011000001111000111111000111100111000011000000011000
0000110000000110001100110000011110001111111000000001000011000111100000
0000110000000110001100110000011110001111111000000001000011000111100000
0011000001100001110011001110011000001100111001100111110011000110000000
0011000001100001110011001110011000001100111001100111110011000110000000
0011001000000111000011001110011110110011110000000110000000000001111100
0011001000000111000011001110011110110011110000000110000000000001111100
0011001111111001111100111111100111001111001001100110111100000110011100
0011001000011111110011110111111001001111001000011110111111111000000100
0011001000011111110011110111111001001111001000011110111111111000000100
0000000000000000111111110000000111110011110001100001110000011001111000
0000000000000000111111110000000111110011110001100001110000011001111000
0011111111111110000011001000011000001111000001111000110011011110000100
0011111111111110000011001000011000001111000001111000110011011110000100
0011000000000110000011110000000110111111111001100000110000011000000000
0011001111100110111111110001100001111111001001111111111111111111100100
0011001111100110111111110001100001111111001001111111111111111111100100
0011001111100110110011001001111110110011001000000001001111011000011100
0011001111100110110011001001111110110011001000000001001111011000011100
0011001111100110110000000110011001000011001111100001110000100000000100
0011001111100110110000000110011001000011001111100001110000100000000100
0011000000000110001111001111100110110011111110000111110011100000000100
0011000000000110001111001111100110110011111110000111110011100000000100
0011111111111110001111110110000000000011001110000000001100000111111100
0000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000""".replace('\n', '')

# 图像尺寸
MAX = 70
pic = Image.new("RGB", (MAX, MAX))

# 填充像素
i = 0
for y in range(MAX):
    for x in range(MAX):
        if binary_nums[i] == '0':
            pic.putpixel((x, y), (0, 0, 0))  # 黑色
        else:


            pic.putpixel((x, y), (255, 255, 255))  # 白色
        i += 1

# 保存图像
pic.save("flag.png")

exp2:简化1

from PIL import Image

# 从 flag.txt 文件中读取二进制字符串
with open('flag.txt', 'r') as file:
    binary_nums = file.read().strip().replace('\n', '')

# 图像尺寸
MAX = 70
pic = Image.new("RGB", (MAX, MAX))

# 填充像素
i = 0
for y in range(MAX):
    for x in range(MAX):
        if binary_nums[i] == '0':
            pic.putpixel((x, y), (0, 0, 0))  # 黑色
        else:
            pic.putpixel((x, y), (255, 255, 255))  # 白色
        i += 1

# 保存图像
pic.save("flag.png")
print("图像已保存为 flag.png")
代码解释

1. PIL (Python Imaging Library)

PIL 是 Python Imaging Library 的缩写,是一个用于处理图像的库。它提供了许多图像处理功能,如读取、修改和保存各种图像格式。PIL 已经不再维护,但它的 fork 版本 Pillow 仍在积极开发和维护中。因此,通常我们会使用 Pillow 而不是原始的 PIL

2. Image 类

Image 类是 PIL 库中的一个核心类,用于表示和操作图像。你可以通过 Image 类创建新的图像、打开现有的图像文件、修改图像内容以及保存图像。

3. pic 变量

在你的代码中,pic 是一个 Image 对象,表示一个新创建的空白图像。具体来说:

pic = Image.new("RGB", (MAX, MAX))
  • "RGB":指定了图像的颜色模式。RGB 表示图像由红、绿、蓝三种颜色通道组成。
  • (MAX, MAX):指定了图像的尺寸,宽度和高度都是 MAX 像素。

@4. putpixel 方法

putpixel 是 Image 类的一个方法,用于设置图像中某个特定像素的颜色。其语法如下:

image.putpixel((x, y), color)
  • (x, y):表示图像中的一个像素位置,x 和 y 分别是水平和垂直坐标。
  • color:表示要设置的颜色。对于 RGB 图像,color 是一个包含三个整数的元组,分别表示红、绿、蓝三个颜色通道的值。例如,(0, 0, 0) 表示黑色,(255, 255, 255) 表示白色。
  • 越接近0解释越接近黑色,越接近255解释越接近白色。

代码示例中的 putpixel 使用

在你的代码中,putpixel 方法用于根据 binary_nums 字符串中的值设置图像的像素颜色:

i = 0
for y in range(MAX):
    for x in range(MAX):
        if binary_nums[i] == '0':
            pic.putpixel((x, y), (0, 0, 0))  # 黑色
        else:
            pic.putpixel((x, y), (255, 255, 255))  # 白色
        i += 1
  • i 是一个索引,用于遍历 binary_nums 字符串。
  • for y in range(MAX) 和 for x in range(MAX) 是嵌套的循环,用于遍历图像的每一个像素位置 (x, y)
  • if binary_nums[i] == '0':如果当前字符是 0,则将该位置的像素设置为黑色 (0, 0, 0)
  • else:如果当前字符是 1,则将该位置的像素设置为白色 (255, 255, 255)
  • i += 1:每次处理完一个像素后,i 自增 1,以便处理下一个字符。

总结

  • PIL:Python Imaging Library,用于处理图像的库。
  • Image 类PIL 中的核心类,用于表示和操作图像。
  • pic 变量:一个 Image 对象,表示一个新创建的空白图像。
  • putpixel 方法:用于设置图像中某个特定像素的颜色。

通过这些工具,你可以创建和操作图像,生成二维码图像并保存为文件。希望这些解释对你有帮助!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:/a/918773.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

使用 K-means 算法进行豆瓣读书数据的文本聚类分析

✅作者简介:2022年博客新星 第八。热爱国学的Java后端开发者,修心和技术同步精进。 🍎个人主页:Java Fans的博客 🍊个人信条:不迁怒,不贰过。小知识,大智慧。 💞当前专栏…

STM32完全学习——F407ZGT6点亮LED

一、寄存器描述 我们想要点亮LED,无非就是对于寄存器的一些设置,主要分为两步,首先是需要打开相应GPIO的时钟,这是因为STM32在上电后,每个外设的时钟默认都是关闭的,需要我们手动打开。其次就是对GPIO的一…

Dubbo RPC线程模型

消费端线程模型,提供者端线程模型 消费端线程模型 对 2.7.5 版本之前的 Dubbo 应用,尤其是一些消费端应用,当面临需要消费大量服务且并发数比较大的大流量场景时(典型如网关类场景),经常会出现消费端线程…

Python酷库之旅-第三方库Pandas(225)

目录 一、用法精讲 1056、pandas.PeriodIndex.dayofweek属性 1056-1、语法 1056-2、参数 1056-3、功能 1056-4、返回值 1056-5、说明 1056-6、用法 1056-6-1、数据准备 1056-6-2、代码示例 1056-6-3、结果输出 1057、pandas.PeriodIndex.day_of_week属性 1057-1、…

商业物联网详细指南:优势与挑战

物联网是信息技术行业最具前景的领域之一。为什么它如此热门呢?原因在于全球连接性。设备可以像人群一样相互协作。正如我们所知,协作能显著提高生产力。 物联网对普通用户和企业都有益处。许多日常流程可以通过传感器、扫描仪、摄像头和其他设备实现自…

Spring Boot汽车资讯:科技与汽车的新融合

摘要 随着信息技术在管理上越来越深入而广泛的应用,管理信息系统的实施在技术上已逐步成熟。本文介绍了汽车资讯网站的开发全过程。通过分析汽车资讯网站管理的不足,创建了一个计算机管理汽车资讯网站的方案。文章介绍了汽车资讯网站的系统分析部分&…

vlan之间的通信(三层交换机)

拓补图&#xff1a; 【实验步骤】 LSW1配置&#xff1a; The device is running! <Huawei> <Huawei>sys Enter system view, return user view with CtrlZ. [Huawei]un in e Info: Information center is disabled. [Huawei]sys maluoying [maluoying]vla…

Redis作为分布式锁,得会避坑

日常开发中&#xff0c;经常会碰到秒杀抢购等业务场景。为了避免并发请求造成的库存超卖等问题&#xff0c;我们一般会用到Redis分布式锁。但是使用Redis分布式锁之前要知道有哪些坑是需要我们避过去的。 1. 非原子操作&#xff08;setnx expire&#xff09; 一说到实现Redis…

ETH钱包地址如何获取 如何购买比特币

首先我们要先注册一个交易所 Gate.io&#xff08;推荐&#xff09;: 点我注册 1、注册很简单&#xff0c;通过手机号就可以进行注册了。 2、获取ETH钱包地址 注册好之后&#xff0c;如图所示&#xff0c;点击“统一账户” 3、通过搜索栏搜索ETH&#xff0c;如下图所示 4、点…

基于Python+Django的农业害虫识别系统设计和实现(源码+论文+部署讲解等)

博主介绍&#xff1a;CSDN毕设辅导第一人、全网粉丝50W,csdn特邀作者、博客专家、CSDN新星计划导师、Java领域优质创作者,博客之星、掘金/华为云/阿里云/InfoQ等平台优质作者、专注于Java技术领域和学生毕业项目实战,高校老师/讲师/同行前辈交流✌ 技术范围&#xff1a;SpringB…

Python多线程爬虫入门:让你的爬虫跑得更快

一、前言 在互联网时代&#xff0c;数据是最有价值的资源之一。而网页爬虫是获取数据的一种非常重要的工具。在这篇文章中&#xff0c;我们将学习如何用 Python 编写一个多线程网页爬虫&#xff0c;适合小白快速上手&#xff01; 二、多线程进程 单线程串行&#xff1a;一步…

使用Web Speech API实现语音识别与合成技术

&#x1f493; 博客主页&#xff1a;瑕疵的CSDN主页 &#x1f4dd; Gitee主页&#xff1a;瑕疵的gitee主页 ⏩ 文章专栏&#xff1a;《热点资讯》 使用Web Speech API实现语音识别与合成技术 使用Web Speech API实现语音识别与合成技术 使用Web Speech API实现语音识别与合成技…

NavVis VLX3的精度怎么去进行验证?【上海沪敖3D】

01、精度评价现状 三维捕捉行业还没有建立一个用于估算或验证移动激光扫描系统精度的统一标准。因此&#xff0c;需要高精度交付成果的专业人士很难相信设备所标注的精度规格&#xff0c;也就很难知道基于SLAM的移动激光扫描系统是否适合当前的项目。 NavVis将通过展示一种严格…

爬虫开发工具与环境搭建——环境配置

第二章&#xff1a;爬虫开发工具与环境搭建 第二节&#xff1a;环境配置 在进行爬虫开发之前&#xff0c;首先需要配置好开发环境。一个良好的开发环境不仅能提高开发效率&#xff0c;还能避免因环境不一致带来的问题。以下是环境配置的详细步骤&#xff0c;涵盖了Python开发…

如何用Excel批量提取文件夹内所有文件名?两种简单方法推荐

在日常办公中&#xff0c;我们有时需要将文件夹中的所有文件名整理在Excel表格中&#xff0c;方便管理和查阅。手动复制文件名既费时又易出错&#xff0c;因此本文将介绍两种利用Excel自动提取文件夹中所有文件名的方法&#xff0c;帮助你快速整理文件信息。 方法一&#xff1…

gvim添加至右键、永久修改配置、放大缩小快捷键、ctrl + c ctrl +v 直接复制粘贴、右键和还原以前版本(V)冲突

一、将 vim 添加至右键 进入安装目录找到 vim91\install.exe 管理员权限执行 Install will do for you:1 Install .bat files to use Vim at the command line:2 Overwrite C:\Windows\vim.bat3 Overwrite C:\Windows\gvim.bat4 Overwrite C:\Windows\evim.bat…

机器学习day5-随机森林和线性代数1最小二乘法

十 集成学习方法之随机森林 集成学习的基本思想就是将多个分类器组合&#xff0c;从而实现一个预测效果更好的集成分类器。大致可以分为&#xff1a;Bagging&#xff0c;Boosting 和 Stacking 三大类型。 &#xff08;1&#xff09;每次有放回地从训练集中取出 n 个训练样本&…

SpringCloud框架学习(第三部分:Resilience4j 与 Micrometer)

目录 九、CircuitBreaker断路器 1.前言&#xff08;Hystrix&#xff09; 2.服务雪崩 3.Circuit Breaker 4. Resilience4j 5.案例实战 &#xff08;1&#xff09;熔断&#xff08;服务熔断 服务降级&#xff09; Ⅰ. 按照 COUNT_BASED&#xff08;计数的滑动窗口&#xf…

使用WebVTT和Track API增强HTML5视频的可访问性和互动性

&#x1f493; 博客主页&#xff1a;瑕疵的CSDN主页 &#x1f4dd; Gitee主页&#xff1a;瑕疵的gitee主页 ⏩ 文章专栏&#xff1a;《热点资讯》 使用WebVTT和Track API增强HTML5视频的可访问性和互动性 使用WebVTT和Track API增强HTML5视频的可访问性和互动性 使用WebVTT和T…

vue2中引入cesium全步骤

1.npm 下载cesium建议指定版本下载&#xff0c;最新版本有兼容性问题 npm install cesium1.95.0 2.在node_models中找到cesium将此文件下的Cesium文件复制出来放在项目的静态资源public中或者static中&#xff0c;获取去github上去下载zip包放在本地也可以 3.在index.html中引…