Пример #1
0
        /// <summary>
        /// Processing function called to allow the plugin to process the file.
        /// </summary>
        /// <param name="file"></param>
        /// <param name="options"></param>
        /// <returns></returns>
        public override bool ProcessFile(string file, SteamlessOptions options)
        {
            // Initialize the class members..
            this.Options                = options;
            this.CodeSectionData        = null;
            this.CodeSectionIndex       = -1;
            this.PayloadData            = null;
            this.SteamDrmpData          = null;
            this.SteamDrmpOffsets       = new List <int>();
            this.UseFallbackDrmpOffsets = false;
            this.XorKey = 0;

            // Parse the file..
            this.File = new Pe32File(file);
            if (!this.File.Parse())
            {
                return(false);
            }

            // Announce we are being unpacked with this packer..
            this.Log("File is packed with SteamStub Variant 2.0!", LogMessageType.Information);

            this.Log("Step 1 - Read, disassemble and decode the SteamStub DRM header.", LogMessageType.Information);
            if (!this.Step1())
            {
                return(false);
            }

            this.Log("Step 2 - Read, decode and process the payload data.", LogMessageType.Information);
            if (!this.Step2())
            {
                return(false);
            }

            this.Log("Step 3 - Read, decode and dump the SteamDRMP.dll file.", LogMessageType.Information);
            if (!this.Step3())
            {
                return(false);
            }

            this.Log("Step 4 - Scan, dump and pull needed offsets from within the SteamDRMP.dll file.", LogMessageType.Information);
            if (!this.Step4())
            {
                return(false);
            }

            this.Log("Step 5 - Read, decrypt and process the main code section.", LogMessageType.Information);
            if (!this.Step5())
            {
                return(false);
            }

            this.Log("Step 6 - Rebuild and save the unpacked file.", LogMessageType.Information);
            if (!this.Step6())
            {
                return(false);
            }

            return(true);
        }
Пример #2
0
        /// <summary>
        /// Processing function called to allow the plugin to process the file.
        /// </summary>
        /// <param name="file"></param>
        /// <param name="options"></param>
        /// <returns></returns>
        public override bool ProcessFile(string file, SteamlessOptions options)
        {
            // Initialize the class members..
            this.TlsAsOep         = false;
            this.TlsOepRva        = 0;
            this.Options          = options;
            this.CodeSectionData  = null;
            this.CodeSectionIndex = -1;
            this.XorKey           = 0;

            // Parse the file..
            this.File = new Pe64File(file);
            if (!this.File.Parse())
            {
                return(false);
            }

            // Announce we are being unpacked with this packer..
            this.Log("File is packed with SteamStub Variant 3.0!", LogMessageType.Information);

            this.Log("Step 1 - Read, decode and validate the SteamStub DRM header.", LogMessageType.Information);
            if (!this.Step1())
            {
                return(false);
            }

            this.Log("Step 2 - Read, decode and process the payload data.", LogMessageType.Information);
            if (!this.Step2())
            {
                return(false);
            }

            this.Log("Step 3 - Read, decode and dump the SteamDRMP.dll file.", LogMessageType.Information);
            if (!this.Step3())
            {
                return(false);
            }

            this.Log("Step 4 - Handle .bind section. Find code section.", LogMessageType.Information);
            if (!this.Step4())
            {
                return(false);
            }

            this.Log("Step 5 - Read, decrypt and process code section.", LogMessageType.Information);
            if (!this.Step5())
            {
                return(false);
            }

            this.Log("Step 6 - Rebuild and save the unpacked file.", LogMessageType.Information);
            if (!this.Step6())
            {
                return(false);
            }

            return(true);
        }
Пример #3
0
        /// <summary>
        /// Processing function called to allow the plugin to process the file.
        /// </summary>
        /// <param name="file"></param>
        /// <param name="options"></param>
        /// <returns></returns>
        public override bool ProcessFile(string file, SteamlessOptions options)
        {
            // Obtain the view model locator..
            var vml = Application.Current.FindResource("ViewModelLocator") as ViewModelLocator;

            // Obtain the plugins..
            var plugins = vml?.MainWindow.Plugins;

            if (plugins == null || plugins.Count == 0)
            {
                return(false);
            }

            // Query the plugin list for a plugin to process the file..
            return((from p in plugins where p != this where p.CanProcessFile(file) select p.ProcessFile(file, options)).FirstOrDefault());
        }
Пример #4
0
        /// <summary>
        /// Processing function called to allow the plugin to process the file.
        /// </summary>
        /// <param name="file"></param>
        /// <param name="options"></param>
        /// <returns></returns>
        public override bool ProcessFile(string file, SteamlessOptions options)
        {
            // Initialize the class members..
            this.Options            = options;
            this.OriginalEntryPoint = 0;

            // Parse the file..
            this.File = new Pe32File(file);
            if (!this.File.Parse())
            {
                return(false);
            }

            // Announce we are being unpacked with this packer..
            this.Log("File is packed with SteamStub Variant 1.0!", LogMessageType.Information);

            this.Log("Step 1 - Read, decode and validate the SteamStub DRM header.", LogMessageType.Information);
            if (!this.Step1())
            {
                return(false);
            }

            this.Log("Step 2 - Handle .bind section.", LogMessageType.Information);
            if (!this.Step2())
            {
                return(false);
            }

            this.Log("Step 3 - Rebuild and save the unpacked file.", LogMessageType.Information);
            if (!this.Step3())
            {
                return(false);
            }

            if (this.Options.RecalculateFileChecksum)
            {
                this.Log("Step 4 - Rebuild unpacked file checksum.", LogMessageType.Information);
                if (!this.Step4())
                {
                    return(false);
                }
            }

            return(true);
        }
Пример #5
0
        private static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new Form1());
            Steamless.Unpacker.Variant31.x64.Main m64 = new Steamless.Unpacker.Variant31.x64.Main();
            Steamless.Unpacker.Variant31.x86.Main m86 = new Steamless.Unpacker.Variant31.x86.Main();
            SteamlessOptions s  = new SteamlessOptions();
            Vendor           sh = new Vendor();
            string           requiredDLLPath0 = Assembly.GetAssembly(m64.GetType()).CodeBase.Substring(8);
            string           requiredDLLPath1 = Assembly.GetAssembly(s.GetType()).CodeBase.Substring(8);
            string           requiredDLLPath2 = Assembly.GetAssembly(sh.GetType()).CodeBase.Substring(8);
            string           requiredDLLPath3 = Assembly.GetAssembly(m86.GetType()).CodeBase.Substring(8);

            if (!File.Exists(requiredDLLPath0) || !File.Exists(requiredDLLPath1) || !File.Exists(requiredDLLPath2) || !File.Exists(requiredDLLPath3))
            {
                MessageBox.Show("Missing dependencies");
                return;
            }
        }
Пример #6
0
        private static bool ProcessSteamFile20(string file)
        {
            SteamlessOptions s = new SteamlessOptions
            {
                VerboseOutput       = false,
                KeepBindSection     = false,
                DumpPayloadToDisk   = false,
                DumpSteamDrmpToDisk = false
            };

            Steamless.Unpacker.Variant20.x86.Main m = new Steamless.Unpacker.Variant20.x86.Main();
            m.Initialize(m_LoggingService);
            if (m.ProcessFile(file, s))
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Пример #7
0
    public static void Main(string[] args)
    {
        if (args.Length != 1)
        {
            Console.WriteLine("Please pass an executable!");
            return;
        }
        SteamlessOptions options    = new SteamlessOptions();
        String           executable = args[0];

        MainClass main = new MainClass();
        List <SteamlessPlugin> plugins = main.GetSteamlessPlugins();

        if (plugins.Count == 0)
        {
            Console.WriteLine("Failed to load any plugins!");
            return;
        }
        SteamlessPlugin plugin = null;

        for (int i = 0; i < plugins.Count; i++)
        {
            if (!plugins[i].CanProcessFile(executable))
            {
                Console.WriteLine("Skipping " + plugins[i].Name);
                continue;
            }

            plugins[i].ProcessFile(executable, options);
        }
        if (plugin == null)
        {
            Console.WriteLine("Failed to find a plugin that could process " + executable);
            return;
        }

        Console.WriteLine("Decrypting with " + plugin.Name + " by " + plugin.Author);
        Console.WriteLine(plugin.Description);
    }
Пример #8
0
        /// <summary>
        /// Processing function called to allow the plugin to process the file.
        /// </summary>
        /// <param name="file"></param>
        /// <param name="options"></param>
        /// <returns></returns>
        public override bool ProcessFile(string file, SteamlessOptions options)
        {
            this.m_LoggingService.OnAddLogMessage(this, new LogMessageEventArgs("ExamplePlugin was asked to process a file!", LogMessageType.Debug));

            return(false);
        }
Пример #9
0
        /// <summary>
        /// Runs the Steamless command line operations.
        /// </summary>
        /// <param name="args"></param>
        /// <returns></returns>
        static int Run(string[] args)
        {
            var logService = new LoggingService();
            var opts       = new SteamlessOptions();
            var file       = string.Empty;

            // Prepare the logging service..
            logService.AddLogMessage += (sender, e) =>
            {
                if (!opts.VerboseOutput && e.MessageType == LogMessageType.Debug)
                {
                    return;
                }

                try
                {
                    if (sender != null)
                    {
                        e.Message = $"[{sender.GetType().Assembly.GetName().Name}] {e.Message}";
                    }
                    else
                    {
                        e.Message = $"[Steamless] {e.Message}";
                    }
                }
                catch
                {
                }

                Console.WriteLine(e.Message);
            };

            // Print the program header..
            Program.PrintHeader();

            // Process command line arguments for the various Steamless options..
            foreach (var arg in args)
            {
                if (arg.ToLower() == "--quiet")
                {
                    opts.VerboseOutput = false;
                }
                if (arg.ToLower() == "--keepbind")
                {
                    opts.KeepBindSection = true;
                }
                if (arg.ToLower() == "--keepstub")
                {
                    opts.ZeroDosStubData = false;
                }
                if (arg.ToLower() == "--dumppayload")
                {
                    opts.DumpPayloadToDisk = true;
                }
                if (arg.ToLower() == "--dumpdrmp")
                {
                    opts.DumpSteamDrmpToDisk = true;
                }
                if (arg.ToLower() == "--realign")
                {
                    opts.DontRealignSections = false;
                }
                if (arg.ToLower() == "--recalcchecksum")
                {
                    opts.RecalculateFileChecksum = true;
                }
                if (arg.ToLower() == "--exp")
                {
                    opts.UseExperimentalFeatures = true;
                }
                if (!arg.StartsWith("--"))
                {
                    file = arg;
                }
            }

            // Ensure an input file was given..
            if (string.IsNullOrEmpty(file))
            {
                Program.PrintHelp();
                return(1);
            }

            // Ensure the input file exists..
            if (!File.Exists(file))
            {
                logService.OnAddLogMessage(null, new LogMessageEventArgs("Invalid input file given; cannot continue.", LogMessageType.Error));
                return(1);
            }

            // Collect the list of available plugins..
            var plugins = GetSteamlessPlugins(logService);

            plugins.ForEach(p => logService.OnAddLogMessage(null, new LogMessageEventArgs($"Loaded plugin: {p.Name} - by {p.Author} (v.{p.Version})", LogMessageType.Success)));

            // Ensure plugins were found and loaded..
            if (plugins.Count == 0)
            {
                logService.OnAddLogMessage(null, new LogMessageEventArgs("No plugins were loaded; be sure to fully extract Steamless before running!", LogMessageType.Error));
                return(1);
            }

            // Loop through the plugins and try to unpack the file..
            foreach (var p in plugins)
            {
                // Check if the plugin can process the file..
                if (p.CanProcessFile(file))
                {
                    var ret = p.ProcessFile(file, opts);

                    logService.OnAddLogMessage(null, !ret
                        ? new LogMessageEventArgs("Failed to unpack file.", LogMessageType.Error)
                        : new LogMessageEventArgs("Successfully unpacked file!", LogMessageType.Success));

                    if (ret)
                    {
                        return(0);
                    }
                }
            }

            logService.OnAddLogMessage(null, new LogMessageEventArgs("All unpackers failed to unpack file.", LogMessageType.Error));
            return(1);
        }