Skip to content

Commit 9124231

Browse files
Add some examples
Add examples for CmdShell, PowerShell, Registry, WMI probe types.
1 parent 19754f9 commit 9124231

4 files changed

Lines changed: 204 additions & 0 deletions

File tree

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
{
2+
"schemaVersion": "1.0",
3+
"name": "CmdShell check",
4+
"version": "1.0.0",
5+
"rules": [
6+
{
7+
"id": "DirectoryCheck",
8+
"itemType": "definition",
9+
"target": {
10+
"type": "Server",
11+
"platform": "Windows",
12+
"engineEdition": "OnPremises",
13+
"version": "[11.0,)"
14+
},
15+
"displayName": "CmdShell probe",
16+
"description": "This is an example of cmdshell probe type. ",
17+
"message": "Empty list",
18+
"level": "Warning",
19+
"condition": "@stdout",
20+
"probes": [
21+
"ListOfDirectoryFilesAndSubdirectories"
22+
]
23+
},
24+
{
25+
"id": ["DefaultRuleset"],
26+
"itemType": "override",
27+
"enabled": false
28+
}
29+
],
30+
"probes": {
31+
"ListOfDirectoryFilesAndSubdirectories": [
32+
{
33+
"type": "CmdShell",
34+
"target": {
35+
"type": "Server",
36+
"platform": "Windows",
37+
"engineEdition": "OnPremises",
38+
"version": "[11.0,)"
39+
},
40+
"implementation": {
41+
"command": "dir"
42+
}
43+
}
44+
]
45+
}
46+
}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
{
2+
"schemaVersion": "1.0",
3+
"name": "NO NAME",
4+
"version": "1.0.0",
5+
"rules": [
6+
{
7+
"id": "PowerShellVersion",
8+
"itemType": "definition",
9+
"target": {
10+
"type": "Server",
11+
"platform": "Windows",
12+
"engineEdition": "OnPremises",
13+
"version": "[11.0,)"
14+
},
15+
"displayName": "PowerShell host information",
16+
"description": "Information about the PowerShell console host ",
17+
"message": "Upgrade ps version to latest one. Current major version is @{Output.Version}, latest is @{latestVersion}.",
18+
"level": "Warning",
19+
"latestVersion": "7.0.2",
20+
"condition": {
21+
"eq": [
22+
"@Output.Version",
23+
"@latestVersion"
24+
]
25+
},
26+
"probes": [
27+
"PowershellHostInformation"
28+
]
29+
}
30+
],
31+
"probes": {
32+
"PowershellHostInformation": [
33+
{
34+
"type": "PowerShell",
35+
"target": {
36+
"type": "Server",
37+
"platform": "Windows",
38+
"engineEdition": "OnPremises",
39+
"version": "[11.0,)"
40+
},
41+
"implementation": {
42+
"command": "Get-Host"
43+
}
44+
}
45+
]
46+
}
47+
}
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
{
2+
"schemaVersion": "1.0",
3+
"name": "Registry check",
4+
"version": "1.0.0",
5+
"rules": [
6+
{
7+
"id": "ComputerNameRule",
8+
"itemType": "definition",
9+
"target": {
10+
"type": "Server",
11+
"platform": "Windows",
12+
"engineEdition": "OnPremises",
13+
"version": "[11.0,)"
14+
},
15+
"displayName": "Computer name",
16+
"description": "Computer name couldn't be empty. ",
17+
"message": "Set the computer name, because it couldn't be empty.",
18+
"level": "Warning",
19+
"condition": "@ComputerName",
20+
"probes": [
21+
"ComputerName"
22+
]
23+
},
24+
{
25+
"id": ["DefaultRuleset"],
26+
"itemType": "override",
27+
"enabled": false
28+
}
29+
],
30+
"probes": {
31+
"ComputerName": [
32+
{
33+
"type": "Registry",
34+
"target": {
35+
"type": "Server",
36+
"platform": "Windows",
37+
"engineEdition": "OnPremises",
38+
"version": "[11.0,)"
39+
},
40+
"implementation": {
41+
"query": {
42+
"HKEY_LOCAL_MACHINE": {
43+
"SYSTEM\\CurrentControlSet\\Control\\ComputerName\\ComputerName": [
44+
"ComputerName"
45+
]
46+
}
47+
}
48+
}
49+
}
50+
]
51+
}
52+
}
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
{
2+
"schemaVersion": "1.0",
3+
"name": "WMI check",
4+
"version": "1.0.0",
5+
"rules": [
6+
{
7+
"id": "Win32Volume",
8+
"itemType": "definition",
9+
"target": {
10+
"type": "Server",
11+
"platform": "Windows",
12+
"engineEdition": "OnPremises",
13+
"version": "[11.0,)"
14+
},
15+
"displayName": "Block size",
16+
"description": "This is an example of using WMI query.",
17+
"message": "Format volume @{Output.Name} to recommended block size of 64KB. Current size is @{Output.BlockSize} bytes",
18+
"level": "Warning",
19+
"BlockSize": 65536,
20+
"condition": {
21+
"or": [
22+
{
23+
"not": "@Output.Name"
24+
},
25+
{
26+
"eq": [
27+
"@Output.BlockSize",
28+
"@BlockSize"
29+
]
30+
}
31+
]
32+
},
33+
"probes": [
34+
"Win32Volumes"
35+
]
36+
},
37+
{
38+
"id": ["DefaultRuleset"],
39+
"itemType": "override",
40+
"enabled": false
41+
}
42+
],
43+
"probes": {
44+
"Win32Volumes": [
45+
{
46+
"type": "WMI",
47+
"target": {
48+
"type": "Server",
49+
"platform": "Windows",
50+
"engineEdition": "OnPremises",
51+
"version": "[11.0,)"
52+
},
53+
"implementation": {
54+
"query": "SELECT Name, BlockSize FROM Win32_Volume WHERE Capacity <> NULL"
55+
}
56+
}
57+
]
58+
}
59+
}

0 commit comments

Comments
 (0)