当前位置: 首页 > news >正文

202207_BUGKU_二维码GIF

Tags:GIF分离,QRCODE,ZXING库

0x00. 题目

Barcodes

0x01. WP

01 分离GIF

图片

工具路径:https://pan.baidu.com/s/1GyH7kitkMYywGC9YJeQLJA?pwd=Zmxh#list/path=/CTF附件/Tools

工具名称:风二西_GIF图片分离工具.zip

02 使用脚本批量扫描

exp.py

#将指定文件夹下的文件按顺序解码
import os
import zxingpath = "gifframe"
#读取多个文件
files= os.listdir(path) #按e和.将文件序号截出排序------依据实际情况修改
#files.sort(key=lambda x:int(x.split('e')[1].split(".")[0]))
files.sort(key=lambda x:int(x.split(".")[0]))
reader = zxing.BarCodeReader()
print(files)
#结果
string=''
for file in files:barcode = reader.decode(path+"\\"+file)print(file)#print(barcode.parsed,end="") #连续输出#需要分隔的情况#string+=barcode.parsed+','string+=barcode.parsed
print(string)

运行结果:

C:\Users\admin\Desktop\20220721_二维码GIF_CTF小学生群>python3 Barcodes_decode.py
000.png
001.png
002.png
003.png
004.png
005.png
006.png
007.png
008.png
009.png
010.png
011.png
012.png
013.png
014.png
015.png
016.png
017.png
SYC{F1aSh_so_f4sT}

扩展知识点:zxing库

1. 报错:zxing.BarCodeReaderException: ('Java JARs not found in classpath ...)

找到__init__.py文件中的class BarCodeReader(object):
里面关于文件路径分隔符的判断:classpath_sep = ';' if sys.platform == 'nt' else ':' # https://stackoverflow.com/a/60211688
**【修正】 因为我们是在windows里面用,直接改为 classpath_sep = ';' 即可。

2. 报错:UnicodeDecodeError: 'utf-8' codec can't decode byte 0xdf in position 0: invalid continuation byte

找到__init__.py文件中的class BarCodeReaderdecode函数中codes = [BarCode.parse(result) for result in file_results]
使用了BarCode.parse(result)中有两处bytes.decode()调用,显然是utf-8与中文编码GB18030/GBK/GB2312 不兼容导致

        parsed = parsed[:-1].decode()raw = raw[:-1].decode()

【修正】 增加一个参数,改动如下:

BarCode.parse(cls, zxing_output, encoding='utf-8'):parsed = parsed[:-1].decode(encoding)raw = raw[:-1].decode(encoding)
BarCodeReader.(self, filenames, try_harder=False, possible_formats=None, pure_barcode=False, products_only=False, encoding='utf-8'):codes = [BarCode.parse(result, encoding=encoding) for result in file_results]

【使用】可以传参编码方式:zxing.BarCodeReader().decode(imgs[0],encoding='GBK')

http://www.wxhsa.cn/company.asp?id=1326

相关文章:

  • 20250910NOIP模拟赛
  • 分治 NTT 一则
  • U604938 你不准卡 O(n sqrt n log L) 其中 L log L = sqrt n
  • 20250906
  • 【2025最新推荐】AI大模型API中转站 | 国内直连ChatGPT/Claude/Gemini全系API接口服务
  • 在用灵魂去感受另一个灵魂的震颤
  • html怎么写
  • 谁拿了谁的伞?
  • NSSCTF-misc
  • 百粉粉福
  • lc1024-视频拼接
  • 多元统计分析1
  • OI界的梗
  • 202404_QQ_ZIP嵌套
  • 无重复字符的最长子串-leetcode
  • 两个常见的 计数问题 trick
  • 搜维尔科技:Xsens人形机器人拟人动作AI训练,提升机器人工作精度与效率
  • 202110_绿盟杯_隐藏的数据
  • 【初赛】图 - Slayer
  • 线上课
  • 弹窗、抽屉、当前页和新开页,到底怎么选? - 智慧园区
  • POJ 2566 Bound Found
  • 搜维尔科技:Haption触觉力反馈系统,沉浸式远程呈现、数字孪生、混合现实和移动远程机器人
  • 飞书免费企业邮箱推荐
  • CF1140F Extending Set of Points
  • Lark免费企业邮箱推荐
  • CMP 40HX在PVE9.0配置vGPU
  • 耶日奈曼:置信区间与假设检验的奠基者
  • 尚硅谷后台管理系统
  • Web语音聊天室中录音无声问题分析与解决方案