예제 #1
0
        public Int32 Handle()
        {
            DataTypeBase dataType = ScanSettings.DataType;

            ScanConstraint.ConstraintType constraintType = ScanConstraint.ConstraintType.Equal;

            if (String.IsNullOrWhiteSpace(this.Constraint))
            {
                // Default to equals
                this.Constraint = "e";
            }

            switch (this.Constraint.ToLower())
            {
            case "le":
                break;

            case "l":
                break;

            case "g":
                break;

            case "ge":
                break;

            case "e":
                break;

            case "c":
                break;

            case "u":
                break;

            case "i":
                break;

            case "d":
                break;

            default:
                Console.WriteLine("Unknown constraint type '" + this.Constraint + "', defaulting to equal");
                break;
            }

            if (!SyntaxChecker.CanParseValue(dataType, this.Value))
            {
                Console.WriteLine("Failed to parse '" + this.Value + "' as data type " + dataType?.ToString());
                return(-1);
            }

            ScanConstraint scanConstraints = new ScanConstraint(constraintType, dataType, Conversions.ParsePrimitiveStringAsPrimitive(dataType, this.Value));

            // Collect values
            TrackableTask <Snapshot> valueCollectorTask = ValueCollector.CollectValues(
                SessionManager.Session.SnapshotManager.GetActiveSnapshotCreateIfNone(SessionManager.Session.OpenedProcess, dataType),
                TrackableTask.UniversalIdentifier);

            // Perform manual scan
            Snapshot snapshot = valueCollectorTask.Result;
            TrackableTask <Snapshot> scanTask = ManualScanner.Scan(
                snapshot,
                scanConstraints,
                TrackableTask.UniversalIdentifier);

            SessionManager.Session.SnapshotManager.SaveSnapshot(scanTask.Result);

            Console.WriteLine();

            return(0);
        }