Skip to content

Commit 47a0ef3

Browse files
tas50claude
andcommitted
✨ Add NetScout Hardened OS platform detection
Detect NetScout Hardened OS as netscout-hardened-os in the redhat family. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 2a19947 commit 47a0ef3

File tree

3 files changed

+52
-1
lines changed

3 files changed

+52
-1
lines changed

providers/os/detector/detector_all.go

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,18 @@ var qubes = &PlatformResolver{
384384
},
385385
}
386386

387+
var netscoutHardenedOS = &PlatformResolver{
388+
Name: "netscout-hardened-os",
389+
IsFamily: false,
390+
Detect: func(r *PlatformResolver, pf *inventory.Platform, conn shared.Connection) (bool, error) {
391+
if pf.Name == "NetScout Hardened OS" {
392+
pf.Name = "netscout-hardened-os"
393+
return true, nil
394+
}
395+
return false, nil
396+
},
397+
}
398+
387399
var tails = &PlatformResolver{
388400
Name: "tails",
389401
IsFamily: false,
@@ -1082,7 +1094,7 @@ var redhatFamily = &PlatformResolver{
10821094
IsFamily: true,
10831095
// NOTE: oracle pretends to be redhat with /etc/redhat-release and Red Hat Linux, therefore we
10841096
// want to check that platform before redhat
1085-
Children: []*PlatformResolver{oracle, rhel, centos, fedora, scientific, eurolinux, nobara, qubes},
1097+
Children: []*PlatformResolver{oracle, rhel, centos, fedora, scientific, eurolinux, nobara, qubes, netscoutHardenedOS},
10861098
Detect: func(r *PlatformResolver, pf *inventory.Platform, conn shared.Connection) (bool, error) {
10871099
f, err := conn.FileSystem().Open("/etc/redhat-release")
10881100
if err != nil {

providers/os/detector/detector_platform_test.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1134,6 +1134,17 @@ func TestKDENeonDetector(t *testing.T) {
11341134
assert.Equal(t, []string{"debian", "linux", "unix", "os"}, di.Family)
11351135
}
11361136

1137+
func TestNetscoutHardenedOSDetector(t *testing.T) {
1138+
di, err := detectPlatformFromMock("./testdata/detect-netscout-hardened-os.toml")
1139+
assert.Nil(t, err, "was able to create the provider")
1140+
1141+
assert.Equal(t, "netscout-hardened-os", di.Name, "os name should be identified")
1142+
assert.Equal(t, "NetScout Hardened OS", di.Title, "os title should be identified")
1143+
assert.Equal(t, "20", di.Version, "os version should be identified")
1144+
assert.Equal(t, "x86_64", di.Arch, "os arch should be identified")
1145+
assert.Equal(t, []string{"redhat", "linux", "unix", "os"}, di.Family)
1146+
}
1147+
11371148
func TestQubesOSDetector(t *testing.T) {
11381149
di, err := detectPlatformFromMock("./testdata/detect-qubes.toml")
11391150
assert.Nil(t, err, "was able to create the provider")
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
[commands."uname -s"]
2+
stdout = "Linux"
3+
4+
[commands."uname -m"]
5+
stdout = "x86_64"
6+
7+
[commands."uname -r"]
8+
stdout = "3.11.10-301.fc20.x86_64"
9+
10+
[files."/etc/redhat-release"]
11+
content = "Fedora release 20 (Heisenbug)"
12+
13+
[files."/etc/os-release"]
14+
content = """
15+
NAME="NetScout Hardened OS"
16+
VERSION="20"
17+
ID="NetScout Hardened OS"
18+
VERSION_ID=20
19+
PRETTY_NAME="NetScout Hardened OS"
20+
ANSI_COLOR="0;34"
21+
CPE_NAME="cpe:/o:fedoraproject:fedora:20"
22+
HOME_URL="https://fedoraproject.org/"
23+
BUG_REPORT_URL="https://bugzilla.redhat.com/"
24+
REDHAT_BUGZILLA_PRODUCT="Fedora"
25+
REDHAT_BUGZILLA_PRODUCT_VERSION=20
26+
REDHAT_SUPPORT_PRODUCT="Fedora"
27+
REDHAT_SUPPORT_PRODUCT_VERSION=20
28+
"""

0 commit comments

Comments
 (0)