Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- new PlVers:__version = 5;
- new Float:NULL_VECTOR[3];
- new String:NULL_STRING[1];
- new Extension:__ext_core = 64;
- new MaxClients;
- new Extension:__ext_sdktools = 492;
- new Extension:__ext_smsock = 536;
- new String:anz1[3][4] =
- {
- "a",
- "n",
- "z"
- }
- new String:anz2[3][4] =
- {
- "A",
- "N",
- "Z"
- }
- new String:anz3[3][4] =
- {
- "0",
- "5",
- "9"
- }
- new String:sBase64Table[17] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
- new String:szTmpFile[3] = "ucptmp.txt";
- new String:szFileList[6] = "cfg/ucp/filelist.txt";
- new String:szDetectList[6] = "cfg/ucp/detectlist.txt";
- new String:szWadFile[2] = "ucp.cmd";
- new __@179[65];
- new __@178[65];
- new String:__@175[32];
- new String:__@177[8];
- new __@180[65];
- new __@181[65];
- new __@182[65];
- new __@183[65];
- new __@186[65];
- new __@265[65];
- new String:__@184[65][8];
- new String:__@185[65][8];
- new String:__@240[32];
- new String:__@14[9];
- new String:__@307[17];
- new String:__@244[65][8];
- new String:__@279[65][8];
- new String:__@250[105][32];
- new __@250_;
- new upmode;
- new String:__@297[55][128];
- new __@297_;
- new ServPort;
- new String:__@174[64];
- new String:__@255[32];
- new String:__@264[64];
- new String:ScreenMotdBuf[256];
- new String:DownloadLinkBuf[256];
- new String:hostbuf[16];
- new String:pathbuf[16];
- new String:portbuf[2];
- new String:UpdateNick[65][32];
- new String:ServHost[16];
- new Handle:c_ucp_version;
- new Handle:c_ucp_mode;
- new Handle:c_ucp_banlist_file;
- new Handle:c_ucp_build;
- new Handle:c_ucp_cpurl;
- new Handle:c_ucp_link;
- new Handle:c_ucp_checkfile_mode;
- new Handle:c_ucp_umode;
- new Handle:c_ucp_uhost;
- new Handle:c_ucp_uport;
- new Handle:c_ucp_uuser;
- new Handle:c_ucp_upass;
- new Handle:c_ucp_upath;
- new Handle:c_ucp_autoscreen;
- new Handle:c_ucp_mathack;
- new Handle:c_ucp_monitor;
- new Handle:c_ucp_who_mode;
- new Handle:c_ucp_detect_mode;
- new Handle:c_ucp_detect_time;
- new Handle:c_ucp_log_mode;
- new Handle:c_game_mode;
- public Plugin:myinfo =
- {
- name = "UCP Server",
- description = "Ultra Core Protector Anti-Cheat",
- author = "Endi",
- verison = "7.1",
- url = "http://ucp-anticheat.org/"
- };
- public OnMapStart()
- {
- c_ucp_mathack = 1;
- DeleteFile("ucp.cmd.ztmp");
- if (!FileExists(szWadFile, false)) {
- LogMessage("Can't read %s", szWadFile);
- return 3;
- }
- AddFileToDownloadsTable(szWadFile);
- PrecacheGeneric(szWadFile, false);
- __@250_ = 0;
- decl String:buffer[128];
- if (!FileExists(szFileList, false)) {
- new HANDLE:file = OpenFile(szFileList, "wb");
- CloseHandle(file);
- } else {
- decl String:modebuffer[36];
- decl String:md5buffer[36];
- GetGameFolderName(modebuffer, 34);
- new HANDLE:file = OpenFile(szFileList, "rb");
- if (file) {
- while (!IsEndOfFile(file) && ReadFileLine(file, buffer, 128)) {
- new var2;
- if (buffer[0] != ';') {
- ReplaceString(buffer, strlen(buffer), "\r", "", true);
- ReplaceString(buffer, strlen(buffer), "\n", "", true);
- if (FileExists(buffer, false)) {
- AddFileToDownloadsTable(buffer);
- PrecacheGeneric(buffer, false);
- md5_file(buffer, md5buffer);
- ReplaceString(buffer, strlen(buffer), "/", "\", true);
- Format(__@250[__@250_], 127, "%s%s\%s", md5buffer, modebuffer, buffer);
- if (StrContains(__@250[__@250_], ".", true) != -1) {
- __@250_ = __@250_ + 1;
- }
- }
- }
- }
- CloseHandle(file);
- } else {
- LogMessage("Can't open %s", szFileList);
- }
- }
- GetDetectList();
- return 0;
- }
- public GetDetectList()
- {
- __@297_ = 0;
- decl String:buffer[512];
- if (!FileExists(szDetectList, false)) {
- new HANDLE:file = OpenFile(szDetectList, "wb");
- CloseHandle(file);
- } else {
- new HANDLE:file = OpenFile(szDetectList, "rb");
- if (file) {
- while (!IsEndOfFile(file) && ReadFileLine(file, buffer, 512)) {
- new var2;
- if (buffer[0] != ';') {
- ReplaceString(buffer, strlen(buffer), "\r", "", true);
- ReplaceString(buffer, strlen(buffer), "\n", "", true);
- strcopy(__@297[__@297_], 511, buffer);
- __@297_ = __@297_ + 1;
- }
- }
- CloseHandle(file);
- } else {
- if (GetConVarInt(c_ucp_log_mode)) {
- LogMessage("Can't open %s", szDetectList);
- }
- }
- }
- return 0;
- }
- public bool:AskPluginLoad(Handle:myself, bool:late, String:error[], err_max)
- {
- CreateNative("ucp_id", func_24);
- CreateNative("GetClientAuthString2", func_69);
- CreateNative("GetClientBuild", func_30);
- CreateNative("GetClientOs", func_31);
- return true;
- }
- public Action:func_21(id, args)
- {
- if (IsFakeClient(id)) {
- return Action:0;
- }
- if (!GetConVarInt(c_ucp_mode)) {
- return Action:0;
- }
- if (__@183[id]) {
- return Action:0;
- }
- if (!__@180[id]) {
- new var1;
- if (__@181[id]) {
- decl String:buffer[32];
- decl String:Md5HashBuf[36];
- Format(buffer, 32, "%s ", __@184[id]);
- md5(buffer, Md5HashBuf, 34);
- Md5HashBuf[2] = 0;
- __@185[id][10] = 0;
- if (StrEqual(Md5HashBuf, __@185[id] + 8, false)) {
- __@179[id] = GetRandomInt(100000, 999999999);
- new len = IntToString(__@179[id], buffer, 32);
- func_37(buffer, len);
- ClientCommand(id, "ucp_%s 4%s", __@184[id], buffer);
- CreateTimer(10, func_19, id, 0);
- __@183[id] = 1;
- if (GetConVarInt(c_ucp_autoscreen) >= 60) {
- CreateTimer(10, func_27, id, 0);
- }
- if (__@186[id] == 1) {
- CreateTimer(0.5, func_33, id, 0);
- }
- CreateTimer(15, func_83, id, 0);
- if (GetConVarInt(c_ucp_detect_mode)) {
- CreateTimer(0.5, func_70, id, 0);
- }
- return Action:0;
- }
- }
- CreateTimer(0.1, func_34, id, 0);
- return Action:0;
- }
- func_16(id);
- return Action:0;
- }
- public OnClientConnected(id)
- {
- __@184[id] = 0;
- __@179[id] = 0;
- __@186[id] = 0;
- __@307[id] = 0;
- __@180[id] = 1;
- __@181[id] = 1;
- __@182[id] = 1;
- if (GetConVarInt(c_ucp_mode)) {
- __@183[id] = 0;
- GetClientInfo(id, "*ucp_id", __@185[id], 12);
- if (strlen(__@185[id]) == 11) {
- strcopy(__@184[id], 11, __@185[id]);
- __@184[id][8] = 0;
- new i = 0;
- while (i < 8) {
- new var1;
- if (__@184[id][i][0] >= 'A') {
- i++;
- }
- i++;
- }
- decl String:l_@11[512];
- decl String:l_@10[12];
- decl String:l_@12[128];
- new b = 0;
- new HANDLE:file = OpenFile(__@175, "rt");
- if (file != HANDLE:-1) {
- while (!IsEndOfFile(file) && ReadFileLine(file, l_@11, 512)) {
- strcopy(l_@10, 9, l_@11);
- l_@10[8] = 0;
- if (StrEqual(l_@10, __@184[id], true)) {
- b = StrContains(l_@11[9], " ", true);
- new len = strlen(l_@11);
- while (len) {
- if (StrContains(l_@11[len], " ", true) != -1) {
- len++;
- strcopy(l_@12, 128, l_@11[len]);
- l_@11[b + 9] = 0;
- b = StringToInt(l_@11[9], 10);
- if (b) {
- new l_@9 = GetTime({0,0});
- if (l_@9 < b) {
- b -= l_@9;
- b /= 60;
- KickClient(id, "%t", "UCP_BANTIMEREASONMSG", b, l_@12);
- CloseHandle(file);
- return 0;
- }
- CloseHandle(file);
- file = -1;
- func_28(__@184[id]);
- CloseHandle(file);
- }
- KickClient(id, "%t", "UCP_BANREASONMSG", l_@12);
- CloseHandle(file);
- return 0;
- }
- len--;
- }
- strcopy(l_@12, 128, l_@11[len]);
- l_@11[b + 9] = 0;
- b = StringToInt(l_@11[9], 10);
- if (b) {
- new l_@9 = GetTime({0,0});
- if (l_@9 < b) {
- b -= l_@9;
- b /= 60;
- KickClient(id, "%t", "UCP_BANTIMEREASONMSG", b, l_@12);
- CloseHandle(file);
- return 0;
- }
- CloseHandle(file);
- file = -1;
- func_28(__@184[id]);
- CloseHandle(file);
- }
- KickClient(id, "%t", "UCP_BANREASONMSG", l_@12);
- CloseHandle(file);
- return 0;
- }
- }
- CloseHandle(file);
- }
- __@180[id] = 0;
- func_40(id);
- }
- return 0;
- }
- __@183[id] = 1;
- return 0;
- }
- public func_40(id)
- {
- ClientCommand(id, "ucp_%s 1%d%d%s %s %s", __@184[id], GetConVarInt(c_ucp_checkfile_mode), c_ucp_mathack, __@14, __@177, __@240);
- return 0;
- }
- public Action:func_27(Handle:timer, id)
- {
- if (!GetConVarInt(c_ucp_mode)) {
- return Action:0;
- }
- if (!IsClientConnected(id)) {
- return Action:0;
- }
- if (IsFakeClient(id)) {
- return Action:0;
- }
- new sstime = GetConVarInt(c_ucp_autoscreen);
- if (sstime >= 60) {
- decl String:time[32];
- FormatTime(time, 32, "%Y.%m.%d_%H.%M.%S", GetTime({0,0}));
- ClientCommand(id, "ucp_%s 3%s%s", __@184[id], time, __@174);
- CreateTimer(float(sstime), func_27, id, 0);
- }
- return Action:0;
- }
- public Action:func_83(Handle:timer, any:id)
- {
- if (!GetConVarInt(c_ucp_mode)) {
- return Action:0;
- }
- if (!IsClientConnected(id)) {
- return Action:0;
- }
- ClientCommand(id, "ucp_%s t", __@184[id]);
- CreateTimer(float(GetRandomInt(40, 60)), func_83, id, 0);
- return Action:0;
- }
- public Action:func_19(Handle:timer, any:id)
- {
- if (!GetConVarInt(c_ucp_mode)) {
- return Action:0;
- }
- if (!IsClientConnected(id)) {
- return Action:0;
- }
- if (__@179[id] / 2 * __@179[id] == __@178[id]) {
- PrintCenterText(id, __@255);
- return Action:0;
- }
- CreateTimer(10, func_63, id, 0);
- return Action:0;
- }
- public Action:func_63(Handle:timer, any:id)
- {
- if (!GetConVarInt(c_ucp_mode)) {
- return Action:0;
- }
- if (!IsClientConnected(id)) {
- return Action:0;
- }
- if (__@179[id] / 2 * __@179[id] == __@178[id]) {
- PrintCenterText(id, __@255);
- return Action:0;
- }
- func_16(id);
- return Action:0;
- }
- public Action:func_2(id, args)
- {
- if (args < 1) {
- return Action:3;
- }
- if (!GetConVarInt(c_ucp_mode)) {
- return Action:0;
- }
- decl String:arg1[32];
- GetCmdArg(1, arg1, 32);
- __@178[id] = StringToInt(arg1, 10);
- if (args < 2) {
- GetCmdArg(2, arg1, 32);
- new var1;
- if (strlen(arg1) == strlen("7.1")) {
- func_16(id);
- }
- }
- return Action:3;
- }
- public DisableVersionChange(Handle:convar, String:oldValue[], String:newValue[])
- {
- if (!StrEqual("7.1", newValue, true)) {
- SetConVarString(convar, "7.1", false, false);
- }
- return 0;
- }
- public ModeChange(Handle:convar, String:oldValue[], String:newValue[])
- {
- if (!StrEqual(oldValue, newValue, true)) {
- if (StrEqual(newValue, "0", true)) {
- PrintToServer(" %t", "UCP_DISABLED");
- func_35("UCP_DISABLED");
- }
- PrintToServer(" %t", "UCP_ENABLED");
- func_35("UCP_ENABLED");
- }
- return 0;
- }
- public func_35(String:reason[])
- {
- new maxClients = GetMaxClients();
- new i = 1;
- while (i <= maxClients) {
- if (IsClientConnected(i)) {
- PrintToChat(i, " %t", reason);
- PrintCenterText(i, " %t", reason);
- }
- i++;
- }
- return 0;
- }
- public Action:func_15(id, args)
- {
- if (args < 1) {
- return Action:0;
- }
- if (!GetConVarInt(c_ucp_mode)) {
- return Action:0;
- }
- if (__@183[id]) {
- return Action:0;
- }
- if (__@180[id]) {
- return Action:0;
- }
- decl String:arg1[32];
- GetCmdArg(1, arg1, 32);
- if (strlen(arg1) != 8) {
- func_16(id);
- return Action:0;
- }
- if (__@181[id]) {
- decl String:Md5Hash[36];
- decl String:Md5HashBuf[36];
- Format(Md5Hash, 34, "%s%s", __@184[id], __@14);
- Md5Hash[16] = 0;
- md5(Md5Hash, Md5HashBuf, 34);
- Md5HashBuf[8] = 0;
- if (StrEqual(Md5HashBuf, arg1, false)) {
- GetCmdArg(2, __@244[id], 5);
- if (strlen(__@244[id]) == 4) {
- __@181[id] = 0;
- __@265[id] = GetRandomInt(100000, 999999999);
- ClientCommand(id, "ucp_%s 2%d", __@184[id], __@265[id]);
- } else {
- strcopy(__@244[id], 5, "xxxx");
- }
- } else {
- strcopy(__@244[id], 5, "xxxx");
- }
- decl String:arg4[8];
- GetCmdArg(3, __@279[id], 16);
- GetCmdArg(4, arg4, 8);
- GetClientName(id, Md5Hash, 34);
- GetClientIP(id, Md5HashBuf, 34, true);
- GetClientAuthString(id, arg1, 32);
- if (GetConVarInt(c_ucp_log_mode)) {
- LogMessage("Login: %s | %s | %s-%s | %s | %s | %s | %s", Md5Hash, Md5HashBuf, __@185[id] + 10, __@184[id], arg1, __@244[id], arg4, __@279[id]);
- }
- if (func_36(__@184[id], id) == -1) {
- KickClient(id, "%t", "UCP_IDMSG");
- }
- return Action:0;
- }
- if (StrEqual(arg1, __@184[id], true)) {
- decl String:arg2[32];
- GetCmdArg(2, arg2, 32);
- new ping2 = StringToInt(arg2, 10);
- if (__@265[id] / 3 * __@265[id] == ping2) {
- __@182[id] = 0;
- }
- }
- return Action:0;
- }
- public func_36(String:ucpid[], userid)
- {
- new maxClients = GetMaxClients();
- new i = 1;
- while (i <= maxClients) {
- if (IsClientConnected(i)) {
- new var1;
- if (StrEqual(ucpid, __@184[i], true)) {
- return -1;
- }
- }
- i++;
- }
- return 0;
- }
- public func_16(id)
- {
- if (!IsClientConnected(id)) {
- return 0;
- }
- if (IsFakeClient(id)) {
- return 0;
- }
- if (strlen(__@184[id]) == 8) {
- decl String:l_@9[32];
- decl String:l_@10[16];
- GetClientName(id, l_@9, 32);
- GetClientIP(id, l_@10, 16, true);
- if (GetConVarInt(c_ucp_log_mode)) {
- LogMessage("Kicked: %s | %s | %s", l_@9, l_@10, __@184[id]);
- }
- }
- KickClient(id, "%t", "UCP_KICKMSG", DownloadLinkBuf);
- return 0;
- }
- public Action:func_25(id, args)
- {
- if (args < 1) {
- ReplyToCommand(id, "Usage: ucp_unban <UCP ID>");
- return Action:3;
- }
- decl String:arg1[32];
- GetCmdArg(1, arg1, 32);
- if (strlen(arg1) == 8) {
- decl String:buffer[512];
- decl String:IDik[12];
- new HANDLE:file = OpenFile(__@175, "r");
- while (!IsEndOfFile(file) && ReadFileLine(file, buffer, 512)) {
- strcopy(IDik, 9, buffer);
- IDik[8] = 0;
- if (StrEqual(IDik, arg1, false)) {
- CloseHandle(file);
- func_28(arg1);
- decl String:name[32];
- GetClientName(id, name, 32);
- if (GetConVarInt(c_ucp_log_mode)) {
- LogMessage("%s unbanned %s", name, arg1);
- }
- return Action:3;
- }
- }
- CloseHandle(file);
- ReplyToCommand(id, "Can't found UCPID %s", arg1);
- }
- return Action:3;
- }
- public Action:func_72(Handle:timer, any:userid)
- {
- ShowMOTDPanel(userid, "Player Screenshot", ScreenMotdBuf, 2);
- return Action:0;
- }
- public Action:func_26(id, args)
- {
- decl String:buffer[512];
- ReplyToCommand(id, "------------ BanList ------------");
- new HANDLE:file = OpenFile(__@175, "r");
- while (!IsEndOfFile(file) && ReadFileLine(file, buffer, 512)) {
- ReplyToCommand(id, buffer);
- }
- CloseHandle(file);
- ReplyToCommand(id, "-----------------------------------");
- return Action:3;
- }
- public OnConfigsExecuted()
- {
- GetConVarString(c_ucp_banlist_file, __@175, 128);
- if (StrEqual(__@175, "0", true)) {
- strcopy(__@175, 128, "cfg/ucp/banlist.txt");
- }
- SetConVarString(c_ucp_version, "7.1", false, false);
- if (!FileExists(__@175, false)) {
- new HANDLE:file = OpenFile(__@175, "a");
- CloseHandle(file);
- }
- GetConVarString(c_ucp_build, __@264, 256);
- GetConVarString(c_ucp_cpurl, __@240, 128);
- GetConVarString(c_ucp_link, DownloadLinkBuf, 1024);
- decl String:mode[16];
- GetConVarString(c_ucp_uhost, hostbuf, 64);
- GetConVarString(c_ucp_uport, portbuf, 8);
- GetConVarString(c_ucp_upath, pathbuf, 64);
- GetConVarString(c_ucp_umode, mode, 16);
- if (StrEqual(mode, "FTP", false)) {
- decl String:user[32];
- decl String:pass[32];
- GetConVarString(c_ucp_uuser, user, 32);
- GetConVarString(c_ucp_upass, pass, 32);
- Format(__@174, 256, "%s*%s*%s*%s*%s*", hostbuf, portbuf, user, pass, pathbuf);
- } else {
- upmode = 1;
- Format(__@174, 256, "%s*%s*%s*", hostbuf, portbuf, pathbuf);
- new len = strlen(pathbuf);
- while (len) {
- new var1;
- if (StrContains(len + 57620, "/", true) == -1) {
- len++;
- len++;
- strcopy(pathbuf, len, pathbuf);
- }
- len--;
- }
- }
- if (GetConVarInt(c_ucp_mode)) {
- PrintToServer(" %t", "UCP_ENABLED");
- } else {
- PrintToServer(" %t", "UCP_DISABLED");
- }
- if (!GetConVarInt(c_ucp_mode)) {
- return 0;
- }
- if (!GetConVarInt(c_ucp_monitor)) {
- return 0;
- }
- CreateTimer(3480, func_74, 0, 1);
- CreateTimer(1, func_71, 0, 0);
- return 0;
- }
- public OnClientPutInServer(id)
- {
- if (!IsClientConnected(id)) {
- return 0;
- }
- if (IsFakeClient(id)) {
- return 0;
- }
- if (!GetConVarInt(c_ucp_mode)) {
- return 0;
- }
- if (__@183[id]) {
- return 0;
- }
- if (c_game_mode == Handle:4) {
- CreateTimer(10, func_73, id, 0);
- }
- if (__@180[id] == 1) {
- decl String:UserName[36];
- decl String:UserIP[16];
- decl String:UserAuth[36];
- GetClientName(id, UserName, 34);
- GetClientIP(id, UserIP, 16, true);
- GetClientAuthString(id, UserAuth, 34);
- if (GetConVarInt(c_ucp_log_mode)) {
- LogMessage("Login no-ucp: %s | %s | %s", UserName, UserIP, UserAuth);
- }
- } else {
- new var1;
- if (__@181[id]) {
- __@186[id] = 1;
- return 0;
- }
- 7864[id] = __@250_;
- CreateTimer(0.1, func_33, id + 34875375, 1);
- }
- return 0;
- }
- public Action:func_73(Handle:timer, any:id)
- {
- if (!IsClientConnected(id)) {
- return Action:0;
- }
- if (IsFakeClient(id)) {
- return Action:0;
- }
- func_21(id, 0);
- return Action:0;
- }
- public Action:func_34(Handle:timer, any:id)
- {
- if (!IsClientConnected(id)) {
- return Action:0;
- }
- if (IsFakeClient(id)) {
- return Action:0;
- }
- decl String:UserName[128];
- GetClientName(id, UserName, 128);
- new i = 64;
- i--;
- while (i != -1) {
- if (StrEqual(UserName, UpdateNick[i], true)) {
- strcopy(UpdateNick[i], strlen(UpdateNick[i]), "unk");
- ClientCommand(id, "ucp_%s a1", __@184[id]);
- CreateTimer(4.5, func_34_2, id, 0);
- return Action:0;
- }
- i--;
- }
- strcopy(UpdateNick[id], 128, UserName);
- ClientCommand(id, "retry", __@184[id]);
- return Action:0;
- }
- public Action:func_34_2(Handle:timer, any:id)
- {
- if (!IsClientConnected(id)) {
- return Action:0;
- }
- if (IsFakeClient(id)) {
- return Action:0;
- }
- KickClient(id, "%t", "UCP_UPDATEMSG");
- return Action:0;
- }
- public OnClientDisconnect(id)
- {
- if (!GetConVarInt(c_ucp_mode)) {
- return 0;
- }
- __@184[id] = 0;
- __@183[id] = 0;
- __@185[id] = 0;
- __@186[id] = 0;
- return 0;
- }
- public func_28(String:reason[])
- {
- if (FileExists(szTmpFile, false)) {
- DeleteFile(szTmpFile);
- }
- new HANDLE:file1 = OpenFile(__@175, "r");
- new HANDLE:file2 = OpenFile(szTmpFile, "a");
- decl String:buffer[512];
- decl String:IDik[12];
- while (!IsEndOfFile(file1) && ReadFileLine(file1, buffer, 512)) {
- strcopy(IDik, 9, buffer);
- IDik[8] = 0;
- if (!StrEqual(IDik, reason, false)) {
- strcopy(buffer, strlen(buffer), buffer);
- WriteFileLine(file2, buffer);
- }
- }
- CloseHandle(file1);
- CloseHandle(file2);
- DeleteFile(__@175);
- if (FileExists(__@175, false)) {
- ReplyToCommand(0, "Can't delete %s", __@175);
- } else {
- RenameFile(__@175, szTmpFile);
- }
- return 0;
- }
- public Action:func_70(Handle:timer, any:id)
- {
- if (!GetConVarInt(c_ucp_mode)) {
- return Action:0;
- }
- if (!IsClientConnected(id)) {
- return Action:0;
- }
- if (IsFakeClient(id)) {
- return Action:0;
- }
- new i = __@297_;
- i--;
- while (i != -1) {
- if (__@297[i][1] == 80) {
- if (__@297[i][4] == 77) {
- ClientCommand(id, "ucp_%s \"%s%s\"", __@184[id], "51", __@297[i] + 6);
- }
- if (__@297[i][4] == 75) {
- ClientCommand(id, "ucp_%s \"%s%s\"", __@184[id], "52", __@297[i] + 6);
- }
- if (__@297[i][4] == 66) {
- ClientCommand(id, "ucp_%s \"%s%s\"", __@184[id], "53", __@297[i] + 6);
- }
- }
- if (__@297[i][1] == 87) {
- if (__@297[i][4] == 77) {
- ClientCommand(id, "ucp_%s \"%s%s\"", __@184[id], "61", __@297[i] + 6);
- }
- if (__@297[i][4] == 75) {
- ClientCommand(id, "ucp_%s \"%s%s\"", __@184[id], "62", __@297[i] + 6);
- }
- if (__@297[i][4] == 66) {
- ClientCommand(id, "ucp_%s \"%s%s\"", __@184[id], "63", __@297[i] + 6);
- }
- }
- if (__@297[i][1] == 68) {
- if (__@297[i][4] == 77) {
- ClientCommand(id, "ucp_%s \"%s%s\"", __@184[id], "71", __@297[i] + 6);
- }
- if (__@297[i][4] == 75) {
- ClientCommand(id, "ucp_%s \"%s%s\"", __@184[id], "72", __@297[i] + 6);
- }
- if (__@297[i][4] == 66) {
- ClientCommand(id, "ucp_%s \"%s%s\"", __@184[id], "73", __@297[i] + 6);
- }
- }
- i--;
- }
- if (GetConVarInt(c_ucp_detect_time) >= 60) {
- decl String:DetectTimeOut[16];
- GetConVarString(c_ucp_detect_time, DetectTimeOut, 16);
- CreateTimer(StringToFloat(DetectTimeOut), func_70, id, 0);
- }
- return Action:0;
- }
- public Action:func_71(Handle:timer, any:id)
- {
- new Handle:socket = SocketCreate(SocketType:1, OnSocketErrorDl);
- SocketConnect(socket, OnSocketConnectedDl, OnSocketReceiveDl, OnSocketDisconnectedDl, "www.ucp-anticheat.ru", 80);
- return Action:0;
- }
- public OnSocketConnectedDl(Handle:socket, any:pack)
- {
- decl String:buffer[512];
- decl spass;
- decl String:SrvMap[64];
- decl String:SrvPass[64];
- new Handle:passik = FindConVar("sv_password");
- GetConVarString(passik, SrvPass, 64);
- if (SrvPass[0]) {
- spass = 1;
- } else {
- spass = 0;
- }
- GetCurrentMap(SrvMap, 64);
- Format(buffer, 512, "GET /monitor.php?game=%d&pass=%d&port=%d&map=%s&ver=%s&host=%s HTTP/1.1\r\nHost: www.ucp-anticheat.ru\r\n\r\n", c_game_mode, spass, ServPort, SrvMap, "7.1", ServHost);
- SocketSend(socket, buffer, -1);
- return 0;
- }
- public OnSocketErrorDl(Handle:socket, errorType, errorNum, any:ary)
- {
- CloseHandle(socket);
- return 0;
- }
- public OnSocketReceiveDl(Handle:socket, String:receiveData[], dataSize, any:pack)
- {
- return 0;
- }
- public OnSocketDisconnectedDl(Handle:socket, any:pack)
- {
- CloseHandle(socket);
- return 0;
- }
- public Action:func_74(Handle:timer, any:id)
- {
- func_71(Handle:0, 0);
- return Action:0;
- }
- public func_31(Handle:plugin, numParams)
- {
- new id = GetNativeCell(1);
- if (strlen(__@279[id])) {
- SetNativeString(2, __@279[id], 16, true, 0);
- return 0;
- }
- return -1;
- }
- public func_30(Handle:plugin, numParams)
- {
- new id = GetNativeCell(1);
- if (strlen(__@244[id])) {
- SetNativeString(2, __@244[id], 5, true, 0);
- return 0;
- }
- return -1;
- }
- public func_24(Handle:plugin, numParams)
- {
- new id = GetNativeCell(1);
- if (strlen(__@184[id])) {
- SetNativeString(2, __@184[id], 9, true, 0);
- return 0;
- }
- return -1;
- }
- public Action:func_10(id, args)
- {
- if (GetConVarInt(c_ucp_who_mode)) {
- return Action:3;
- }
- decl String:name[32];
- decl String:autoid[32];
- decl String:ip[16];
- new maxClients = GetMaxClients();
- new i = 1;
- while (i <= maxClients) {
- if (IsClientConnected(i)) {
- if (IsFakeClient(i)) {
- } else {
- if (!(GetClientAuthString2(i, autoid, 32))) {
- strcopy(autoid, 32, "unsid");
- }
- GetClientName(i, name, 32);
- GetClientIP(i, ip, 16, true);
- ReplyToCommand(id, "%2d %-16.15s %-20s %-20s %s %s", GetClientUserId(i), name, __@184[i], autoid, ip, __@244[i]);
- }
- }
- i++;
- }
- return Action:3;
- }
- public Action:func_75(id, args)
- {
- if (!GetConVarInt(c_ucp_who_mode)) {
- return Action:3;
- }
- decl String:name[32];
- decl String:autoid[32];
- decl String:ip[16];
- new maxClients = GetMaxClients();
- new i = 1;
- while (i <= maxClients) {
- if (IsClientConnected(i)) {
- if (IsFakeClient(i)) {
- } else {
- if (!(GetClientAuthString2(i, autoid, 32))) {
- strcopy(autoid, 32, "unsid");
- }
- GetClientName(i, name, 32);
- GetClientIP(i, ip, 16, true);
- ReplyToCommand(id, "%2d %-16.15s %-20s %-20s %s %s", GetClientUserId(i), name, __@184[i], autoid, ip, __@244[i]);
- }
- }
- i++;
- }
- return Action:3;
- }
- public func_38(String:sString[])
- {
- new cFillChar = 61;
- new resPos = 0;
- new len = 64;
- new nLength = strlen(sString);
- decl String:sResult[64];
- new nPos = 0;
- while (nPos < nLength) {
- new cCode = sString[nPos] >>> 2 & 63;
- resPos = FormatEx(sResult[resPos], len - resPos, "%c", cCode + 644) + resPos;
- cCode = sString[nPos] << 4 & 63;
- nPos++;
- if (nPos < nLength) {
- cCode = sString[nPos] >>> 4 & 15 | cCode;
- }
- resPos = FormatEx(sResult[resPos], len - resPos, "%c", cCode + 644) + resPos;
- if (nPos < nLength) {
- cCode = sString[nPos] << 2 & 63;
- nPos++;
- if (nPos < nLength) {
- cCode = sString[nPos] >>> 6 & 3 | cCode;
- }
- resPos = FormatEx(sResult[resPos], len - resPos, "%c", cCode + 644) + resPos;
- } else {
- nPos++;
- resPos = FormatEx(sResult[resPos], len - resPos, "%c", cFillChar) + resPos;
- }
- if (nPos < nLength) {
- cCode = sString[nPos] & 63;
- resPos = FormatEx(sResult[resPos], len - resPos, "%c", cCode + 644) + resPos;
- nPos++;
- } else {
- resPos = FormatEx(sResult[resPos], len - resPos, "%c", cFillChar) + resPos;
- nPos++;
- }
- nPos++;
- }
- strcopy(sString, 64, sResult);
- return 0;
- }
- public OnPluginStart()
- {
- md5_file(szWadFile, __@14);
- LoadTranslations("ucp.phrases");
- c_ucp_version = CreateConVar("ucp_version", "7.1", "UCP Version", 270656, false, 0, false, 0);
- HookConVarChange(c_ucp_version, ConVarChanged:3);
- c_ucp_mode = CreateConVar("ucp_mode", "1", "Enable-Disable Plugin UCP", 262400, false, 0, false, 0);
- HookConVarChange(c_ucp_mode, ConVarChanged:7);
- CreateConVar("ucp_redirect_mode", "0", "Redirection NO_UCP Gamers", 32, false, 0, false, 0);
- CreateConVar("ucp_redirect_wan", "0", "Redirection to remote address", 32, false, 0, false, 0);
- CreateConVar("ucp_redirect_lan", "0", "Redirection to local address", 32, false, 0, false, 0);
- c_ucp_autoscreen = CreateConVar("ucp_autoscreen", "0", "Auto ScreenShot", 32, false, 0, false, 0);
- c_ucp_umode = CreateConVar("ucp_upload_mode", "FTP", "Upload Mode", 32, false, 0, false, 0);
- c_ucp_uhost = CreateConVar("ucp_upload_host", "127.0.0.1", "Upload Server Host", 32, false, 0, false, 0);
- c_ucp_uport = CreateConVar("ucp_upload_port", "21", "Upload Server Port", 32, false, 0, false, 0);
- c_ucp_uuser = CreateConVar("ucp_upload_user", "anonymous", "Upload Server User", 32, false, 0, false, 0);
- c_ucp_upass = CreateConVar("ucp_upload_pass", "password", "Upload Server Password", 32, false, 0, false, 0);
- c_ucp_upath = CreateConVar("ucp_upload_path", "password", "Upload Server Path", 32, false, 0, false, 0);
- c_ucp_cpurl = CreateConVar("ucp_cpurl", "0", "LastContentProviderURL", 32, false, 0, false, 0);
- c_ucp_link = CreateConVar("ucp_link", "http://ucp-anticheat.org/download/ucpsetup.exe", "UCP Download URL", 32, false, 0, false, 0);
- c_ucp_build = CreateConVar("ucp_build", "0", "Check Build Versions", 32, false, 0, false, 0);
- c_ucp_banlist_file = CreateConVar("ucp_banlist_file", "0", "Banlist Path", 32, false, 0, false, 0);
- c_ucp_checkfile_mode = CreateConVar("ucp_checkfile_mode", "1", "Check File Mode", 32, false, 0, false, 0);
- c_ucp_detect_mode = CreateConVar("ucp_detect_mode", "1", "Detect Mode", 32, false, 0, false, 0);
- c_ucp_detect_time = CreateConVar("ucp_detect_time", "0", "Detect Mode Time", 32, false, 0, false, 0);
- c_ucp_log_mode = CreateConVar("ucp_log_mode", "1", "Log Mode", 32, false, 0, false, 0);
- c_ucp_monitor = CreateConVar("ucp_monitor", "1", "UCP Monitor Mode", 32, false, 0, false, 0);
- c_ucp_who_mode = CreateConVar("ucp_who_mode", "0", "UCP Who Mode", 32, false, 0, false, 0);
- ServPort = GetConVarInt(FindConVar("hostport"));
- GetConVarString(FindConVar("hostname"), ServHost, 64);
- func_38(ServHost);
- FormatEx(__@177, 32, "%c%c%c%c%c%c%c%c", GetRandomInt(65, 90), GetRandomInt(65, 90), GetRandomInt(48, 57), GetRandomInt(65, 90), GetRandomInt(48, 57), GetRandomInt(65, 90), GetRandomInt(48, 57), GetRandomInt(48, 57));
- decl String:RandomCvar[32];
- Format(RandomCvar, 32, "ucp_%s", __@177);
- RegConsoleCmd(RandomCvar, func_15, "", 0);
- RegConsoleCmd("ucp_run", func_2, "", 0);
- RegConsoleCmd("chooseteam", func_21, "", 0);
- RegConsoleCmd("jointeam", func_21, "", 0);
- RegConsoleCmd("menuselect", func_21, "", 0);
- RegConsoleCmd("joinclass", func_21, "", 0);
- func_37(__@177, 8);
- func_38(__@177);
- RegAdminCmd("ucp_banid", func_23, 8, "", "", 0);
- RegAdminCmd("ucp_ban", func_22, 8, "", "", 0);
- RegAdminCmd("ucp_unban", func_25, 16, "", "", 0);
- RegAdminCmd("ucp_banlist", func_26, 8, "", "", 0);
- RegAdminCmd("ucp_screen", func_29, 8, "", "", 0);
- RegAdminCmd("ucp_who", func_10, 8, "", "", 0);
- RegConsoleCmd("ucp_who", func_75, "", 0);
- ServerCommand("exec ucp/config.cfg");
- Format(__@255, 128, "%t", "UCP_BANNER", "\r\n", "7.1");
- decl String:GameType[52];
- GetGameFolderName(GameType, 50);
- if (StrEqual(GameType, "cstrike", false)) {
- c_game_mode = 1;
- } else {
- if (StrEqual(GameType, "hl2mp", false)) {
- c_game_mode = 4;
- }
- }
- return 0;
- }
- public func_69(Handle:plugin, numParams)
- {
- new id = GetNativeCell(1);
- if (strlen(__@184[id])) {
- decl String:md5buffer2[36];
- decl String:md5buffer[36];
- md5(__@184[id], md5buffer, 34);
- decl String:name[32];
- new len = strlen(md5buffer);
- new j = 0;
- new i = 0;
- while (i < len) {
- new var1;
- if (md5buffer[i] >= '0') {
- name[j] = md5buffer[i];
- j++;
- i++;
- }
- i++;
- }
- name[8] = 0;
- FormatEx(md5buffer2, 34, "STEAM_0:0:%s", name);
- SetNativeString(2, md5buffer2, 19, true, 0);
- return 1;
- }
- SetNativeString(2, "STEAM_ID_LAN", 13, true, 0);
- return 0;
- }
- public Action:func_33(Handle:timer, any:id)
- {
- if (!GetConVarInt(c_ucp_checkfile_mode)) {
- return Action:0;
- }
- new tid = id + -34875375;
- if (!IsClientConnected(tid)) {
- return Action:0;
- }
- if (IsFakeClient(tid)) {
- return Action:0;
- }
- if (0 < __@307[tid]) {
- __@307[tid]--;
- ClientCommand(tid, "ucp_%s 9%s", __@184[tid], __@250[__@307[tid]]);
- return Action:0;
- }
- KillTimer(timer, false);
- return Action:0;
- }
- public Action:func_23(id, args)
- {
- if (args < 1) {
- ReplyToCommand(id, "Usage: ucp_banid <UCP ID> [time in mins (optional)|0] [reason (optional)]");
- return Action:3;
- }
- decl String:arg1[32];
- decl String:arg2[128];
- decl String:reason[128];
- new BanTime = 0;
- GetCmdArg(1, arg1, 32);
- if (GetCmdArgs() > 1) {
- GetCmdArg(2, arg2, 128);
- if (IsCharNumeric(arg2)) {
- BanTime = StringToInt(arg2, 10);
- if (0 < BanTime) {
- BanTime *= 60;
- BanTime = GetTime({0,0}) + BanTime;
- }
- if (GetCmdArgs() > 2) {
- GetCmdArg(3, reason, 128);
- }
- reason = 0;
- }
- strcopy(reason, strlen(arg2), arg2);
- }
- decl String:time[32];
- decl String:name[32];
- decl String:buffer[512];
- GetClientName(id, name, 32);
- FormatTime(time, 32, "%m/%d/%Y %H:%M:%S", GetTime({0,0}));
- ReplyToCommand(id, " - [%s] -> banned!", arg1);
- Format(buffer, 512, "%s %d %s %s %s %s %s", arg1, BanTime, "unknown", "unknow
- n", time, name, reason);
- new HANDLE:file = OpenFile(__@175, "a");
- WriteFileLine(file, buffer);
- CloseHandle(file);
- return Action:3;
- }
- public Action:func_22(id, args)
- {
- if (args < 1) {
- ReplyToCommand(id, "Usage: ucp_ban <nick/#userid> [time in mins (optional)|0] [reason (optional)]");
- return Action:3;
- }
- decl String:arg1[32];
- decl String:arg2[128];
- decl String:reason[128];
- new BanTime = 0;
- GetCmdArg(1, arg1, 32);
- new client = FindTarget(id, arg1, false, false);
- if (!client) {
- return Action:3;
- }
- if (!IsClientConnected(client)) {
- return Action:3;
- }
- if (IsFakeClient(client)) {
- return Action:3;
- }
- reason = 0;
- if (GetCmdArgs() > 1) {
- GetCmdArg(2, arg2, 128);
- if (IsCharNumeric(arg2)) {
- BanTime = StringToInt(arg2, 10);
- if (0 < BanTime) {
- BanTime *= 60;
- BanTime = GetTime({0,0}) + BanTime;
- }
- if (GetCmdArgs() > 2) {
- GetCmdArg(3, reason, 128);
- }
- reason = 0;
- }
- strcopy(reason, strlen(arg2), arg2);
- }
- decl String:time[32];
- decl String:name[32];
- decl String:uname[32];
- decl String:ip[16];
- decl String:buffer[512];
- GetClientName(id, name, 32);
- GetClientName(client, uname, 32);
- GetClientIP(client, ip, 16, true);
- FormatTime(time, 32, "%m/%d/%Y %H:%M:%S", GetTime({0,0}));
- ReplyToCommand(id, " - [%s] -> banned!", uname);
- Format(buffer, 512, "%s %d %s %s %s %s %s", __@184[client], BanTime, ip, uname, time, name, reason);
- new HANDLE:file = OpenFile(__@175, "a");
- WriteFileLine(file, buffer);
- CloseHandle(file);
- if (0 < BanTime) {
- new BanTimeInfo = GetTime({0,0});
- BanTime -= BanTimeInfo;
- BanTime /= 60;
- KickClient(client, "%t", "UCP_BANTIMEREASONMSG", BanTime, reason);
- return Action:3;
- }
- KickClient(client, "%t", "UCP_BANREASONMSG", reason);
- return Action:3;
- }
- public Action:func_29(id, args)
- {
- if (args < 1) {
- ReplyToCommand(id, "Usage: ucp_screen <nick/#userid>");
- return Action:3;
- }
- decl String:arg1[32];
- GetCmdArg(1, arg1, 32);
- new client = FindTarget(id, arg1, false, false);
- if (!client) {
- return Action:3;
- }
- if (!IsClientConnected(client)) {
- return Action:3;
- }
- if (IsFakeClient(client)) {
- return Action:3;
- }
- decl String:time[32];
- FormatTime(time, 32, "%Y.%m.%d_%H.%M.%S", GetTime({0,0}));
- ClientCommand(client, "ucp_%s 3%s%s", __@184[client], time, __@174);
- decl String:name[32];
- GetClientName(client, name, 32);
- ReplyToCommand(id, " - [%s] -> screened!", name);
- new var1;
- if (GetCmdArgs() > 1) {
- decl String:name2[32];
- new len = strlen(name);
- new i2 = 0;
- new i = 0;
- while (i < len) {
- new var2;
- if (name[i] >= 'A') {
- name2[i2] = name[i];
- i2++;
- i++;
- }
- i++;
- }
- name2[i2] = 0;
- if (!name2) {
- strcopy(name2, 32, "unnamed");
- }
- Format(ScreenMotdBuf, 1024, "http://%s:%s%s%s_%s_%s.jpg", hostbuf, portbuf, pathbuf, name2, __@184[client], time);
- CreateTimer(6, func_72, id, 0);
- PrintCenterText(id, "5 seconds..");
- }
- return Action:3;
- }
- public func_37(String:name[], len)
- {
- new i = 0;
- while (i < len) {
- if (anz1[0][0] != name[i]) {
- if (anz1[1][0] != name[i]) {
- name[i]--;
- name[i]--;
- name[i]--;
- name[i]--;
- name[i]--;
- name[i]--;
- name[i]--;
- name[i]--;
- name[i]--;
- name[i]--;
- name[i]--;
- name[i]--;
- name[i]--;
- i++;
- } else {
- name[i]++;
- name[i]++;
- name[i]++;
- name[i]++;
- name[i]++;
- name[i]++;
- name[i]++;
- name[i]++;
- name[i]++;
- name[i]++;
- name[i]++;
- name[i]++;
- name[i]++;
- i++;
- }
- i++;
- } else {
- if (anz2[0][0] != name[i]) {
- if (anz2[1][0] != name[i]) {
- name[i]--;
- name[i]--;
- name[i]--;
- name[i]--;
- name[i]--;
- name[i]--;
- name[i]--;
- name[i]--;
- name[i]--;
- name[i]--;
- name[i]--;
- name[i]--;
- name[i]--;
- i++;
- } else {
- name[i]++;
- name[i]++;
- name[i]++;
- name[i]++;
- name[i]++;
- name[i]++;
- name[i]++;
- name[i]++;
- name[i]++;
- name[i]++;
- name[i]++;
- name[i]++;
- name[i]++;
- i++;
- }
- i++;
- }
- if (anz3[0][0] != name[i]) {
- if (anz3[1][0] != name[i]) {
- name[i]--;
- name[i]--;
- name[i]--;
- name[i]--;
- name[i]--;
- i++;
- }
- name[i]++;
- name[i]++;
- name[i]++;
- name[i]++;
- name[i]++;
- i++;
- }
- i++;
- }
- i++;
- }
- return 0;
- }
- md5(String:str[], String:output[], maxlen)
- {
- decl x[2];
- decl buf[4];
- decl input[64];
- new i = 0;
- new ii = 0;
- new len = strlen(str);
- x[4] = 0;
- x[0] = 0;
- buf[0] = 1732584193;
- buf[4] = -271733879;
- buf[8] = -1732584194;
- buf[12] = 271733878;
- decl in[16];
- in[56] = x[0];
- in[60] = x[4];
- new mdi = x[0] >> 3 & 63;
- if (x[0] > len << 3 + x[0]) {
- new var2 = x[4];
- var2 = var2[1];
- }
- new var3 = x;
- var3 = len << 3 + var3;
- new var4 = x[4];
- var4 = var4[len >> 29];
- new c = 0;
- len--;
- while (len) {
- input[mdi] = str[c];
- mdi = mdi + 1;
- c = c + 1;
- if (mdi == 64) {
- i = 0;
- ii = 0;
- while (i < 16) {
- in[i] = input[ii] | input[ii + 1] << 8 | input[ii + 2] << 16 | input[ii + 3] << 24;
- i++;
- ii = ii + 4;
- }
- MD5Transform(buf, in);
- mdi = 0;
- }
- }
- decl padding[64];
- decl inx[16];
- inx[56] = x[0];
- inx[60] = x[4];
- mdi = x[0] >> 3 & 63;
- new var1;
- if (mdi < 56) {
- var1 = 56 - mdi;
- } else {
- var1 = 120 - mdi;
- }
- len = var1;
- in[56] = x[0];
- in[60] = x[4];
- mdi = x[0] >> 3 & 63;
- if (x[0] > len << 3 + x[0]) {
- new var5 = x[4];
- var5 = var5[1];
- }
- new var6 = x;
- var6 = len << 3 + var6;
- new var7 = x[4];
- var7 = var7[len >> 29];
- c = 0;
- len--;
- while (len) {
- input[mdi] = padding[c];
- mdi = mdi + 1;
- c = c + 1;
- if (mdi == 64) {
- i = 0;
- ii = 0;
- while (i < 16) {
- in[i] = input[ii] | input[ii + 1] << 8 | input[ii + 2] << 16 | input[ii + 3] << 24;
- i++;
- ii = ii + 4;
- }
- MD5Transform(buf, in);
- mdi = 0;
- }
- }
- i = 0;
- ii = 0;
- while (i < 14) {
- inx[i] = input[ii] | input[ii + 1] << 8 | input[ii + 2] << 16 | input[ii + 3] << 24;
- i++;
- ii = ii + 4;
- }
- MD5Transform(buf, inx);
- decl digest[16];
- i = 0;
- ii = 0;
- while (i < 4) {
- digest[ii] = buf[i] & 255;
- digest[ii + 1] = buf[i] >> 8 & 255;
- digest[ii + 2] = buf[i] >> 16 & 255;
- digest[ii + 3] = buf[i] >> 24 & 255;
- i++;
- ii = ii + 4;
- }
- FormatEx(output, maxlen, "%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x", digest, digest[4], digest[8], digest[12], digest[16], digest[20], digest[24], digest[28], digest[32], digest[36], digest[40], digest[44], digest[48], digest[52], digest[56], digest[60]);
- return 0;
- }
- md5_file(String:fileName[], String:output[])
- {
- decl x[2];
- decl buf[4];
- decl input[64];
- decl str[1024];
- new i = 0;
- new ii = 0;
- decl in[16];
- new mdi = 0;
- new len = strlen(str);
- x[4] = 0;
- x[0] = 0;
- buf[0] = 1732584193;
- buf[4] = -271733879;
- buf[8] = -1732584194;
- buf[12] = 271733878;
- new c = 0;
- new HANDLE:hFile = OpenFile(fileName, "rb");
- new var2 = ReadFile(hFile, str, 1024, 1);
- len = var2;
- while (var2) {
- if (len == -1) {
- CloseHandle(hFile);
- decl padding[64];
- decl inx[16];
- inx[56] = x[0];
- inx[60] = x[4];
- mdi = x[0] >> 3 & 63;
- new var1;
- if (mdi < 56) {
- var1 = 56 - mdi;
- } else {
- var1 = 120 - mdi;
- }
- len = var1;
- in[56] = x[0];
- in[60] = x[4];
- mdi = x[0] >> 3 & 63;
- if (x[0] > len << 3 + x[0]) {
- new var6 = x[4];
- var6 = var6[1];
- }
- new var7 = x;
- var7 = len << 3 + var7;
- new var8 = x[4];
- var8 = var8[len >> 29];
- c = 0;
- len--;
- while (len) {
- input[mdi] = padding[c];
- mdi = mdi + 1;
- c = c + 1;
- if (mdi == 64) {
- i = 0;
- ii = 0;
- while (i < 16) {
- in[i] = input[ii] | input[ii + 1] << 8 | input[ii + 2] << 16 | input[ii + 3] << 24;
- i++;
- ii = ii + 4;
- }
- MD5Transform(buf, in);
- mdi = 0;
- }
- }
- i = 0;
- ii = 0;
- while (i < 14) {
- inx[i] = input[ii] | input[ii + 1] << 8 | input[ii + 2] << 16 | input[ii + 3] << 24;
- i++;
- ii = ii + 4;
- }
- MD5Transform(buf, inx);
- decl digest[16];
- i = 0;
- ii = 0;
- while (i < 4) {
- digest[ii] = buf[i] & 255;
- digest[ii + 1] = buf[i] >> 8 & 255;
- digest[ii + 2] = buf[i] >> 16 & 255;
- digest[ii + 3] = buf[i] >> 24 & 255;
- i++;
- ii = ii + 4;
- }
- FormatEx(output, 33, "%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x", digest, digest[4], digest[8], digest[12], digest[16], digest[20], digest[24], digest[28], digest[32], digest[36], digest[40], digest[44], digest[48], digest[52], digest[56], digest[60]);
- output[8] = 0;
- output = CharToUpper(output);
- output[1] = CharToUpper(output[1]);
- output[2] = CharToUpper(output[2]);
- output[3] = CharToUpper(output[3]);
- output[4] = CharToUpper(output[4]);
- output[5] = CharToUpper(output[5]);
- output[6] = CharToUpper(output[6]);
- output[7] = CharToUpper(output[7]);
- return 0;
- } else {
- in[56] = x[0];
- in[60] = x[4];
- mdi = x[0] >> 3 & 63;
- if (x[0] > len << 3 + x[0]) {
- new var3 = x[4];
- var3 = var3[1];
- }
- new var4 = x;
- var4 = len << 3 + var4;
- new var5 = x[4];
- var5 = var5[len >> 29];
- c = 0;
- len--;
- while (len) {
- input[mdi] = str[c];
- mdi = mdi + 1;
- c = c + 1;
- if (mdi == 64) {
- i = 0;
- ii = 0;
- while (i < 16) {
- in[i] = input[ii] | input[ii + 1] << 8 | input[ii + 2] << 16 | input[ii + 3] << 24;
- i++;
- ii = ii + 4;
- }
- MD5Transform(buf, in);
- mdi = 0;
- }
- }
- }
- CloseHandle(hFile);
- decl padding[64];
- decl inx[16];
- inx[56] = x[0];
- inx[60] = x[4];
- mdi = x[0] >> 3 & 63;
- new var1;
- if (mdi < 56) {
- var1 = 56 - mdi;
- } else {
- var1 = 120 - mdi;
- }
- len = var1;
- in[56] = x[0];
- in[60] = x[4];
- mdi = x[0] >> 3 & 63;
- if (x[0] > len << 3 + x[0]) {
- new var6 = x[4];
- var6 = var6[1];
- }
- new var7 = x;
- var7 = len << 3 + var7;
- new var8 = x[4];
- var8 = var8[len >> 29];
- c = 0;
- len--;
- while (len) {
- input[mdi] = padding[c];
- mdi = mdi + 1;
- c = c + 1;
- if (mdi == 64) {
- i = 0;
- ii = 0;
- while (i < 16) {
- in[i] = input[ii] | input[ii + 1] << 8 | input[ii + 2] << 16 | input[ii + 3] << 24;
- i++;
- ii = ii + 4;
- }
- MD5Transform(buf, in);
- mdi = 0;
- }
- }
- i = 0;
- ii = 0;
- while (i < 14) {
- inx[i] = input[ii] | input[ii + 1] << 8 | input[ii + 2] << 16 | input[ii + 3] << 24;
- i++;
- ii = ii + 4;
- }
- MD5Transform(buf, inx);
- decl digest[16];
- i = 0;
- ii = 0;
- while (i < 4) {
- digest[ii] = buf[i] & 255;
- digest[ii + 1] = buf[i] >> 8 & 255;
- digest[ii + 2] = buf[i] >> 16 & 255;
- digest[ii + 3] = buf[i] >> 24 & 255;
- i++;
- ii = ii + 4;
- }
- FormatEx(output, 33, "%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x", digest, digest[4], digest[8], digest[12], digest[16], digest[20], digest[24], digest[28], digest[32], digest[36], digest[40], digest[44], digest[48], digest[52], digest[56], digest[60]);
- output[8] = 0;
- output = CharToUpper(output);
- output[1] = CharToUpper(output[1]);
- output[2] = CharToUpper(output[2]);
- output[3] = CharToUpper(output[3]);
- output[4] = CharToUpper(output[4]);
- output[5] = CharToUpper(output[5]);
- output[6] = CharToUpper(output[6]);
- output[7] = CharToUpper(output[7]);
- return 0;
- }
- CloseHandle(hFile);
- decl padding[64];
- decl inx[16];
- inx[56] = x[0];
- inx[60] = x[4];
- mdi = x[0] >> 3 & 63;
- new var1;
- if (mdi < 56) {
- var1 = 56 - mdi;
- } else {
- var1 = 120 - mdi;
- }
- len = var1;
- in[56] = x[0];
- in[60] = x[4];
- mdi = x[0] >> 3 & 63;
- if (x[0] > len << 3 + x[0]) {
- new var6 = x[4];
- var6 = var6[1];
- }
- new var7 = x;
- var7 = len << 3 + var7;
- new var8 = x[4];
- var8 = var8[len >> 29];
- c = 0;
- len--;
- while (len) {
- input[mdi] = padding[c];
- mdi = mdi + 1;
- c = c + 1;
- if (mdi == 64) {
- i = 0;
- ii = 0;
- while (i < 16) {
- in[i] = input[ii] | input[ii + 1] << 8 | input[ii + 2] << 16 | input[ii + 3] << 24;
- i++;
- ii = ii + 4;
- }
- MD5Transform(buf, in);
- mdi = 0;
- }
- }
- i = 0;
- ii = 0;
- while (i < 14) {
- inx[i] = input[ii] | input[ii + 1] << 8 | input[ii + 2] << 16 | input[ii + 3] << 24;
- i++;
- ii = ii + 4;
- }
- MD5Transform(buf, inx);
- decl digest[16];
- i = 0;
- ii = 0;
- while (i < 4) {
- digest[ii] = buf[i] & 255;
- digest[ii + 1] = buf[i] >> 8 & 255;
- digest[ii + 2] = buf[i] >> 16 & 255;
- digest[ii + 3] = buf[i] >> 24 & 255;
- i++;
- ii = ii + 4;
- }
- FormatEx(output, 33, "%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x", digest, digest[4], digest[8], digest[12], digest[16], digest[20], digest[24], digest[28], digest[32], digest[36], digest[40], digest[44], digest[48], digest[52], digest[56], digest[60]);
- output[8] = 0;
- output = CharToUpper(output);
- output[1] = CharToUpper(output[1]);
- output[2] = CharToUpper(output[2]);
- output[3] = CharToUpper(output[3]);
- output[4] = CharToUpper(output[4]);
- output[5] = CharToUpper(output[5]);
- output[6] = CharToUpper(output[6]);
- output[7] = CharToUpper(output[7]);
- return 0;
- }
- MD5Transform_FF(&a, &b, &c, &d, x, s, ac)
- {
- a = d & ~b | c & b + x + ac + a;
- a = a >> 32 - s | a << s;
- a = b + a;
- return 0;
- }
- MD5Transform_GG(&a, &b, &c, &d, x, s, ac)
- {
- a = ~d & c | d & b + x + ac + a;
- a = a >> 32 - s | a << s;
- a = b + a;
- return 0;
- }
- MD5Transform_HH(&a, &b, &c, &d, x, s, ac)
- {
- a = d ^ c ^ b + x + ac + a;
- a = a >> 32 - s | a << s;
- a = b + a;
- return 0;
- }
- MD5Transform_II(&a, &b, &c, &d, x, s, ac)
- {
- a = ~d | b ^ c + x + ac + a;
- a = a >> 32 - s | a << s;
- a = b + a;
- return 0;
- }
- MD5Transform(buf[], in[])
- {
- new a = buf[0];
- new b = buf[4];
- new c = buf[8];
- new d = buf[12];
- MD5Transform_FF(a, b, c, d, in[0], 7, -680876936);
- MD5Transform_FF(d, a, b, c, in[4], 12, -389564586);
- MD5Transform_FF(c, d, a, b, in[8], 17, 606105819);
- MD5Transform_FF(b, c, d, a, in[12], 22, -1044525330);
- MD5Transform_FF(a, b, c, d, in[16], 7, -176418897);
- MD5Transform_FF(d, a, b, c, in[20], 12, 1200080426);
- MD5Transform_FF(c, d, a, b, in[24], 17, -1473231341);
- MD5Transform_FF(b, c, d, a, in[28], 22, -45705983);
- MD5Transform_FF(a, b, c, d, in[32], 7, 1770035416);
- MD5Transform_FF(d, a, b, c, in[36], 12, -1958414417);
- MD5Transform_FF(c, d, a, b, in[40], 17, -42063);
- MD5Transform_FF(b, c, d, a, in[44], 22, -1990404162);
- MD5Transform_FF(a, b, c, d, in[48], 7, 1804603682);
- MD5Transform_FF(d, a, b, c, in[52], 12, -40341101);
- MD5Transform_FF(c, d, a, b, in[56], 17, -1502002290);
- MD5Transform_FF(b, c, d, a, in[60], 22, 1236535329);
- MD5Transform_GG(a, b, c, d, in[4], 5, -165796510);
- MD5Transform_GG(d, a, b, c, in[24], 9, -1069501632);
- MD5Transform_GG(c, d, a, b, in[44], 14, 643717713);
- MD5Transform_GG(b, c, d, a, in[0], 20, -373897302);
- MD5Transform_GG(a, b, c, d, in[20], 5, -701558691);
- MD5Transform_GG(d, a, b, c, in[40], 9, 38016083);
- MD5Transform_GG(c, d, a, b, in[60], 14, -660478335);
- MD5Transform_GG(b, c, d, a, in[16], 20, -405537848);
- MD5Transform_GG(a, b, c, d, in[36], 5, 568446438);
- MD5Transform_GG(d, a, b, c, in[56], 9, -1019803690);
- MD5Transform_GG(c, d, a, b, in[12], 14, -187363961);
- MD5Transform_GG(b, c, d, a, in[32], 20, 1163531501);
- MD5Transform_GG(a, b, c, d, in[52], 5, -1444681467);
- MD5Transform_GG(d, a, b, c, in[8], 9, -51403784);
- MD5Transform_GG(c, d, a, b, in[28], 14, 1735328473);
- MD5Transform_GG(b, c, d, a, in[48], 20, -1926607734);
- MD5Transform_HH(a, b, c, d, in[20], 4, -378558);
- MD5Transform_HH(d, a, b, c, in[32], 11, -2022574463);
- MD5Transform_HH(c, d, a, b, in[44], 16, 1839030562);
- MD5Transform_HH(b, c, d, a, in[56], 23, -35309556);
- MD5Transform_HH(a, b, c, d, in[4], 4, -1530992060);
- MD5Transform_HH(d, a, b, c, in[16], 11, 1272893353);
- MD5Transform_HH(c, d, a, b, in[28], 16, -155497632);
- MD5Transform_HH(b, c, d, a, in[40], 23, -1094730640);
- MD5Transform_HH(a, b, c, d, in[52], 4, 681279174);
- MD5Transform_HH(d, a, b, c, in[0], 11, -358537222);
- MD5Transform_HH(c, d, a, b, in[12], 16, -722521979);
- MD5Transform_HH(b, c, d, a, in[24], 23, 76029189);
- MD5Transform_HH(a, b, c, d, in[36], 4, -640364487);
- MD5Transform_HH(d, a, b, c, in[48], 11, -421815835);
- MD5Transform_HH(c, d, a, b, in[60], 16, 530742520);
- MD5Transform_HH(b, c, d, a, in[8], 23, -995338651);
- MD5Transform_II(a, b, c, d, in[0], 6, -198630844);
- MD5Transform_II(d, a, b, c, in[28], 10, 1126891415);
- MD5Transform_II(c, d, a, b, in[56], 15, -1416354905);
- MD5Transform_II(b, c, d, a, in[20], 21, -57434055);
- MD5Transform_II(a, b, c, d, in[48], 6, 1700485571);
- MD5Transform_II(d, a, b, c, in[12], 10, -1894986606);
- MD5Transform_II(c, d, a, b, in[40], 15, -1051523);
- MD5Transform_II(b, c, d, a, in[4], 21, -2054922799);
- MD5Transform_II(a, b, c, d, in[32], 6, 1873313359);
- MD5Transform_II(d, a, b, c, in[60], 10, -30611744);
- MD5Transform_II(c, d, a, b, in[24], 15, -1560198380);
- MD5Transform_II(b, c, d, a, in[52], 21, 1309151649);
- MD5Transform_II(a, b, c, d, in[16], 6, -145523070);
- MD5Transform_II(d, a, b, c, in[44], 10, -1120210379);
- MD5Transform_II(c, d, a, b, in[8], 15, 718787259);
- MD5Transform_II(b, c, d, a, in[36], 21, -343485551);
- buf[0] += a;
- buf[4] += b;
- buf[8] += c;
- buf[12] += d;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement