From 077ba9986d4e8b784968f739a577395597fb5f9d Mon Sep 17 00:00:00 2001 From: Dethrace Labs <78985374+dethrace-labs@users.noreply.github.com> Date: Mon, 8 Sep 2025 10:19:08 +1200 Subject: [PATCH] DecodeLine2 matching --- src/DETHRACE/common/utility.c | 56 ++++++++++++++--------------------- 1 file changed, 22 insertions(+), 34 deletions(-) diff --git a/src/DETHRACE/common/utility.c b/src/DETHRACE/common/utility.c index 7e8084df..15e312dd 100644 --- a/src/DETHRACE/common/utility.c +++ b/src/DETHRACE/common/utility.c @@ -1429,52 +1429,40 @@ void DecodeLine2(char* pS) { len = strlen(pS); key = (char*)gLong_key; - while (len > 0 && (pS[len - 1] == '\r' || pS[len - 1] == '\n')) { + while (len && pS[len - 1] == '\r' || pS[len - 1] == '\n') { + pS[len - 1] = 0; len--; - pS[len] = '\0'; } seed = len % 16; - for (i = 0; i < len; i++) { - c = pS[i]; - if (i >= 2) { - if (pS[i - 1] == '/' && pS[i - 2] == '/') { - key = (char*)gOther_long_key; - } - } + for (i = 0; i < len; ++i) { if (gEncryption_method == 1) { - if (c == '\t') { - c = 0x9f; + if (i >= 2 && pS[i - 1] == '/' && pS[i - 2] == '/') { + key = (char*)&gOther_long_key; } - - c -= 0x20; - c ^= key[seed]; - c &= 0x7f; - c += 0x20; - - seed += 7; - seed %= 16; - - if (c == 0x9f) { - c = '\t'; + if (pS[i] == '\t') { + pS[i] = -97; + } + pS[i] = ((key[seed] ^ (pS[i] - 32)) & 0x7F) + 32; + seed = (seed + 7) % 16; + if (pS[i] == -97) { + pS[i] = '\t'; } } else { - if (c == '\t') { - c = 0x80; + if (i >= 2 && pS[i - 1] == '/' && pS[i - 2] == '/') { + key = (char*)&gOther_long_key; } - c -= 0x20; + if (pS[i] == '\t') { + pS[i] = 0x80; + } + c = pS[i] - 32; if ((c & 0x80) == 0) { - c ^= key[seed] & 0x7f; + pS[i] = (c ^ key[seed] & 0x7F) + 32; } - c += 0x20; - - seed += 7; - seed %= 16; - - if (c == 0x80) { - c = '\t'; + seed = (seed + 7) % 16; + if (pS[i] == -128) { + pS[i] = '\t'; } } - pS[i] = c; } }