Skip to content

Commit

Permalink
Merge pull request #16 from libxengine/develop
Browse files Browse the repository at this point in the history
V3.5.0.1001 Merge
  • Loading branch information
xengine-qyt authored Feb 3, 2023
2 parents 680d307 + 7429316 commit f86920d
Show file tree
Hide file tree
Showing 53 changed files with 1,402 additions and 388 deletions.
24 changes: 24 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,27 @@
XEngine_Authorize V3.5.0.1001

添加:禁用列表功能支持修改信息了
添加:禁用功能支持启用和禁用
添加:禁用功能支持过期时间设置了
添加:本地CDKEY生成解析支持
更新:HTTP请求函数
修改:数据库句柄类型
修改:管理程序不允许修改ROOT用户
修改:管理程序可以双击打开用户修改界面了
修改:IP禁用功能不在使用开始和结束字段了
修正:管理程序登录的时候没有设置设备类型的问题

added:banned function to modify support
added:enable field for banned
added:banned function support left time
added:local cdkey support
update:http request function name
modify:XHDATA to XNETHANDLE
modify:root user is not allowed to modify
modify:open user modify window when double click user list
modify:does not need to start and end for ip address
fixed:management program have not device type when login
======================================================================================
XEngine_Authorize V3.4.0.1001

添加:windows窗口特效类
Expand Down
4 changes: 4 additions & 0 deletions README.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,10 @@ The V1 version is an XEngine component. Most of the code is concentrated in XEng
The V2 version comes out separately with all related modules and is developed separately
The V3 version is a new version, developed to meet the requirements of many environments

## update guide
Database update Use Navicat and other database software to open the judgment table and the different fields for modification
After modification, directly copy the database to the new version to overwrite, and modify your configuration file

## Authorization instructions
Use this software must be open source and indicate the source,If you want closed source and commercial,Then need to be authorized by the author.

Expand Down
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,10 @@ V1版本为XEngine组件.大部分代码集中在XEngine中
V2版本单独出来了所有相关模块,单独开发
V3版本为全新版本,为了适应过多环境要求开发

## 更新指导
数据库更新使用Navicat等数据库软件打开判断表和字段不同的地方进行修改
修改完毕后直接把数据库拷贝到新的版本进行覆盖,修改你的配置文件即可

## 授权说明
使用此软件必须开源并且注明出处,如果想闭源商用,那么需要经过作者授权.

Expand All @@ -134,9 +138,7 @@ http basic和disgt支持
mysql支持
列表数据分割,用于大型服务器
支持用户和硬件绑定同时验证
支持自定义序列号导入导出
统计用户所有在线时间
账号封禁与处罚,时间永久
持久层,redis,memcached等支持
支持代理端(序列号分发,权限控制)
支持绑定自定义内容
Expand Down
10 changes: 10 additions & 0 deletions XEngine_Apps/Authorize_APPClient.sln
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ VisualStudioVersion = 17.3.32804.467
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Authorize_APPClient", "Authorize_APPClient\Authorize_APPClient.vcxproj", "{4F263EAF-A748-46AF-A10E-8A25626E0571}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Authorize_APPLocal", "Authorize_APPLocal\Authorize_APPLocal.vcxproj", "{767151F7-230E-431B-AC6D-683F19F43C13}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Expand All @@ -21,6 +23,14 @@ Global
{4F263EAF-A748-46AF-A10E-8A25626E0571}.Release|x64.Build.0 = Release|x64
{4F263EAF-A748-46AF-A10E-8A25626E0571}.Release|x86.ActiveCfg = Release|Win32
{4F263EAF-A748-46AF-A10E-8A25626E0571}.Release|x86.Build.0 = Release|Win32
{767151F7-230E-431B-AC6D-683F19F43C13}.Debug|x64.ActiveCfg = Debug|x64
{767151F7-230E-431B-AC6D-683F19F43C13}.Debug|x64.Build.0 = Debug|x64
{767151F7-230E-431B-AC6D-683F19F43C13}.Debug|x86.ActiveCfg = Debug|Win32
{767151F7-230E-431B-AC6D-683F19F43C13}.Debug|x86.Build.0 = Debug|Win32
{767151F7-230E-431B-AC6D-683F19F43C13}.Release|x64.ActiveCfg = Release|x64
{767151F7-230E-431B-AC6D-683F19F43C13}.Release|x64.Build.0 = Release|x64
{767151F7-230E-431B-AC6D-683F19F43C13}.Release|x86.ActiveCfg = Release|Win32
{767151F7-230E-431B-AC6D-683F19F43C13}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
22 changes: 11 additions & 11 deletions XEngine_Apps/Authorize_APPClient/Authorize_APPClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#pragma comment(lib,"XEngine_BaseLib/XEngine_BaseLib")
#pragma comment(lib,"XEngine_Core/XEngine_OPenSsl")
#pragma comment(lib,"XEngine_Client/XClient_Socket")
#pragma comment(lib,"XEngine_NetHelp/NetHelp_APIHelp")
#pragma comment(lib,"XEngine_NetHelp/NetHelp_APIClient")
#pragma comment(lib,"../../XEngine_Source/Debug/jsoncpp")
#else
#include <stdio.h>
Expand All @@ -23,14 +23,14 @@ using namespace std;
#include <XEngine_Include/XEngine_Core/OPenSsl_Error.h>
#include <XEngine_Include/XEngine_Client/XClient_Define.h>
#include <XEngine_Include/XEngine_Client/XClient_Error.h>
#include <XEngine_Include/XEngine_NetHelp/APIHelp_Define.h>
#include <XEngine_Include/XEngine_NetHelp/APIHelp_Error.h>
#include <XEngine_Include/XEngine_NetHelp/APIClient_Define.h>
#include <XEngine_Include/XEngine_NetHelp/APIClient_Error.h>
#include <XEngine_Include/XEngine_HelpComponents/Authorize_Define.h>
#include "../../XEngine_Source/XAuth_Protocol.h"

//Windows::vs2022 x86 debug 编译即可
//Linux::g++ -std=c++17 -Wall -g Auth_APPClient.cpp -o Auth_APPClient.exe -L ../../../XEngine/XEngine_Release/XEngine_Linux/Ubuntu/XEngine_BaseLib -L ../../../XEngine/XEngine_Release/XEngine_Linux/Ubuntu/XEngine_Core -L ../../../XEngine/XEngine_Release/XEngine_Linux/Ubuntu/XEngine_Client -L ../../../XEngine/XEngine_Release/XEngine_Linux/Ubuntu/XEngine_NetHelp -lXEngine_BaseLib -lXEngine_OPenSsl -lXClient_Socket -lNetHelp_APIHelp -lpthread -ljsoncpp -Wl,-rpath=../../../XEngine/XEngine_Release/XEngine_Linux/Ubuntu/XEngine_BaseLib:../../../XEngine/XEngine_Release/XEngine_Linux/Ubuntu/XEngine_Core:../../../XEngine/XEngine_Release/XEngine_Linux/Ubuntu/XEngine_Client:../../../XEngine/XEngine_Release/XEngine_Linux/Ubuntu/XEngine_NetHelp,--disable-new-dtags
//Macos::g++ -std=c++17 -Wall -g Auth_APPClient.cpp -o Auth_APPClient.exe -L ../../../XEngine/XEngine_Release/XEngine_Linux/Ubuntu/XEngine_BaseLib -L ../../../XEngine/XEngine_Release/XEngine_Linux/Ubuntu/XEngine_Core -L ../../../XEngine/XEngine_Release/XEngine_Linux/Ubuntu/XEngine_Client -L ../../../XEngine/XEngine_Release/XEngine_Linux/Ubuntu/XEngine_NetHelp -lXEngine_BaseLib -lXEngine_OPenSsl -lXClient_Socket -lNetHelp_APIHelp -lpthread -ljsoncpp
//Linux::g++ -std=c++17 -Wall -g Auth_APPClient.cpp -o Auth_APPClient.exe -L ../../../XEngine/XEngine_Release/XEngine_Linux/Ubuntu/XEngine_BaseLib -L ../../../XEngine/XEngine_Release/XEngine_Linux/Ubuntu/XEngine_Core -L ../../../XEngine/XEngine_Release/XEngine_Linux/Ubuntu/XEngine_Client -L ../../../XEngine/XEngine_Release/XEngine_Linux/Ubuntu/XEngine_NetHelp -lXEngine_BaseLib -lXEngine_OPenSsl -lXClient_Socket -lNetHelp_APIClient -lpthread -ljsoncpp -Wl,-rpath=../../../XEngine/XEngine_Release/XEngine_Linux/Ubuntu/XEngine_BaseLib:../../../XEngine/XEngine_Release/XEngine_Linux/Ubuntu/XEngine_Core:../../../XEngine/XEngine_Release/XEngine_Linux/Ubuntu/XEngine_Client:../../../XEngine/XEngine_Release/XEngine_Linux/Ubuntu/XEngine_NetHelp,--disable-new-dtags
//Macos::g++ -std=c++17 -Wall -g Auth_APPClient.cpp -o Auth_APPClient.exe -L ../../../XEngine/XEngine_Release/XEngine_Linux/Ubuntu/XEngine_BaseLib -L ../../../XEngine/XEngine_Release/XEngine_Linux/Ubuntu/XEngine_Core -L ../../../XEngine/XEngine_Release/XEngine_Linux/Ubuntu/XEngine_Client -L ../../../XEngine/XEngine_Release/XEngine_Linux/Ubuntu/XEngine_NetHelp -lXEngine_BaseLib -lXEngine_OPenSsl -lXClient_Socket -lNetHelp_APIClient -lpthread -ljsoncpp

BOOL bRun = TRUE;
BOOL bLogin = TRUE;
Expand Down Expand Up @@ -118,7 +118,7 @@ int AuthClient_Register()

int nMsgLen = 0;
CHAR* ptszMsgBuffer = NULL;
APIHelp_HttpRequest_Custom(_T("POST"), lpszUrl, st_JsonRoot.toStyledString().c_str(), &nHTTPCode, &ptszMsgBuffer, &nMsgLen);
APIClient_Http_Request(_T("POST"), lpszUrl, st_JsonRoot.toStyledString().c_str(), &nHTTPCode, &ptszMsgBuffer, &nMsgLen);
printf("AuthClient_Register:\n%s\n", ptszMsgBuffer);
BaseLib_OperatorMemory_FreeCStyle((XPPMEM)&ptszMsgBuffer);

Expand All @@ -138,7 +138,7 @@ int AuthClient_Pay()

int nMsgLen = 0;
CHAR* ptszMsgBuffer = NULL;
APIHelp_HttpRequest_Custom(_T("POST"), lpszUrl, st_JsonRoot.toStyledString().c_str(), &nHTTPCode, &ptszMsgBuffer, &nMsgLen);
APIClient_Http_Request(_T("POST"), lpszUrl, st_JsonRoot.toStyledString().c_str(), &nHTTPCode, &ptszMsgBuffer, &nMsgLen);
printf("AuthClient_Pay:\n%s\n", ptszMsgBuffer);
BaseLib_OperatorMemory_FreeCStyle((XPPMEM)&ptszMsgBuffer);

Expand Down Expand Up @@ -213,7 +213,7 @@ int AuthClient_GetPass()

int nMsgLen = 0;
CHAR* ptszMsgBuffer = NULL;
APIHelp_HttpRequest_Custom(_T("POST"), lpszUrl, st_JsonRoot.toStyledString().c_str(), &nHTTPCode, &ptszMsgBuffer, &nMsgLen);
APIClient_Http_Request(_T("POST"), lpszUrl, st_JsonRoot.toStyledString().c_str(), &nHTTPCode, &ptszMsgBuffer, &nMsgLen);
printf("AuthClient_GetPass:\n%s\n", ptszMsgBuffer);
BaseLib_OperatorMemory_FreeCStyle((XPPMEM)&ptszMsgBuffer);

Expand All @@ -232,7 +232,7 @@ int AuthClient_GetTime()

int nMsgLen = 0;
CHAR* ptszMsgBuffer = NULL;
APIHelp_HttpRequest_Custom(_T("POST"), lpszUrl, st_JsonRoot.toStyledString().c_str(), &nHTTPCode, &ptszMsgBuffer, &nMsgLen);
APIClient_Http_Request(_T("POST"), lpszUrl, st_JsonRoot.toStyledString().c_str(), &nHTTPCode, &ptszMsgBuffer, &nMsgLen);
printf("AuthClient_GetTime:\n%s\n", ptszMsgBuffer);
BaseLib_OperatorMemory_FreeCStyle((XPPMEM)&ptszMsgBuffer);

Expand All @@ -255,7 +255,7 @@ int AuthClient_Delete()

int nMsgLen = 0;
CHAR* ptszMsgBuffer = NULL;
APIHelp_HttpRequest_Custom(_T("POST"), lpszUrl, st_JsonRoot.toStyledString().c_str(), &nHTTPCode, &ptszMsgBuffer, &nMsgLen);
APIClient_Http_Request(_T("POST"), lpszUrl, st_JsonRoot.toStyledString().c_str(), &nHTTPCode, &ptszMsgBuffer, &nMsgLen);
printf("AuthClient_Delete:\n%s\n", ptszMsgBuffer);
BaseLib_OperatorMemory_FreeCStyle((XPPMEM)&ptszMsgBuffer);

Expand All @@ -274,7 +274,7 @@ int AuthClient_Try()

int nMsgLen = 0;
CHAR* ptszMsgBuffer = NULL;
APIHelp_HttpRequest_Custom(_T("POST"), lpszUrl, st_JsonRoot.toStyledString().c_str(), &nHTTPCode, &ptszMsgBuffer, &nMsgLen);
APIClient_Http_Request(_T("POST"), lpszUrl, st_JsonRoot.toStyledString().c_str(), &nHTTPCode, &ptszMsgBuffer, &nMsgLen);
printf("AuthClient_Try:\n%s\n", ptszMsgBuffer);
BaseLib_OperatorMemory_FreeCStyle((XPPMEM)&ptszMsgBuffer);

Expand Down
110 changes: 110 additions & 0 deletions XEngine_Apps/Authorize_APPLocal/Authorize_APPLocal.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
#ifdef _MSC_BUILD
#include <Windows.h>
#include <tchar.h>
#pragma comment(lib,"Ws2_32")
#pragma comment(lib,"jsoncpp")
#pragma comment(lib,"XEngine_BaseLib/XEngine_BaseLib")
#pragma comment(lib,"XEngine_Core/XEngine_OPenSsl")
#pragma comment(lib,"XEngine_NetHelp/NetHelp_APIClient")
#pragma comment(lib,"XEngine_HelpComponents/HelpComponents_Authorize")
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <inttypes.h>
#include <json/json.h>
#include <XEngine_Include/XEngine_CommHdr.h>
#include <XEngine_Include/XEngine_ProtocolHdr.h>
#include <XEngine_Include/XEngine_BaseLib/BaseLib_Define.h>
#include <XEngine_Include/XEngine_BaseLib/BaseLib_Error.h>
#include <XEngine_Include/XEngine_Core/OPenSsl_Define.h>
#include <XEngine_Include/XEngine_Core/OPenSsl_Error.h>
#include <XEngine_Include/XEngine_NetHelp/APIClient_Define.h>
#include <XEngine_Include/XEngine_NetHelp/APIClient_Error.h>
#include <XEngine_Include/XEngine_HelpComponents/Authorize_Define.h>
#include <XEngine_Include/XEngine_HelpComponents/Authorize_Error.h>

//需要优先配置XEngine
//WINDOWS支持VS2022 x64 debug 编译调试
//linux::g++ -std=c++17 -Wall -g Authorize_APPLocal.cpp -o Authorize_APPLocal.exe -L /usr/local/lib/XEngine_Release/XEngine_BaseLib -L /usr/local/lib/XEngine_Release/XEngine_Core -L /usr/local/lib/XEngine_Release/XEngine_NetHelp -L /usr/local/lib/XEngine_Release/XEngine_HelpComponents -lXEngine_BaseLib -lXEngine_OPenSsl -lNetHelp_APIClient -lHelpComponents_Authorize
//macos::g++ -std=c++17 -Wall -g Authorize_APPLocal.cpp -o Authorize_APPLocal.exe -lXEngine_BaseLib -lXEngine_OPenSsl -lNetHelp_APIClient -lHelpComponents_Authorize

int main()
{
#ifdef _MSC_BUILD
WSADATA st_WSAData;
WSAStartup(MAKEWORD(2, 2), &st_WSAData);
#endif
int nLen = 0;
int nCode = 0;
LPCTSTR lpszCreateUrl = _T("http://127.0.0.1:5302/auth/cdkey/create");

Json::Value st_JsonRoot;
Json::Value st_JsonAPPInfo;
Json::Value st_JsonREGInfo;
Json::Value st_JsonUserInfo;
st_JsonRoot["tszAddr"] = "http://app.xyry.org";
st_JsonRoot["nPort"] = 5501;

st_JsonAPPInfo["tszAppName"] = "XEngine";
st_JsonAPPInfo["tszAppVer"] = "1.0.0.1001";

st_JsonREGInfo["tszHardware"] = "5501012NE21N";
st_JsonREGInfo["enSerialType"] = ENUM_HELPCOMPONENTS_AUTHORIZE_SERIAL_TYPE_TIME;
st_JsonREGInfo["enRegType"] = ENUM_HELPCOMPONENTS_AUTHORIZE_REG_TYPE_TRY;
st_JsonREGInfo["enHWType"] = ENUM_HELPCOMPONENTS_AUTHORIZE_HW_TYPE_CPU;

st_JsonUserInfo["tszUserName"] = "qyt";
st_JsonUserInfo["tszUserContact"] = "486179@qq.com";

st_JsonRoot["st_AuthAppInfo"] = st_JsonAPPInfo;
st_JsonRoot["st_AuthRegInfo"] = st_JsonREGInfo;
st_JsonRoot["st_AuthUserInfo"] = st_JsonUserInfo;

TCHAR* ptszCreateBuffer = NULL;
TCHAR* ptszAuthBuffer = NULL;
if (!APIClient_Http_Request(_T("POST"), lpszCreateUrl, st_JsonRoot.toStyledString().c_str(), &nCode, &ptszCreateBuffer, &nLen))
{
printf("发送投递失败!\n");
return 0;
}
printf("接受到数据,大小:%d,内容:%s\n", nLen, ptszCreateBuffer);

TCHAR tszMsgBuffer[4096];
memset(tszMsgBuffer, '\0', sizeof(tszMsgBuffer));
//你也可以通过授权模块的API函数来读内存,都一回事,这里为了方便直接写了,请求分钟卡,拥有10分钟,也可以写自定义时间格式
BaseLib_OperatorFile_WriteProfileFromMemory(ptszCreateBuffer, nLen, "AuthReg", "tszLeftTime", "10", tszMsgBuffer, &nLen);
BaseLib_OperatorMemory_FreeCStyle((XPPMEM)&ptszCreateBuffer);

LPCTSTR lpszAuthUrl = _T("http://127.0.0.1:5302/auth/cdkey/auth?pass=123123");
if (!APIClient_Http_Request(_T("POST"), lpszAuthUrl, tszMsgBuffer, &nCode, &ptszAuthBuffer, &nLen))
{
printf("发送投递失败!\n");
return 0;
}
//ptszAuthBuffer 写文件,然后验证即可.如下所示
//step 1.解密
CHAR tszCodecBuffer[4096];
memset(tszCodecBuffer, '\0', sizeof(tszCodecBuffer));
OPenSsl_XCrypto_Decoder(ptszAuthBuffer, &nLen, tszCodecBuffer, "123123");
BaseLib_OperatorMemory_FreeCStyle((XPPMEM)&ptszAuthBuffer);
printf("接受到数据,大小:%d,内容:\n%s\n", nLen, tszCodecBuffer);
//step 2.转换格式
XENGINE_AUTHORIZE_LOCAL st_Authorize;
memset(&st_Authorize, '\0', sizeof(XENGINE_AUTHORIZE_LOCAL));

Authorize_Local_ReadMemory(tszCodecBuffer, nLen, &st_Authorize);
//step 3.判断您是否超时
if (Authorize_Local_GetLeftTimer(&st_Authorize))
{
printf("ok\n");
}
else
{
printf("timeout\n");
}
#ifdef _MSC_BUILD
WSACleanup();
#endif
return 0;
}
Loading

0 comments on commit f86920d

Please sign in to comment.