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 方法:用于设置图像中某个特定像素的颜色。

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

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

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

如何修改网络ip地址:一步步指南‌

在当今这个数字化时代,网络已成为我们日常生活与工作中不可或缺的一部分。无论是浏览网页、在线办公还是享受流媒体服务,稳定的网络连接和适当的IP地址管理都是确保良好体验的关键。然而,出于隐私保护、绕过地理限制或测试网络环境等需要&…

STL——vector(1)

博客ID:LanFuRenC系列专栏:C语言重点部分 C语言注意点 C基础 Linux 数据结构 C注意点 今日好题 声明等级:黑色->蓝色->红色 欢迎新粉加入,会一直努力提供更优质的编程博客,希望大家三连支持一下啦 目录 尾…

iOS 18 导航栏插入动画会导致背景短暂变白的解决

问题现象 在最新的 iOS 18 系统中,如果我们执行导航栏的插入动画,可能会造成导航栏背景短暂地变为白色: 如上图所示:我们分别向主视图和 Sheet 弹出视图的导航栏插入了消息,并应用了动画效果。可以看到,前者的导航栏背景会在消息插入那一霎那“变白”,而后者则没有任何…

SPP:空间金字塔池化

今天水一篇博客,讲讲SPP池化结构;那这是个什么东西呢?它的作用又是什么呢?在了解它之前我们先简单了解一下大部分的神经网络; 引入: 在大部分的神经网络中,都将神经网络分为Backbone主干网络、…

网络安全与防范

1.重要性 随着互联网的发达,各种WEB应用也变得越来越复杂,满足了用户的各种需求,但是随之而来的就是各种网络安全的问题。了解常见的前端攻击形式和保护我们的网站不受攻击是我们每个优秀fronter必备的技能。 2.分类 XSS攻击CSRF攻击网络劫…

Python从0到100(七十三):Python OpenCV-OpenCV实现手势虚拟拖拽

前言: 零基础学Python:Python从0到100最新最全教程。 想做这件事情很久了,这次我更新了自己所写过的所有博客,汇集成了Python从0到100,共一百节课,帮助大家一个月时间里从零基础到学习Python基础语法、Pyth…

Spring Cloud Alibaba [Gateway]网关。

1 简介 网关作为流量的入口,常用功能包括路由转发、权限校验、限流控制等。而springcloudgateway 作为SpringCloud 官方推出的第二代网关框架,取代了Zuul网关。 1.1 SpringCloudGateway特点: (1)基于Spring5,支持响应…

ssm139选课排课系统的设计与开发+vue(论文+源码)_kaic

摘 要 互联网的普及,改变了人们正常的生活学习及消费习惯,而且也大大的节省了人们的时间,由于各种管理系统都再不断的增加,更方便了用户,也改良了很多的用户习惯。对于选课排课系统查询方面缺乏系统的管理方式&#x…

网络基础 - NAT 篇

一、全局 IP 地址(公网 IP 地址)和私有 IP 地址 RFC 1918 规定了用于组建局域网的私有 IP 地址: 10.0.0.0 ~ 10.255.255.255172.16.0.0 ~ 172.31.255.255192.168.0.0 ~ 192.168.255.255 包含在以上范围内的 IP 地址都属于私有 IP 地址,而在此之外的 I…

Springboot3.3.5 启动流程之 tomcat启动流程介绍

在文章 Springboot3.3.5 启动流程(源码分析) 中讲到 应用上下文(applicationContext)刷新(refresh)时使用模板方法 onRefresh 创建了 Web Server. 本文将详细介绍 ServletWebServer — Embedded tomcat 的启动流程。 首先&…

NPOI 实现Excel模板导出

记录一下使用NPOI实现定制的Excel导出模板&#xff0c;已下实现需求及主要逻辑 所需Json数据 对应参数 List<PurQuoteExportDataCrInput> listData [{"ItemName": "电缆VV3*162*10","Spec": "电缆VV3*162*10","Uom":…

DAY113代码审计-PHPTP框架微P系统漏审项目等

一、环境安装 导入数据 Debug 版本信息收集 一、不安全写法的sql注入&#xff08;拼接写法绕过预编译机制&#xff09; 1、Good.php的不安全写法 2、查找可以参数 3、找路由关系 application/index/controller/Goods.php http://172.19.1.236:8833/index.php/index/goods/aj…

Flink1.19编译并Standalone模式本地运行

1.首先下载源码 2.本地运行 新建local_conf和local_lib文件夹&#xff0c;并且将编译后的文件放入对应的目录 2.1 启动前参数配置 2.1.2 StandaloneSessionClusterEntrypoint启动参数修改 2.1.3 TaskManagerRunner启动参数修改 和StandaloneSessionClusterEntrypoint一样修改…

Ascend C算子性能优化实用技巧05——API使用优化

Ascend C是CANN针对算子开发场景推出的编程语言&#xff0c;原生支持C和C标准规范&#xff0c;兼具开发效率和运行性能。使用Ascend C&#xff0c;开发者可以基于昇腾AI硬件&#xff0c;高效的实现自定义的创新算法。 目前已经有越来越多的开发者使用Ascend C&#xff0c;我们…

计算机编程中的测试驱动开发(TDD)及其在提高代码质量中的应用

&#x1f493; 博客主页&#xff1a;瑕疵的CSDN主页 &#x1f4dd; Gitee主页&#xff1a;瑕疵的gitee主页 ⏩ 文章专栏&#xff1a;《热点资讯》 计算机编程中的测试驱动开发&#xff08;TDD&#xff09;及其在提高代码质量中的应用 计算机编程中的测试驱动开发&#xff08;T…

前后端交互之动态列

一. 情景 在做项目时&#xff0c;有时候后会遇到后端使用了聚合函数&#xff0c;导致生成的对象的属性数量或数量不固定&#xff0c;因此无法建立一个与之对应的对象来向前端传递数据&#xff0c;这时可以采用NameDataListVO向前端传递数据。 Data Builder AllArgsConstructo…

[笔记]L6599的极限工作条件考量

0.名词 OTP over tempature protect.OCP over current protectOVP over voltage protectBrownout Protection Undervoltage Protection可能需要考虑hysteresis response.因为要考虑一些高频干扰 1.基本的过流保护逻辑 参考&#xff1a;ST L6599 器件手册 LLC开关电源&#…

【Pikachu】XML外部实体注入实战

若天下不定&#xff0c;吾往&#xff1b;若世道不平&#xff0c;不回&#xff01; 1.XXE漏洞实战 首先写入一个合法的xml文档 <?xml version "1.0"?> <!DOCTYPE gfzq [<!ENTITY gfzq "gfzq"> ]> <name>&gfzq;</name&…

多模块集成swagger(knife4j-spring-boot-starter)

前言 单体项目、多模块单体项目、微服务项目&#xff0c;集成的方案大同小异&#xff0c;微服务会在网关做个聚合&#xff0c;后面再补充。 依赖版本 目前demo的版本如下&#xff1a; spring boot 2.7.3spring cloud 2021.0.4spring cloud alibaba 2021.0.4.0knife4j-sprin…

DataStream编程模型之数据源、数据转换、数据输出

Flink之DataStream数据源、数据转换、数据输出&#xff08;scala&#xff09; 0.前言–数据源 在进行数据转换之前&#xff0c;需要进行数据读取。 数据读取分为4大部分&#xff1a; &#xff08;1&#xff09;内置数据源&#xff1b; 又分为文件数据源&#xff1b; socket…