VIPER_code
收藏资源简介:
Breaking Visual Reasoning CAPTCHAs with VIPER: A Structured Vision-Language Attack Framework VIPER_code is an academic and practical Python framework designed for the analysis and attack of Visual Reasoning CAPTCHAs (VRC). It implements a structured, modular vision-language attack pipeline that supports a range of CAPTCHA types — including six major VRC datasets and various non-VRC challenges. The framework enables automated evaluation and experimentation with large language models (LLMs) to break CAPTCHAs in a highly configurable manner. File & Directory Structure First, unzip all the compressed files. File/Folder Description main.py Main entry for experiment orchestration and accuracy testing. Modifying imports here allows switching among LLM modules and VRC types. environment_variable.py LLM API and environment configuration. You must edit this file before running any experiment. r1_and_r2_main.py Script for running “r1” and “r2” series experiments. Update the imports to select the relevant experiment logic. DS_*.py, Grok_*.py, KIMI_*.py Scripts for specific dataset/model/attack integration. For example, DS_geetest.py for Geetest VRC-specific logic. tools_*.py Toolkit and utility scripts for each VRC or LLM variant. best_28.pt Pretrained model weights (PyTorch). May be needed for certain experiments. data_process/ Contains scripts and raw/intermediate data for transforming datasets. dataset/ Houses all datasets, including six VRC datasets, their labels, prompts, and evaluation scripts that consume these resources. other_captcha/ Scripts and results for non-VRC experiments, such as traditional text-based CAPTCHAs or rotated CAPTCHA variants. result/ Experimental result files, including cracking accuracy per LLM/model (r1, r2), corresponding response times, and any processed data. recaptchaTest/ Specific test scripts and resources for reCAPTCHA-related CAPTCHAs. README.md This documentation. Directions for Use Configure the Environment: Edit environment_variable.py to set the LLM API keys, endpoints, and dataset addresses as needed for your experiments. Run Main Experiments: The central script for most experiments is main.py: Run with python main.py. To test different LLMs or VRC types, adjust the import statements at the top, e.g.: from tools_gpt_xiaodun import *# or: from Grok_xiaodun import *# or: from KIMI_VTT import * The script will manage accuracy testing, experiment orchestration, and results logging. Run r1 / r2 Experiments: Use r1_and_r2_main.py for specialized accuracy experiments of r1 and r2: Edit the import line: from tools_r1 import * to select your target. Change VC-specific logic by editing the directory, sub_directory, width, height = getDirectory() or .Xiaodun_file() invocation. Select which VRC to attack by adjusting the arguments in the related function call. Datasets and Output: Datasets must be placed in /dataset as referenced by test scripts. Transformed/intermediate data is handled by /data_process. Results and accuracy scores generated by experiments are saved in /result. Other CAPTCHA Experiments: /other_captcha/ contains scripts and data for additional types of CAPTCHAs, as well as experiment results for variations like rotated CAPTCHAs or text-based ones. Example Project Tree VIPER_code/├── main.py├── environment_variable.py├── r1_and_r2_main.py├── DS_*.py├── Grok_*.py├── KIMI_*.py├── tools_*.py├── best_28.pt├── README.md├── data_process/│ └── # Dataset processing scripts & data├── dataset/│ └── # All datasets and associated labels/questions├── other_captcha/│ └── # Non-VRC CAPTCHA code/experiments├── recaptchaTest/│ └── # Specific reCAPTCHA experiments└── result/ └── # Output/results for each experiment Reproducibility & Recommendations Python 3.8+ environment recommended. Manage dependencies as needed (pip install ...). There may not be a requirements.txt — review import statements in main scripts. Some experiments require a CUDA-enabled GPU with a functional PyTorch setup. Always check and update environment_variable.py before executing scripts for the correct test context.
# 基于VIPER破解视觉推理验证码:结构化视觉语言攻击框架 VIPER_code是一款面向视觉推理验证码(Visual Reasoning CAPTCHAs,VRC)的分析与破解任务开发的学术实用型Python框架。该框架实现了结构化、模块化的视觉语言攻击流水线,支持多种验证码类型——涵盖六大主流VRC数据集与各类非VRC挑战任务。本框架支持结合大语言模型(Large Language Model,LLM)开展自动化评估与实验,以高度可配置的方式完成验证码破解。 ## 文件与目录结构 首先解压所有压缩包。 | 文件/文件夹 | 说明 | | ---- | ---- | | main.py | 实验编排与精度测试的主入口。修改此处的导入语句可切换大语言模型模块与视觉推理验证码类型。 | | environment_variable.py | 大语言模型API与环境配置文件。运行任何实验前均需编辑该文件。 | | r1_and_r2_main.py | 用于运行“r1”与“r2”系列实验的脚本。更新导入语句可选择对应的实验逻辑。 | | DS_*.py、Grok_*.py、KIMI_*.py | 特定数据集/模型/攻击集成脚本。例如,DS_geetest.py用于实现极验VRC专属逻辑。 | | tools_*.py | 适配各类VRC或LLM变体的工具集与实用脚本。 | | best_28.pt | 预训练模型权重(PyTorch格式),部分实验需用到该文件。 | | data_process/ | 包含数据集转换所需的脚本与原始/中间数据。 | | dataset/ | 存储所有数据集,包括六大VRC数据集、其标注、提示词,以及使用上述资源的评估脚本。 | | other_captcha/ | 非VRC实验的脚本与结果,例如传统文本验证码或旋转式验证码变体。 | | result/ | 实验结果文件,包括各LLM/模型的验证码破解准确率(r1、r2系列)、对应响应时长,以及所有处理后的数据。 | | recaptchaTest/ | 针对reCAPTCHA相关验证码的专属测试脚本与资源。 | | README.md | 本文档。 | ## 使用指南 1. **配置环境**:编辑`environment_variable.py`,根据实验需求设置大语言模型API密钥、接口端点与数据集地址。 2. **运行主实验**:大多数实验的核心脚本为`main.py`,可通过`python main.py`命令运行。若需测试不同LLM或VRC类型,可调整顶部的导入语句,例如: python from tools_gpt_xiaodun import * # 或:from Grok_xiaodun import * # 或:from KIMI_VTT import * 该脚本将负责精度测试、实验编排与结果日志记录。 3. **运行r1/r2系列实验**:使用`r1_and_r2_main.py`开展r1与r2系列的专属精度实验:编辑导入行`from tools_r1 import *`以选择目标实验逻辑。通过修改`getDirectory()`或`.Xiaodun_file()`调用中的目录、子目录、宽高参数来调整视觉验证码专属逻辑。通过调整相关函数调用中的参数来选择待破解的VRC类型。 4. **数据集与输出**:数据集需放置在`/dataset`目录下,以供测试脚本调用。转换后的/中间数据由`/data_process`目录处理。实验生成的结果与准确率分数将保存至`/result`目录。 5. **其他验证码实验**:`/other_captcha/`目录包含针对额外验证码类型的脚本与数据,以及旋转式验证码、文本验证码等变体的实验结果。 ## 项目示例树结构 VIPER_code/ ├── main.py ├── environment_variable.py ├── r1_and_r2_main.py ├── DS_*.py ├── Grok_*.py ├── KIMI_*.py ├── tools_*.py ├── best_28.pt ├── README.md ├── data_process/ │ └── # 数据集处理脚本与数据 ├── dataset/ │ └── # 所有数据集及相关标注/提示词 ├── other_captcha/ │ └── # 非VRC验证码代码/实验 ├── recaptchaTest/ │ └── # 专属reCAPTCHA实验 └── result/ └── # 各实验的输出/结果 ## 可复现性与使用建议 - 推荐使用Python 3.8及以上版本的运行环境。 - 根据需要手动管理依赖项(执行`pip install ...`命令安装)。本项目未提供`requirements.txt`文件,请查看主脚本中的导入语句以确认所需依赖。 - 部分实验需搭载支持CUDA的GPU与可用的PyTorch环境。 - 执行脚本前,请务必检查并更新`environment_variable.py`,以确保测试上下文的正确性。



