示例#1
0
        public static void PEVerify(TestPEVerifyOptions options)
        {
            if (options == null || options.Rows == null || options.Rows.Length == 0)
            {
                return;
            }
            TestPEVerifier verifier = new TestPEVerifier(options);

            options.TextInfoBox = new TextBox();
            verifier.Go();

            ///All Classes and Methods in E:\....\Assembly007.exe Verified.
            //11 Error(s) Verifying E:\....\Assembly007.exe

            string outputText = options.TextInfoBox.Text;
            bool   verified   = !outputText.Contains(" Error(s) Verifying ") &&
                                outputText.Contains("All Classes and Methods in ") && outputText.Contains(" Verified.");

            if (!verified)
            {
                Utils.ConsoleOutput(outputText);
            }

            Assert.IsTrue(verified, String.Format("Failed to verify {0}", options.Rows[0]));
        }
        public void Test013_NameOnly()
        {
            TestDeobfOptions options = new TestDeobfOptions();

            options.Rows = new string[] { "Assembly013.dll" };
            options.ApplyFrom("Name Only");
            TestUtils.Deobfuscate(options);

            string outputFile      = options.OutputFiles[0];
            TestPEVerifyOptions vo = new TestPEVerifyOptions();

            vo.Rows = new string[] { outputFile };

            //After upgrade to 4.0, peverify find 1 error
            //TestUtils.PEVerify(vo);

            vo.TextInfoBox = new System.Windows.Forms.TextBox();
            TestPEVerifier verifier = new TestPEVerifier(vo);

            verifier.Go();
            string outputText = vo.TextInfoBox.Text;

            if (
                outputText.Contains("1 Error(s) Verifying") &&
                outputText.Contains("NS014.c000148[T]::m0003db][mdToken=0x6000f71][offset 0x00000021] The 'this' parameter to the call must be the calling method's 'this' parameter.(Error: 0x801318E1)")
                )
            {
                Utils.DeleteFile(outputFile);
            }
            else
            {
                Assert.Fail(String.Format("Failed to verify {0}", options.Rows[0]));
            }
        }
        public static void PEVerify(TestPEVerifyOptions options)
        {
            if (options == null || options.Rows == null || options.Rows.Length == 0) 
                return;
            TestPEVerifier verifier = new TestPEVerifier(options);
            options.TextInfoBox = new TextBox();
            verifier.Go();

            ///All Classes and Methods in E:\....\Assembly007.exe Verified.
            //11 Error(s) Verifying E:\....\Assembly007.exe

            string outputText = options.TextInfoBox.Text;
            bool verified = !outputText.Contains(" Error(s) Verifying ") &&
                outputText.Contains("All Classes and Methods in ") && outputText.Contains(" Verified.");

            if (!verified)
            {
                Utils.ConsoleOutput(outputText);
            }
            
            Assert.IsTrue(verified, String.Format("Failed to verify {0}", options.Rows[0]));
        }
        public void Test013_NameOnly()
        {
            TestDeobfOptions options = new TestDeobfOptions();
            options.Rows = new string[] { "Assembly013.dll" };
            options.ApplyFrom("Name Only");
            TestUtils.Deobfuscate(options);

            string outputFile = options.OutputFiles[0];
            TestPEVerifyOptions vo = new TestPEVerifyOptions();
            vo.Rows = new string[] { outputFile };
            
            //After upgrade to 4.0, peverify find 1 error
            //TestUtils.PEVerify(vo);

            vo.TextInfoBox = new System.Windows.Forms.TextBox();
            TestPEVerifier verifier = new TestPEVerifier(vo);
            verifier.Go();
            string outputText = vo.TextInfoBox.Text;

            if (
                outputText.Contains("1 Error(s) Verifying") &&
                outputText.Contains("NS014.c000148[T]::m0003db][mdToken=0x6000f71][offset 0x00000021] The 'this' parameter to the call must be the calling method's 'this' parameter.(Error: 0x801318E1)")
                )
            {
                Utils.DeleteFile(outputFile);
            }
            else
            {
                Assert.Fail(String.Format("Failed to verify {0}", options.Rows[0]));
            }
        }