一个Keygen,参考参考
看到一个Keygen,我觉得还可以,参考参考
//////////////////////////////////////////////////////////////////
// //
// keygen for PCHunter_pro //
// //
// //
// //
//////////////////////////////////////////////////////////////////
#include <windows.h>
#include <string>
#include <iostream>
#include <fstream>
using namespace std;
#include "crypto/aes.h" // 用到了cryptopp 库
#include "crypto/modes.h"
#include "crypto/filters.h"
using namespace CryptoPP;
template<class ByteT>
string hex2str(ByteT* hex, int len, const string& delim=" ") {
if(len == 0) return "";
string s;
char x[4];
for(int i=0; i<len; i++) {
sprintf_s(x, 4, "%02X", ((unsigned char*)hex)[i]);
s += x;
if(i != len-1) s += delim; // append delim if not the last char
}
return s;
}
string hex2str(const string& hex, const string& delim=" ") {
return hex2str(hex.c_str(), hex.length(), delim);
}
string aes_encrypt(string& plain, string& key) {
ECB_Mode< AES >::Encryption e((byte*)key.c_str(), key.length());
string cipher;
StringSource ss(plain, true,
new StreamTransformationFilter( e,
new StringSink( cipher ),
StreamTransformationFilter::NO_PADDING) );
return cipher;
}
#pragma pack(push, 1)
struct reg {
byte unknown_1[80];
FILETIME ft_beg;
FILETIME ft_end;
byte unknown[32];
};
#pragma pack(pop)
int main() {
string key = "ShouJiErShiSiShi";
reg r;
byte* p = (byte*)&r;
for(unsigned int i=0; i<sizeof(reg); i++) { // 填充 00 ~ FF
p[i] = i;
}
SYSTEMTIME st;
GetSystemTime(&st); // 得到当前时间 -> start time
SYSTEMTIME st_new = st;
st_new.wYear += 10; // 当前时间+10年 -> end time
SystemTimeToFileTime(&st, &r.ft_beg); // 转成8字节的 FILETIME,xuetr用的这个
SystemTimeToFileTime(&st_new, &r.ft_end);
string plain;
plain.assign((const char*)&r, sizeof(r));
cout << "raw:" << endl << hex2str(plain) << endl;
string encrypted = aes_encrypt(plain, key); // 加密
// cout << "encrypted:" << endl << hex2str(encrypted) << endl;
ofstream ofs("c:/pchunter.ek", ios::binary); // 写到 key file
ofs << hex2str(encrypted, "");
ofs.close();
}
一个Keygen,参考参考的更多相关文章
- fileinput 配置项大全,从源码中翻出了很多属性,没那么多时间一一验证,特发出来给大家参考参考
fileinput 配置项大全,从源码中翻出了很多属性,没那么多时间一一验证,特发出来给大家参考参考 fileinput 配置项大全 option 属性名 属性类型 描述说明 默认值 language ...
- Servlet模板,一个供新手参考的模板
由于这学期老师的进度是刚开始教JavaSE部分,而我的进度比较快,所以买了3本javaee的书,我根据自己的基础,选择了合适的开发实践,另外两本书都和框架相关,我自认为我的web基础还不是很牢固,所以 ...
- 一个简单可参考的API网关架构设计
网关一词较早出现在网络设备里面,比如两个相互独立的局域网段之间通过路由器或者桥接设备进行通信, 这中间的路由或者桥接设备我们称之为网关. 相应的 API 网关将各系统对外暴露的服务聚合起来,所有要调用 ...
- Linux 一个sysv 脚本参考模板
说明: 1.很多时候我们的服务都是通过源码包编译安装,但是有的源码包编译完成后并不提供该服务的sysv风格脚本,我们只能手动执其二进制程序+配置文件 2.如果服务器宕机或重启,就不能自动完 ...
- [development][tcp/ip][ids] 一个简单有参考价值的库 libnids
libhtp 中的例子, 可以通过libnids快速使用. 或者可以快速的写个sniffer. 支持三个功能 ip分片重组, tcp乱序重排, 端口扫描发现. 工程: https://github.c ...
- 一个很有参考意义的unity博客
http://blog.csdn.net/lyh916/article/details/45133101
- 在sql查询中为了提高查询效率,我们常常会采取一些措施对查询语句进行sql优化,下面总结的一些方法,有需要的可以参考参考。
转载https://www.cnblogs.com/zhang-bo/p/9138151.html 1.对查询进行优化,应尽量避免全表扫描,首先应考虑在 where 及 order by 涉及的列上建 ...
- 使用uniapp开发项目来的几点心得体会,供新手参考参考
先说一下提前须要会的技术 要想快速入手uniapp的话,你最好提前学会vue.微信小程序开发,因为它几乎就是这两个东西的结合体,不然,你就只有慢慢研究吧. 为什么要选择uniapp??? 开发多个平台 ...
- ABAP 数据字典中的参考表和参考字段的作用
ABAP数据字典中的参考表和参考字段的作用 大家最初在SE11中创建表和结构的时候都会遇到一个问题,如果设定了某个字段为QUAN或者CURR类型,也就是数量或金额的时候,总会要求输入一个参考 ...
随机推荐
- HDU 4496 D-City (并查集,水题)
D-City Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65535/65535 K (Java/Others)Total Subm ...
- HDU 4691 Front compression (2013多校9 1006题 后缀数组)
Front compression Time Limit: 5000/5000 MS (Java/Others) Memory Limit: 102400/102400 K (Java/Othe ...
- HDU 3966 Aragorn's Story (树链剖分+树状数组)
Aragorn's Story Time Limit: 10000/3000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) ...
- ADC Power Supplies
http://www.planetanalog.com/author.asp?section_id=3041&doc_id=563055 Jonathan Harris, Product Ap ...
- 源码分析:动态分析 Linux 内核函数调用关系
源码分析:动态分析 Linux 内核函数调用关系 时间 2015-04-22 23:56:07 泰晓科技 原文 http://www.tinylab.org/source-code-analysi ...
- vue2.0中引入UEditor的一些坑。。。。
开发后台系统的时候,富文本编辑器肯定是必不可少的,然后呢~在天朝当然要属百度编辑器(UEditor)最成熟了,功能全面,文档齐全(相对),ui优美(...,对于程序员来说)等等许多方面(MMP,还不是 ...
- NHibernate使用无状态Sessions
NHibernate 3.0 Cookbook第三章,Using stateless sessions的翻译. 当要处理大量的数据,你通常可能会使用更"底层"的API来改善性能,在 ...
- win7 64位搭建scrapy(转)
win7 64位系统依赖的scrapy文件链接:http://pan.baidu.com/s/1mgJS7BM 一个很好的python 64位包下载页面:http://www.lfd.uci.edu/ ...
- 存储配置关系&知识图谱
14年前注册的Blog还是能用的,撸一个S(storage)-CMDB Demo发一小博 什么是图库 图形数据库是NoSQL数据库的一种类型,它应用图形理论存储实体之间的关系信息.图形数据库是一种非关 ...
- [Compose] 17. List comprehensions with Applicative Functors
We annihilate the need for the ol' nested for loop using Applicatives. For example we have this kind ...