Qt源码解析 索引
汇编逆向— 授权破解示例分析
问题模拟
运行环境
- x64dbg
- Windows 10
- Qt5.12.3
示例代码
使用Qt显示当前时间,模拟一般授权软件的时间判断逻辑,当时间超过授权日期后就提示授权过期。
没有Qt经验的同学可以直接使用控制台程序,更简单一点。
#include "QtASM.h"
#include <QTimer>
#include <QDateTime>
#include <QMessageBox>
bool checkPassword()
{
bool result = true;
QDateTime now = QDateTime::currentDateTime();
QDateTime dummy = QDateTime::fromString("2022-11-10", "yyyy-MM-dd");
qint64 testDateTime = now.secsTo(dummy);
if (testDateTime < 0)//超过授权日期2022-11-10
{
result = false;
}
return result;
}
QtASM::QtASM(QWidget *parent)
: QWidget(parent)
{
ui.setupUi(this);
QTimer *timer = new QTimer(this);
connect(timer, &QTimer::timeout, this, [=]() {
if (checkPassword())
{
ui.dateTimeEdit->setDateTime(QDateTime::currentDateTime());
}
else
{
QMessageBox msgBox;
msgBox.setText(QStringLiteral("error.授权失败."));//加了英文,方便查找
msgBox.exec();
}
});
timer->start(1000);
}
运行效果
按照博主测试的时间2022-11-19,软件会一直提示授权失败。