qml crackme 破解

源码

C:\Users\Administrator.DESKTOP-345JED8\Downloads\qml>tree /F .
文件夹 PATH 列表
卷序列号为 00000097 66FB:E131
C:\USERS\ADMINISTRATOR.DESKTOP-345JED8\DOWNLOADS\QML
    CMakeLists.txt
    main.cpp
    main.qml
    qml.qrc

没有子文件夹

main.cpp

#include <QGuiApplication>
#include <QQmlApplicationEngine>

int main(int argc, char *argv[])
{
    QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);

    QGuiApplication app(argc, argv);

    QQmlApplicationEngine engine;
    engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
    if (engine.rootObjects().isEmpty())
        return -1;

    return app.exec();
}

main.qml

import QtQuick 2.1
import QtQuick.Controls 2.1
import QtQuick.Layouts 1.1

ApplicationWindow {
    id: mainWindow
    width: 400
    height: 200
    visible: true
    title: "输入验证示例"

    // 主界面布局
    ColumnLayout {
        anchors.centerIn: parent
        spacing: 20

        TextField {
            id: inputField
            placeholderText: "请输入密码"
            Layout.preferredWidth: 200
            focus: true
            onAccepted: validateInput() // 回车键触发验证
        }

        Button {
            text: "验证"
            Layout.alignment: Qt.AlignHCenter
            onClicked: validateInput()
        }
    }

    // 验证逻辑
    function validateInput() {
        if (inputField.text === "123") { // 正确密码设为123
            successDialog.open()
        } else {
            errorDialog.open()
        }
        inputField.clear()
    }

    // 成功提示对话框
    Dialog {
        id: successDialog
        title: "验证结果"
        modal: true
        anchors.centerIn: parent
        standardButtons: Dialog.Ok

        Label {
            text: "✅ 输入正确!"
            font.pixelSize: 16
            padding: 10
        }
    }

    // 错误提示对话框
    Dialog {
        id: errorDialog
        title: "验证结果"
        modal: true
        anchors.centerIn: parent
        standardButtons: Dialog.Ok

        Label {
            text: "❌ 输入错误,请重试!"
            font.pixelSize: 16
            padding: 10
        }
    }
}

qml.qrc

<RCC>
    <qresource prefix="/">
        <file>main.qml</file>
    </qresource>
</RCC>

CMakeLists.txt

cmake_minimum_required(VERSION 2.8.12)

project(01_qml LANGUAGES CXX)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)

find_package(Qt5 COMPONENTS Core Quick REQUIRED)

add_executable(${PROJECT_NAME} "main.cpp" "qml.qrc")

target_link_libraries(${PROJECT_NAME} Qt5::Core Qt5::Quick)

功能演示

20adf4f9580e28a86b91a69d5283a2c8

074ae7bd89e6358a7ae84537b75a5858

功能很简单,输入文本,若正确就会弹出输入正确,错误就会弹出输入错误

破解思路

qml相当是一个执行字节码的虚拟机系统,所以找到qml代码或者字节码才是正确的思路

破解过程

搜索qml源码

直接在内存中搜索输入错误字符串,由于qt都是使用的utf-8字符串,所以请搜索utf-8编码

转到内存布局窗口,按下Ctr + A 全选
4cccfb0a04d8af4a1b55d6c108fc76e0

右键选择搜索匹配特征
e0d05b36d973cbe240ee41f6d1461a9b

utf-8文本框输入输入错误,点击确定
9f9348a52b1b1b075aa6b5150a0262c7

点击搜索的结果,跳转过去
8df83291eb92d87daff1af64e9722045

找到了qml的源码,前面的是源码的所占字节的内存大小
fe18200e66f7f6c1a568da7376726b8f

右键选择在内存布局中转到,确认是否是硬编的
17579a71bff9fbc43702977d9eb88eb6

f3f527804c8f34ef29d7c93a2969d7ff
确实在主模块的静态节区

修改qml源码

把qml源码复制出来
0ed71168e01c31943c8dc1878d54879d

import QtQuick 2.1
import QtQuick.Controls 2.1
import QtQuick.Layouts 1.1

ApplicationWindow {
    id: mainWindow
    width: 400
    height: 200
    visible: true
    title: "输入验证示例"

    // 主界面布局
    ColumnLayout {
        anchors.centerIn: parent
        spacing: 20

        TextField {
            id: inputField
            placeholderText: "请输入密码"
            Layout.preferredWidth: 200
            focus: true
            onAccepted: validateInput() // 回车键触发验证
        }

        Button {
            text: "验证"
            Layout.alignment: Qt.AlignHCenter
            onClicked: validateInput()
        }
    }

    // 验证逻辑
    function validateInput() {
        if (inputField.text === "123") { // 正确密码设为123
            successDialog.open()
        } else {
            errorDialog.open()
        }
        inputField.clear()
    }

    // 成功提示对话框
    Dialog {
        id: successDialog
        title: "验证结果"
        modal: true
        anchors.centerIn: parent
        standardButtons: Dialog.Ok

        Label {
            text: "✅ 输入正确!"
            font.pixelSize: 16
            padding: 10
        }
    }

    // 错误提示对话框
    Dialog {
        id: errorDialog
        title: "验证结果"
        modal: true
        anchors.centerIn: parent
        standardButtons: Dialog.Ok

        Label {
            text: "❌ 输入错误,请重试!"
            font.pixelSize: 16
            padding: 10
        }
    }
}

发现只要把inputField.text === "123"改成 "123" === "123"即可,这样可以保持长度一致

badd036d88ec6337d4b8dafeb5ade04e

然后保存补丁即可
6f6a66bed94a5e8a41a576942577b227

252aafaaa206716492b11793dda8afd3
最后也是成功破解

posted @ 2025-05-15 02:15  乘舟凉  阅读(56)  评论(0)    收藏  举报