Skip to content

Commit

Permalink
Allow Manual SiglusPatcher Key Specifier
Browse files Browse the repository at this point in the history
  • Loading branch information
marcussacana committed May 12, 2019
1 parent 1c348ae commit 135779e
Showing 1 changed file with 36 additions and 8 deletions.
44 changes: 36 additions & 8 deletions SiglusPatcher/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -125,15 +125,43 @@ private static uint IndexOfSequence(byte[] Data, byte[] Sequence) {
}
return uint.MaxValue;
}

private static byte[] GetSiglusKey(string Exe) {
Process Proc = Process.Start(Exe);
while (Proc.MainWindowHandle == IntPtr.Zero)
System.Threading.Thread.Sleep(100);
KeyFinder.Key Key = KeyFinder.ReadProcess(Proc.Id)[0];
byte[] KeyB = Key.KEY;
Proc.Kill();
Console.WriteLine("Encryption Key Detected:\n{0}", Key.KeyStr);
return KeyB;
try
{
Process Proc = Process.Start(Exe);
while (Proc.MainWindowHandle == IntPtr.Zero)
System.Threading.Thread.Sleep(100);
KeyFinder.Key Key = KeyFinder.ReadProcess(Proc.Id)[0];
byte[] KeyB = Key.KEY;
Proc.Kill();
Console.WriteLine("Encryption Key Detected:\n{0}", Key.KeyStr);
return KeyB;
}
catch (Exception ex) {
var Color = Console.ForegroundColor;
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine("Failed, Please, Report a issue... LOG:\n{0}", ex.ToString());
Console.ForegroundColor = Color;

Console.WriteLine("You know the key? If yes, type it...");
string Reply = Console.ReadLine();
Reply = Reply.ToUpper().Replace("0X", "").Replace(",", "").Replace(" ", "").Trim();

if (string.IsNullOrWhiteSpace(Reply) || Reply.Length/2 != KeyPointers.Length)
throw new Exception();

if ((from x in Reply where ((x >= '0' && x <= '9') || (x >= 'A' && x <= 'F')) select x).Count() != Reply.Length)
throw new Exception();

byte[] Key = new byte[KeyPointers.Length];
for (byte i = 0; i < Key.Length; i++)
{
Key[i] = Convert.ToByte(Reply.Substring(i * 2, 2), 16);
}

return Key;
}
}

private static void ExtractResource(string Resource, string Dir) {
Expand Down

0 comments on commit 135779e

Please sign in to comment.