/// <summary> /// This does the actual searching of the hashes from the above function. Designed to run on multiple threads /// </summary> private void FindString() { while (CompileList.Count > 0) { Tuple <string, bool> scriptToSearch; lock (Program.ThreadLock) { scriptToSearch = CompileList.Dequeue(); } using (Stream ScriptFile = File.OpenRead(scriptToSearch.Item1)) { ScriptHeader header = ScriptHeader.Generate(ScriptFile, scriptToSearch.Item2); StringTable table = new StringTable(ScriptFile, header.StringTableOffsets, header.StringBlocks, header.StringsSize); foreach (string str in table.Values) { if (HashToFind.Contains(Utils.jenkins_one_at_a_time_hash(str))) { if (IsLower(str)) { continue; } lock (Program.ThreadLock) { if (!FoundStrings.Any(item => item.Item2 == str)) { FoundStrings.Add(new Tuple <uint, string>(Utils.jenkins_one_at_a_time_hash(str), str)); } } } } } } Program.ThreadCount--; }
public ScriptFile(Stream scriptStream, OpcodeSet opcodeSet) { file = scriptStream; CodeSet = opcodeSet; CodeTable = new List <byte>(); Functions = new List <Function>(); FunctionLoc = new Dictionary <int, Function>(); AggFunctions = new List <Function>(); AggregateLoc = new Dictionary <int, Function>(); Header = ScriptHeader.Generate(scriptStream); StringTable = new StringTable(scriptStream, Header.StringTableOffsets, Header.StringBlocks, Header.StringsSize); X64NativeTable = new X64NativeTable(scriptStream, Header.NativesOffset + Header.RSC7Offset, Header.NativesCount, Header.CodeLength); for (int i = 0; i < Header.CodeBlocks; i++) { int tablesize = ((i + 1) * 0x4000 >= Header.CodeLength) ? Header.CodeLength % 0x4000 : 0x4000; byte[] working = new byte[tablesize]; scriptStream.Position = Header.CodeTableOffsets[i]; scriptStream.Read(working, 0, tablesize); CodeTable.AddRange(working); } }
public ScriptFile(Stream scriptStream, bool Console) { ConsoleVer = Console; file = scriptStream; Header = ScriptHeader.Generate(scriptStream, Console); StringTable = new StringTable(scriptStream, Header.StringTableOffsets, Header.StringBlocks, Header.StringsSize); if (Console) { NativeTable = new NativeTable(scriptStream, Header.NativesOffset + Header.RSC7Offset, Header.NativesCount); } else { X64NativeTable = new X64NativeTable(scriptStream, Header.NativesOffset + Header.RSC7Offset, Header.NativesCount, Header.CodeLength); } name = Header.ScriptName; CodeTable = new List <byte>(); for (int i = 0; i < Header.CodeBlocks; i++) { int tablesize = ((i + 1) * 0x4000 >= Header.CodeLength) ? Header.CodeLength % 0x4000 : 0x4000; byte[] working = new byte[tablesize]; scriptStream.Position = Header.CodeTableOffsets[i]; scriptStream.Read(working, 0, tablesize); CodeTable.AddRange(working); } GetStaticInfo(); Functions = new List <Function>(); FunctionLoc = new Dictionary <int, FunctionName>(); GetFunctions(); foreach (Function func in Functions) { func.PreDecode(); } Statics.checkvars(); foreach (Function func in Functions) { func.Decode(); } }
public ScriptFile(Stream scriptStream, OpcodeSet opcodeSet) { file = scriptStream; CodeSet = opcodeSet; CodeTable = new List <byte>(); Functions = new List <Function>(); AggFunctions = new List <Function>(); FunctionLoc = new Dictionary <int, FunctionName>(); Header = ScriptHeader.Generate(scriptStream); StringTable = new StringTable(scriptStream, Header.StringTableOffsets, Header.StringBlocks, Header.StringsSize); X64NativeTable = new X64NativeTable(scriptStream, Header.NativesOffset + Header.RSC7Offset, Header.NativesCount, Header.CodeLength); name = Header.ScriptName; for (int i = 0; i < Header.CodeBlocks; i++) { int tablesize = ((i + 1) * 0x4000 >= Header.CodeLength) ? Header.CodeLength % 0x4000 : 0x4000; byte[] working = new byte[tablesize]; scriptStream.Position = Header.CodeTableOffsets[i]; scriptStream.Read(working, 0, tablesize); CodeTable.AddRange(working); } GetStaticInfo(); GetFunctions(); foreach (Function func in Functions) { func.PreDecode(); } Statics.checkvars(); bool dirty = true; while (dirty) { dirty = false; foreach (Function func in Functions) { if (func.Dirty) { dirty = true; func.Dirty = false; func.decodeinsructionsforvarinfo(); } } } if (Program.AggregateFunctions) { foreach (Function func in AggFunctions) { func.PreDecode(); } } foreach (Function func in Functions) { func.Decode(); } if (Program.AggregateFunctions) { foreach (Function func in AggFunctions) { func.Decode(); } } }