/// <summary> /// Get The Encryption Key to the given script /// </summary> /// <param name="Script">The Script to Get the Key</param> /// <returns>The key, if fails returns uint.MaxValue</returns> public static uint SelectKey(byte[] Script) { uint[] KnowedKeys = RLD.KnowedKeys.Values.ToArray(); try { KnowedKeys.Append(RLDExt.GetLocalKeys()); } catch { } byte[] Tmp = new byte[Script.Length]; if (LastKnowedKey != 0) { Script.CopyTo(Tmp, 0); if (new RLD(Tmp, LastKnowedKey).Import().Length > 2) { return(LastKnowedKey); } } foreach (uint Key in KnowedKeys) { Script.CopyTo(Tmp, 0); if (new RLD(Tmp, Key).Import().Length > 2) { LastKnowedKey = Key; return(Key); } } return(uint.MaxValue); }
public string[] Import() { if (!Decrypted) { Decrypted = true; XOR(ref Script); try { RLDExt.DbgDump(Script); } catch { } } Offsets = new uint[0]; for (uint i = 0; i < Script.Length; i++) { Result Info = Scan(i); if (!Info.Valid) { continue; } foreach (uint ptr in Info.StrIndxs) { if (Offsets.Contains(ptr) || GetStrLen(ptr) < 3 || IsCommand(ptr)) { continue; } Offsets = Offsets.Append(ptr); } } //Initialize Variables string[] Strs = new string[Offsets.Length]; Lenghts = new uint[Offsets.Length]; for (int i = 0; i < Strs.Length; i++) { Strs[i] = Script.GetStringAt(Offsets[i], Encoding); Lenghts[i] = GetStrLen(Offsets[i]); } return(Strs); }