Skip to content

Commit bab8be4

Browse files
authored
Merge pull request #792 from altanatsedenova/master
Update rule with cmdshell probe type.
2 parents 033f417 + f3bb824 commit bab8be4

3 files changed

Lines changed: 21 additions & 12 deletions

File tree

samples/manage/sql-assessment-api/notebooks/CustomizationSamples/CustomRuleCmdShellProbe.json

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{
1+
{
22
"schemaVersion": "1.0",
33
"name": "CmdShell check",
44
"version": "1.0.0",
@@ -14,21 +14,30 @@
1414
},
1515
"displayName": "CmdShell probe",
1616
"description": "This is an example of cmdshell probe type. ",
17-
"message": "Empty list",
17+
"message": "File @{stdout.name} has size @{stdout.size} and it's bigger than threshold = @{threshold} bytes",
1818
"level": "Warning",
19-
"condition": "@stdout",
19+
"threshold": 1024,
20+
"condition": {
21+
"lt": [
22+
"@stdout.size",
23+
"@threshold"
24+
]
25+
},
2026
"probes": [
21-
"ListOfDirectoryFilesAndSubdirectories"
27+
{
28+
"id": "ListOfDirectoryFiles",
29+
"transform": {
30+
"type": "parse",
31+
"map": {
32+
"stdout": "/^(?<date>\\d\\d/\\d\\d/\\d\\d\\d\\d)\\s+(?<time>\\d\\d:\\d\\d\\s(AM|PM))\\s+(?<size>[0-9.,]+)\\s+(?<name>.+)$/ix"
33+
}
34+
}
35+
}
2236
]
23-
},
24-
{
25-
"id": ["DefaultRuleset"],
26-
"itemType": "override",
27-
"enabled": false
2837
}
2938
],
3039
"probes": {
31-
"ListOfDirectoryFilesAndSubdirectories": [
40+
"ListOfDirectoryFiles": [
3241
{
3342
"type": "CmdShell",
3443
"target": {
@@ -43,4 +52,4 @@
4352
}
4453
]
4554
}
46-
}
55+
}

samples/manage/sql-assessment-api/notebooks/SQLAssessmentAPITutorialNotebook.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,7 @@
474474
"source": [
475475
"## Probe types\r\n",
476476
"### CmdShell\r\n",
477-
"Create a new rule with CmdShell probe. CmdShell probe executes a CMD.EXE shell command and returns lines of text in variable @stdout. Use CMDSHELL instead of QUERY in probe definition to load a .cmd file. Use Regex parser transformation to extract data from @stdout\r\n",
477+
"Create a new rule with CmdShell probe. CmdShell probe executes a CMD.EXE shell command and returns lines of text in variable @stdout. Use 'CMDSHELL' instead of 'SQL' in probe definition to load a .cmd file. Use Regex parser transformation to extract data from @stdout\r\n",
478478
""
479479
],
480480
"metadata": {
117 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)