Exemplo n.º 1
0
        public IntPtr ScanMinimum(SigCollection collection)
        {
            var results = ScanAll(collection);

            if (results.Count() == 0)
            {
                return(IntPtr.Zero);
            }

            return((IntPtr)results.ConvertAll <long>(x => x.ToInt64()).Min());
        }
Exemplo n.º 2
0
        public IntPtr Scan(SigCollection collection)
        {
            foreach (Signature sig in collection.Signatures)
            {
                IntPtr output = Scan(sig);
                if (output == IntPtr.Zero)
                {
                    continue;
                }

                if (collection.EvaluateMatch(output))
                {
                    return(output);
                }
            }

            return(IntPtr.Zero);
        }
Exemplo n.º 3
0
        public static void TestCollectionScan()
        {
            byte[] bytes = new byte[] { 0x10, 0x31, 0x20, 0x5C, 0x78, 0x01, 0x10, };

            SigCollection sc      = new SigCollection("20 5C", "10 31");
            Signature     s       = new Signature("10 31 47");
            SigScanner    scanner = new SigScanner(bytes);

            /*
             * Stopwatch sw = new Stopwatch();
             * sw.Start();
             * for (int i = 0; i <= 0x5000; i++)
             * {
             *  scanner.ScanMinimum(sc);
             * }
             *
             * WriteLine(sw.ElapsedMilliseconds);
             */

            WriteLine(scanner.Scan(sc));
            ReadLine();
        }
Exemplo n.º 4
0
        public List <IntPtr> ScanAll(SigCollection collection)
        {
            List <IntPtr> output = new List <IntPtr>();

            foreach (Signature sig in collection.Signatures)
            {
                var list = ScanAll(sig);

                if (list.Count() == 0)
                {
                    continue;
                }

                foreach (IntPtr match in list)
                {
                    if (collection.EvaluateMatch(match))
                    {
                        output.Add(match);
                    }
                }
            }
            return(output);
        }