From b0747fc39fa68e2af53018c09803af30b5a4489a Mon Sep 17 00:00:00 2001 From: craftablescience Date: Mon, 15 Jul 2024 03:39:25 -0400 Subject: [PATCH] chore(vicepp): add more known encryption codes --- include/vicepp/vicepp.h | 33 ++++++++++++++++++++----------- lang/c/include/viceppc/vicepp.h | 34 +++++++++++++++++++++----------- lang/csharp/src/vicepp/vicepp.cs | 32 +++++++++++++++++++----------- test/vicepp.cpp | 4 ++-- 4 files changed, 67 insertions(+), 36 deletions(-) diff --git a/include/vicepp/vicepp.h b/include/vicepp/vicepp.h index da47f63a8..5e0d667d1 100644 --- a/include/vicepp/vicepp.h +++ b/include/vicepp/vicepp.h @@ -8,25 +8,36 @@ namespace vicepp { // https://developer.valvesoftware.com/wiki/ICE +// https://wiki.alliedmods.net/Vice_keys namespace KnownCodes { constexpr std::string_view DEFAULT = "x9Ke0BY7"; -constexpr std::string_view HL2DM = DEFAULT; -constexpr std::string_view CSS = "d7NSuLq2"; -constexpr std::string_view CSGO = CSS; -constexpr std::string_view DODS = "Wl0u5B3F"; -constexpr std::string_view TF2 = "E2NcUkG2"; -constexpr std::string_view TF2_ITEMS = "A5fSXbf7"; -constexpr std::string_view L4D2 = "SDhfi878"; -constexpr std::string_view THE_SHIP = "eb3A4m79"; + constexpr std::string_view CONTAGION_WEAPONS = "fUk0fF69"; constexpr std::string_view CONTAGION_SCRIPTS = "5!rrFz6p"; -constexpr std::string_view ZPS = "5R0ni0pZ"; +constexpr std::string_view COUNTER_STRIKE_SOURCE = "d7NSuLq2"; +constexpr std::string_view COUNTER_STRIKE_GLOBAL_OFFENSIVE = COUNTER_STRIKE_SOURCE; +constexpr std::string_view COUNTER_STRIKE_2 = COUNTER_STRIKE_GLOBAL_OFFENSIVE; +constexpr std::string_view COUNTER_STRIKE_PROMOD = "H1aRQ0n1"; +constexpr std::string_view DAY_OF_DEFEAT_SOURCE = "Wl0u5B3F"; +constexpr std::string_view DYSTOPIA_1_2 = "pH3apO8w"; +constexpr std::string_view DYSTOPIA_1_3 = "G8stUh3F"; +constexpr std::string_view GOLDEN_EYE_SOURCE = "Gr3naDes"; +constexpr std::string_view HALF_LIFE_2_CTF = "R1dj3axP"; +constexpr std::string_view HALF_LIFE_2_DM = DEFAULT; +constexpr std::string_view INSURGENCY = "DrA5e3EB"; +constexpr std::string_view LEFT_4_DEAD_2 = "SDhfi878"; +constexpr std::string_view NO_MORE_ROOM_IN_HELL = "lREeeapA"; +constexpr std::string_view NUCLEAR_DAWN = "TA+*veh9"; +constexpr std::string_view TEAM_FORTRESS_2 = "E2NcUkG2"; +constexpr std::string_view TEAM_FORTRESS_2_ITEMS = "A5fSXbf7"; +constexpr std::string_view THE_SHIP = "eb3A4m79"; +constexpr std::string_view ZOMBIE_PANIC_SOURCE = "5R0ni0pZ"; } // namespace KnownCodes -[[nodiscard]] std::vector encrypt(std::span data, std::string_view code); +[[nodiscard]] std::vector encrypt(std::span data, std::string_view code = KnownCodes::DEFAULT); -[[nodiscard]] std::vector decrypt(std::span data, std::string_view code); +[[nodiscard]] std::vector decrypt(std::span data, std::string_view code = KnownCodes::DEFAULT); } // namespace vicepp diff --git a/lang/c/include/viceppc/vicepp.h b/lang/c/include/viceppc/vicepp.h index e00bfce18..37b5bc1d9 100644 --- a/lang/c/include/viceppc/vicepp.h +++ b/lang/c/include/viceppc/vicepp.h @@ -3,18 +3,28 @@ #include #include -#define VICEPP_KNOWN_CODES_DEFAULT "x9Ke0BY7" -#define VICEPP_KNOWN_CODES_HL2DM VICEPP_KNOWN_CODES_DEFAULT -#define VICEPP_KNOWN_CODES_CSS "d7NSuLq2" -#define VICEPP_KNOWN_CODES_CSGO VICEPP_KNOWN_CODES_CSS -#define VICEPP_KNOWN_CODES_DODS "Wl0u5B3F" -#define VICEPP_KNOWN_CODES_TF2 "E2NcUkG2" -#define VICEPP_KNOWN_CODES_TF2_ITEMS "A5fSXbf7" -#define VICEPP_KNOWN_CODES_L4D2 "SDhfi878" -#define VICEPP_KNOWN_CODES_THE_SHIP "eb3A4m79" -#define VICEPP_KNOWN_CODES_CONTAGION_WEAPONS "fUk0fF69" -#define VICEPP_KNOWN_CODES_CONTAGION_SCRIPTS "5!rrFz6p" -#define VICEPP_KNOWN_CODES_ZPS "5R0ni0pZ" +#define VICEPP_KNOWN_CODES_DEFAULT "x9Ke0BY7"; + +#define VICEPP_KNOWN_CODES_CONTAGION_WEAPONS "fUk0fF69" +#define VICEPP_KNOWN_CODES_CONTAGION_SCRIPTS "5!rrFz6p" +#define VICEPP_KNOWN_CODES_COUNTER_STRIKE_SOURCE "d7NSuLq2" +#define VICEPP_KNOWN_CODES_COUNTER_STRIKE_GLOBAL_OFFENSIVE VICEPP_KNOWN_CODES_COUNTER_STRIKE_SOURCE +#define VICEPP_KNOWN_CODES_COUNTER_STRIKE_2 VICEPP_KNOWN_CODES_COUNTER_STRIKE_GLOBAL_OFFENSIVE +#define VICEPP_KNOWN_CODES_COUNTER_STRIKE_PROMOD "H1aRQ0n1" +#define VICEPP_KNOWN_CODES_DAY_OF_DEFEAT_SOURCE "Wl0u5B3F" +#define VICEPP_KNOWN_CODES_DYSTOPIA_1_2 "pH3apO8w" +#define VICEPP_KNOWN_CODES_DYSTOPIA_1_3 "G8stUh3F" +#define VICEPP_KNOWN_CODES_GOLDEN_EYE_SOURCE "Gr3naDes" +#define VICEPP_KNOWN_CODES_HALF_LIFE_2_CTF "R1dj3axP" +#define VICEPP_KNOWN_CODES_HALF_LIFE_2_DM VICEPP_KNOWN_CODES_DEFAULT +#define VICEPP_KNOWN_CODES_INSURGENCY "DrA5e3EB" +#define VICEPP_KNOWN_CODES_LEFT_4_DEAD_2 "SDhfi878" +#define VICEPP_KNOWN_CODES_NO_MORE_ROOM_IN_HELL "lREeeapA" +#define VICEPP_KNOWN_CODES_NUCLEAR_DAWN "TA+*veh9" +#define VICEPP_KNOWN_CODES_TEAM_FORTRESS_2 "E2NcUkG2" +#define VICEPP_KNOWN_CODES_TEAM_FORTRESS_2_ITEMS "A5fSXbf7" +#define VICEPP_KNOWN_CODES_THE_SHIP "eb3A4m79" +#define VICEPP_KNOWN_CODES_ZOMBIE_PANIC_SOURCE "5R0ni0pZ" // REQUIRES MANUAL FREE: sourcepp_buffer_free SOURCEPP_API sourcepp_buffer_t vicepp_encrypt(const unsigned char* buffer, size_t bufferLen, const char* code); diff --git a/lang/csharp/src/vicepp/vicepp.cs b/lang/csharp/src/vicepp/vicepp.cs index cf8741c96..39bf03f69 100644 --- a/lang/csharp/src/vicepp/vicepp.cs +++ b/lang/csharp/src/vicepp/vicepp.cs @@ -16,22 +16,32 @@ internal static unsafe partial class Extern public static class KnownCodes { public const string DEFAULT = "x9Ke0BY7"; - public const string HL2DM = DEFAULT; - public const string CSS = "d7NSuLq2"; - public const string CSGO = CSS; - public const string DODS = "Wl0u5B3F"; - public const string TF2 = "E2NcUkG2"; - public const string TF2_ITEMS = "A5fSXbf7"; - public const string L4D2 = "SDhfi878"; - public const string THE_SHIP = "eb3A4m79"; + public const string CONTAGION_WEAPONS = "fUk0fF69"; public const string CONTAGION_SCRIPTS = "5!rrFz6p"; - public const string ZPS = "5R0ni0pZ"; + public const string COUNTER_STRIKE_SOURCE = "d7NSuLq2"; + public const string COUNTER_STRIKE_GLOBAL_OFFENSIVE = COUNTER_STRIKE_SOURCE; + public const string COUNTER_STRIKE_2 = COUNTER_STRIKE_GLOBAL_OFFENSIVE; + public const string COUNTER_STRIKE_PROMOD = "H1aRQ0n1"; + public const string DAY_OF_DEFEAT_SOURCE = "Wl0u5B3F"; + public const string DYSTOPIA_1_2 = "pH3apO8w"; + public const string DYSTOPIA_1_3 = "G8stUh3F"; + public const string GOLDEN_EYE_SOURCE = "Gr3naDes"; + public const string HALF_LIFE_2_CTF = "R1dj3axP"; + public const string HALF_LIFE_2_DM = DEFAULT; + public const string INSURGENCY = "DrA5e3EB"; + public const string LEFT_4_DEAD_2 = "SDhfi878"; + public const string NO_MORE_ROOM_IN_HELL = "lREeeapA"; + public const string NUCLEAR_DAWN = "TA+*veh9"; + public const string TEAM_FORTRESS_2 = "E2NcUkG2"; + public const string TEAM_FORTRESS_2_ITEMS = "A5fSXbf7"; + public const string THE_SHIP = "eb3A4m79"; + public const string ZOMBIE_PANIC_SOURCE = "5R0ni0pZ"; } public static class VICE { - public static byte[] Decrypt(byte[] buffer, string code) + public static byte[] Decrypt(byte[] buffer, string code = KnownCodes.DEFAULT) { unsafe { @@ -43,7 +53,7 @@ public static byte[] Decrypt(byte[] buffer, string code) } } - public static byte[] Decrypt(IEnumerable buffer, string code) + public static byte[] Decrypt(IEnumerable buffer, string code = KnownCodes.DEFAULT) { unsafe { diff --git a/test/vicepp.cpp b/test/vicepp.cpp index 1dcee5387..79049a5d1 100644 --- a/test/vicepp.cpp +++ b/test/vicepp.cpp @@ -10,7 +10,7 @@ TEST(vicepp, decrypt) { auto encrypted = fs::readFileBuffer(ASSET_ROOT "vicepp/weapon_pistol.enc"); auto decrypted = fs::readFileBuffer(ASSET_ROOT "vicepp/weapon_pistol.dec"); - auto test = decrypt(encrypted, KnownCodes::HL2DM); + auto test = decrypt(encrypted); ASSERT_EQ(test.size(), decrypted.size()); for (int i = 0; i < test.size(); i++) { @@ -22,7 +22,7 @@ TEST(vicepp, encrypt) { auto encrypted = fs::readFileBuffer(ASSET_ROOT "vicepp/weapon_pistol.enc"); auto decrypted = fs::readFileBuffer(ASSET_ROOT "vicepp/weapon_pistol.dec"); - auto test = encrypt(decrypted, KnownCodes::HL2DM); + auto test = encrypt(decrypted); ASSERT_EQ(test.size(), encrypted.size()); for (int i = 0; i < test.size(); i++) {