|
| 1 | +let TimeWindow = 90d; // How far back to look |
| 2 | +let HitThreshold = 10; // Minimum hits to alert per SourceIp + Category |
| 3 | +let MinSeverity = 2; // Set Minimum Severity |
| 4 | +let EnableCategoryFilter = true; // Filter 1: Change to true for filtering based on Categoriesofinterest defined below |
| 5 | +let EnableDescriptionFilter = false; // Filter 2: Change to true for filtering based on Descriptionsofinterest defined below |
| 6 | +let EnableActionFilter = false; // Filter 3: Change to true for filtering based on a MatchActions defined below |
| 7 | +let CategoriesOfInterest = dynamic(["Possibly Unwanted Program Detected", "Possible Social Engineering Attempted", "Crypto Currency Mining Activity Detected", "A suspicious filename was detected", "A system call was detected"]); // Filter 1 |
| 8 | +let DescriptionsOfInterest = dynamic(["pup-activity", "social-engineering", "coin-mining", "suspicious-filename-detect", "system-call-detect"]); // Filter 2 |
| 9 | +let MatchActions = dynamic(["Deny", "alert"]); // Filter 3 |
| 10 | +AZFWIdpsSignature |
| 11 | +| where TimeGenerated >= ago(TimeWindow) |
| 12 | +| where Severity >= MinSeverity |
| 13 | +// Filter 1: Category filter (optional) |
| 14 | +| where (EnableCategoryFilter == false) or (Category has_any (CategoriesOfInterest)) |
| 15 | +// Filter 2: Description filter (optional) |
| 16 | +| where (EnableDescriptionFilter == false) or (Description has_any (DescriptionsOfInterest)) |
| 17 | +// Filter 3: Action filter (optional) |
| 18 | +| where (EnableActionFilter == false) or (Action in~ (MatchActions)) |
| 19 | +| summarize |
| 20 | + StartTime = min(TimeGenerated), |
| 21 | + EndTime = max(TimeGenerated), |
| 22 | + TotalHits = count(), |
| 23 | + MaxSeverity = max(Severity), |
| 24 | + Actions = make_set(Action, 5), |
| 25 | + Signatures = make_set(SignatureId, 20), |
| 26 | + Description = make_set(substring(tostring(Description), 0, 120), 3) |
| 27 | + by SourceIp, ThreatCategory = Category |
| 28 | +| where TotalHits >= HitThreshold |
| 29 | +| project |
| 30 | + StartTime, |
| 31 | + EndTime, |
| 32 | + SourceIp, |
| 33 | + ThreatCategory, |
| 34 | + TotalHits, |
| 35 | + MaxSeverity, |
| 36 | + Actions, |
| 37 | + Signatures, |
| 38 | + Description |
| 39 | +| order by MaxSeverity desc, TotalHits desc |
0 commit comments