コード例 #1
0
ファイル: ScanConstraint.cs プロジェクト: samshine/Squalr
        /// <summary>
        /// Gets a value indicating whether this constraint requires a value.
        /// </summary>
        /// <returns>True if the constraint requires a value.</returns>
        public static Boolean IsValuedConstraint(ScanConstraint.ConstraintType constraint)
        {
            switch (constraint)
            {
            case ConstraintType.Equal:
            case ConstraintType.NotEqual:
            case ConstraintType.GreaterThan:
            case ConstraintType.GreaterThanOrEqual:
            case ConstraintType.LessThan:
            case ConstraintType.LessThanOrEqual:
            case ConstraintType.IncreasedByX:
            case ConstraintType.DecreasedByX:
                return(true);

            case ConstraintType.Changed:
            case ConstraintType.Unchanged:
            case ConstraintType.Increased:
            case ConstraintType.Decreased:
                return(false);

            default:
                throw new ArgumentException();
            }
        }
コード例 #2
0
 /// <summary>
 /// Changes the current scan constraint.
 /// </summary>
 /// <param name="constraint">The new scan constraint.</param>
 private void ChangeScanConstraintSelection(ScanConstraint.ConstraintType constraint)
 {
     this.ActiveConstraint.Constraint = constraint;
     this.UpdateAllProperties();
 }
コード例 #3
0
ファイル: NextScanOptions.cs プロジェクト: ilikemlik/Squalr
        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);
        }