Inheritance: ITransformer
Beispiel #1
0
        private void CrackWorkerDoWork(object sender, DoWorkEventArgs e)
        {
            CheckForIllegalCrossThreadCalls = false;
            if (Instance.fileSelectTextBox.Text == "")
            {
                MessageBox.Show("Please select an assembly first!");
            }
            else
            {
                ITransformer trans;
                switch (Instance.taskComboBox.GetItemText(Instance.taskComboBox.SelectedItem))
                {
                    case "ENCracker":
                        trans = new Transformers.ENCracker(Instance.fileSelectTextBox.Text);
                        break;

                    case "BNCracker":
                        trans = new Transformers.BNCracker(Instance.fileSelectTextBox.Text);
                        break;

                    case "RSCBTagger":
                        trans = new Transformers.RECTagger(Instance.fileSelectTextBox.Text);
                        break;

                    case "TBNCracker":
                        trans = new Transformers.TBNCracker(Instance.fileSelectTextBox.Text);
                        break;

                    case "StringReplacer":
                        trans = new Transformers.StringReplacer(Instance.fileSelectTextBox.Text);
                        break;

                    case "OpCodeCleaner":
                        trans = new Transformers.OpCodeCleaner(Instance.fileSelectTextBox.Text);
                        break;
                    case "MPRESSUnpacker":
                        trans = new Transformers.MPRESSUnpacker(Instance.fileSelectTextBox.Text);
                        break;

                    default:
                        MessageBox.Show("No task selected, please pick one!");
                        return;
                }

                #region Run transformer/check for flags

                //This is way f*****g messy but it cleans up code within the transformers
                trans.HasIssue = false;
                if (trans.HasIssue)
                {
                    trans.Logger.Log("Transformer has a problem, aborting!");
                    return;
                }
                trans.Logger.Log("Loading Assembly from " + trans.OriginalLocation);
                trans.Load();
                if (trans.HasIssue)
                {
                    trans.Logger.Log("Transformer has a problem, aborting!");
                    return;
                }
                trans.Logger.Log("Transformer Started.");
                trans.Transform();
                //This needs to be fixed to distinguish if workingassembly is different than original. moduledefinition.image maybe?
                if (trans.HasIssue)
                {
                    if (trans.HasIssue)
                    {
                        trans.Logger.Log("Transformer has a problem, aborting!");
                        return;
                    }
                    trans.Logger.Log("Transformer made no changes! Aborting save!");
                    return;
                }
                trans.Logger.Log("Saving new assembly to " + trans.NewLocation);
                trans.Save();
                //MainForm.Instance.Vibrate();
                _mainLogger.Log("Operation Completed!");

                #endregion
            }
        }
Beispiel #2
0
        private void CrackWorkerDoWork(object sender, DoWorkEventArgs e)
        {
            CheckForIllegalCrossThreadCalls = false;
            if (Instance.fileSelectTextBox.Text == "")
            {
                MessageBox.Show("Please select an assembly first!");
            }
            else
            {
                ITransformer trans;
                switch (Instance.taskComboBox.GetItemText(Instance.taskComboBox.SelectedItem))
                {
                case "ENCracker":
                    trans = new Transformers.ENCracker(Instance.fileSelectTextBox.Text);
                    break;

                case "BNCracker":
                    trans = new Transformers.BNCracker(Instance.fileSelectTextBox.Text);
                    break;

                case "RSCBTagger":
                    trans = new Transformers.RECTagger(Instance.fileSelectTextBox.Text);
                    break;

                case "TBNCracker":
                    trans = new Transformers.TBNCracker(Instance.fileSelectTextBox.Text);
                    break;

                case "StringReplacer":
                    trans = new Transformers.StringReplacer(Instance.fileSelectTextBox.Text);
                    break;

                case "OpCodeCleaner":
                    trans = new Transformers.OpCodeCleaner(Instance.fileSelectTextBox.Text);
                    break;

                case "MPRESSUnpacker":
                    trans = new Transformers.MPRESSUnpacker(Instance.fileSelectTextBox.Text);
                    break;

                default:
                    MessageBox.Show("No task selected, please pick one!");
                    return;
                }

                #region Run transformer/check for flags

                //This is way f*****g messy but it cleans up code within the transformers
                trans.HasIssue = false;
                if (trans.HasIssue)
                {
                    trans.Logger.Log("Transformer has a problem, aborting!");
                    return;
                }
                trans.Logger.Log("Loading Assembly from " + trans.OriginalLocation);
                trans.Load();
                if (trans.HasIssue)
                {
                    trans.Logger.Log("Transformer has a problem, aborting!");
                    return;
                }
                trans.Logger.Log("Transformer Started.");
                trans.Transform();
                //This needs to be fixed to distinguish if workingassembly is different than original. moduledefinition.image maybe?
                if (trans.HasIssue)
                {
                    if (trans.HasIssue)
                    {
                        trans.Logger.Log("Transformer has a problem, aborting!");
                        return;
                    }
                    trans.Logger.Log("Transformer made no changes! Aborting save!");
                    return;
                }
                trans.Logger.Log("Saving new assembly to " + trans.NewLocation);
                trans.Save();
                //MainForm.Instance.Vibrate();
                _mainLogger.Log("Operation Completed!");

                #endregion
            }
        }