/// <inheritdoc/> public ConcurrentDictionary <string, ConcurrentQueue <string> > Scan(Scanner scanner, Stream stream, string file) { // If the installer file itself fails try { string tempPath = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString()); Directory.CreateDirectory(tempPath); Wise unpacker = new Wise(); unpacker.ExtractTo(file, tempPath); // Collect and format all found protections var protections = scanner.GetProtections(tempPath); // If temp directory cleanup fails try { Directory.Delete(tempPath, true); } catch { } // Remove temporary path references Utilities.StripFromKeys(protections, tempPath); return(protections); } catch { } return(null); }
static void Main(string[] args) { var unpacker = new WiseUnpacker.WiseUnpacker(); string input = Path.GetFullPath(args[0]); string outdir = Path.Combine(Path.GetDirectoryName(input), Path.GetFileNameWithoutExtension(input)); if (args.Length > 1) { outdir = Path.GetFullPath(args[1]); } if (unpacker.ExtractTo(input, outdir)) { Console.WriteLine($"Extracted {input} to {outdir}"); } else { Console.WriteLine($"Failed to extract {input}!"); } Console.ReadKey(); }