public static void ImportModules(AttackState attackState, Stream moduleStream) { try { MemoryStream decMem = CryptoUtils.DecryptFile(moduleStream); attackState.cmd = Encoding.Unicode.GetString(decMem.ToArray()); Processing.PSExec(attackState); } catch (Exception e) { ConsoleColor origColor = Console.ForegroundColor; Console.ForegroundColor = ConsoleColor.Red; Console.Write(Strings.moduleLoadError, e.Message); Console.ForegroundColor = origColor; } }
public static void ImportModules(AttackState attackState, Stream moduleStream) { Assembly assembly = Assembly.GetExecutingAssembly(); StreamReader keyReader = new StreamReader(assembly.GetManifestResourceStream("PSAttack.Modules.key.txt")); string key = keyReader.ReadToEnd(); try { MemoryStream decMem = CryptoUtils.DecryptFile(moduleStream); attackState.cmd = Encoding.Unicode.GetString(decMem.ToArray()); Processing.PSExec(attackState); } catch (Exception e) { ConsoleColor origColor = Console.ForegroundColor; Console.ForegroundColor = ConsoleColor.Red; Console.Write(Strings.moduleLoadError, e.Message); Console.ForegroundColor = origColor; } }