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 = 180;
- new Extension:__ext_cstrike = 224;
- new String:xbox_autothrottleValue[256][64];
- new Handle:sprotect_site;
- new Handle:g_hDb;
- public Plugin:myinfo =
- {
- name = "SteamID Protect System",
- description = "Protect SteamID from hacking",
- author = "igodsewer and S. Yakupov | Original plugin by SemJeF",
- version = "1.0b",
- url = "http://alliedmods.net"
- };
- public __ext_core_SetNTVOptional()
- {
- MarkNativeAsOptional("GetFeatureStatus");
- MarkNativeAsOptional("RequireFeature");
- MarkNativeAsOptional("AddCommandListener");
- MarkNativeAsOptional("RemoveCommandListener");
- VerifyCoreVersion();
- return 0;
- }
- bool:StrEqual(String:str1[], String:str2[], bool:caseSensitive)
- {
- return strcmp(str1, str2, caseSensitive) == 0;
- }
- public OnPluginStart()
- {
- RegConsoleCmd("secure", Command_Protect, "", 0);
- CreateConVar("sm_sprotect_version", "1.0", "", 0, false, 0, false, 0);
- sprotect_site = CreateConVar("sm_sprotect_site", "http://yoursite.net/", "Link to password retrieve script", 262144, false, 0, false, 0);
- db_setupDatabase();
- AutoExecConfig(true, "plugin_protect", "sourcemod");
- return 0;
- }
- public Action:Command_Protect(client, args)
- {
- if (args != 2)
- {
- PrintToChat(client, "%s Errors in input! Example: /secure \"pass\" \"secret phrase\"", "[SPS]");
- return Action:3;
- }
- decl String:szSteamId[32];
- GetClientAuthString(client, szSteamId, 32);
- decl String:query[256];
- Format(query, 255, "SELECT pass FROM protect WHERE steamid ='%s'", szSteamId);
- new Handle:hquery = SQL_Query(g_hDb, query, -1);
- new var1;
- if (hquery)
- {
- PrintToChat(client, "%s You are already registered!", "[SPS]");
- return Action:3;
- }
- CloseHandle(hquery);
- decl String:newpass[256];
- decl String:kod[256];
- decl String:Safenewpass5[256];
- decl String:Safekod5[256];
- GetCmdArg(1, newpass, 255);
- GetCmdArg(2, kod, 255);
- decl String:Safekod[512];
- SQL_EscapeString(g_hDb, kod, Safekod, 511, 0);
- decl String:Safenewpass[512];
- SQL_EscapeString(g_hDb, newpass, Safenewpass, 511, 0);
- MD5String(Safenewpass, Safenewpass5, 255);
- MD5String(Safekod, Safekod5, 255);
- Format(query, 255, "INSERT INTO protect (steamid, pass, kod) VALUES('%s', '%s', '%s');", szSteamId, Safenewpass5, Safekod5);
- SQL_TQuery(g_hDb, SQLTCallback:9, query, any:0, DBPriority:1);
- decl String:SiteStr[256];
- GetConVarString(sprotect_site, SiteStr, 256);
- PrintToChat(client, "%s Your SteamID sucessfully secured! Password: %s", "[SPS]", newpass, kod);
- PrintToChat(client, "%s Don't forget to type in console xbox_autothrottle \"%s\" ", "[SPS]", newpass);
- PrintToChat(client, "%s Enjoy! Password retrive link: %s", "[SPS]", SiteStr);
- return Action:3;
- }
- public db_setupDatabase()
- {
- decl String:szError[256];
- g_hDb = SQL_Connect("Protect", false, szError, 255);
- if (g_hDb)
- {
- db_createTables();
- return 0;
- }
- LogError("[Protect] Unable to connect to database (%s)", szError);
- PrintToServer("[Protect] Unable to connect to database");
- return 0;
- }
- public db_createTables()
- {
- SQL_LockDatabase(g_hDb);
- SQL_FastQuery(g_hDb, "CREATE TABLE IF NOT EXISTS protect (steamid VARCHAR(32) PRIMARY KEY, pass VARCHAR(128), kod VARCHAR(128));", -1);
- SQL_UnlockDatabase(g_hDb);
- return 0;
- }
- public SQL_CheckCallback(Handle:owner, Handle:hndl, String:error[], data)
- {
- if (!hndl)
- {
- LogError("%s Error inserting into database (%s)", "[SPS]", error);
- }
- return 0;
- }
- public OnClientPutInServer(client)
- {
- QueryClientConVar(client, "xbox_autothrottle", ConVarQueryFinished:1, client);
- return 0;
- }
- public ClientConVar(QueryCookie:cookie, client, ConVarQueryResult:result, String:cvarName[], String:cvarValue[])
- {
- strcopy(xbox_autothrottleValue[client][0][0], 255, cvarValue);
- db_selectPlayer(client);
- return 0;
- }
- public db_selectPlayer(client)
- {
- decl String:szQuery[256];
- decl String:szSteamId[32];
- GetClientAuthString(client, szSteamId, 32);
- Format(szQuery, 255, "SELECT pass FROM protect WHERE steamid ='%s'", szSteamId);
- SQL_TQuery(g_hDb, SQLTCallback:11, szQuery, client, DBPriority:1);
- return 0;
- }
- public SQL_SelectPlayerCallback(Handle:owner, Handle:hndl, String:error[], data)
- {
- if (hndl)
- {
- decl String:sValue[256];
- new client = data;
- decl String:xbox_autothrottleValue5[256];
- new var1;
- if (SQL_HasResultSet(hndl))
- {
- SQL_FetchString(hndl, 0, sValue, 256, 0);
- MD5String(xbox_autothrottleValue[client][0][0], xbox_autothrottleValue5[client], 256);
- if (StrEqual(sValue, xbox_autothrottleValue5[client], false))
- {
- PrintToChat(client, "%s Вы прошли авторизацию!", "[SPS]");
- }
- else
- {
- KickHim(client);
- }
- }
- return 0;
- }
- else
- {
- LogError("[%s Error loading player (%s)", "[SPS]", error);
- }
- return 0;
- }
- KickHim(client)
- {
- decl String:SiteStr[256];
- GetConVarString(sprotect_site, SiteStr, 256);
- KickClient(client, "%s This SteamID is secured. If you forgot password follow this link: %s", "[SPS]", SiteStr);
- return 0;
- }
- MD5String(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])
- {
- x[4] += 1;
- }
- x[0] = len << 3 + x[0];
- new var2 = x[4];
- var2 = len >> 29 + var2;
- new c = 0;
- len--;
- while (len)
- {
- input[mdi] = str[c];
- mdi += 1;
- 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 += 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])
- {
- x[4] += 1;
- }
- x[0] = len << 3 + x[0];
- new var3 = x[4];
- var3 = len >> 29 + var3;
- c = 0;
- len--;
- while (len)
- {
- input[mdi] = padding[c];
- mdi += 1;
- 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 += 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 += 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 += 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;
- }
- 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);
- new var1 = buf;
- var1[0] = var1[0] + a;
- buf[4] += b;
- buf[8] += c;
- buf[12] += d;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement