This file is indexed.

/usr/lib/ruby/vendor_ruby/specinfra/backend/powershell/support/list_windows_features.ps1 is in ruby-specinfra 2.35.1-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
function ListWindowsFeatures
{    

param(
        [string]$feature,
        [string]$provider="dism"
         )

    $cachepath =  "${env:temp}/ListWindowsFeatures-${provider}.xml"
    $maxAge = 2

    $cache =  Get-Item $cachepath -erroraction SilentlyContinue

    if($cache -ne $null -and ((get-date) - $cache.LastWriteTime).minutes -lt $maxage){
        $features = Import-Clixml $cachepath |  Select *| Where-Object {(($_.name -like $feature) -or ($_.displayName -like $feature)) -and (($_.installed -eq $true) -or ($_.state -eq "Enabled"))}
        return $features
    }
    else{

        switch($provider)
        {
            "dism" { return features_dism | Select * | Where-Object {($_.name -eq $feature) -and ($_.state -eq "Enabled")}  }
            "powershell" { return features_powershell | Select * | Where-Object {(($_.name -like $feature) -or ($_.displayName -like $feature)) -and ($_.installed -eq $true)} }
            default {throw "Unsupported provider"}
        }

    }
}

function features_dism{
      try
        {
            $out = DISM /Online /Get-Features /Format:List | Where-Object {$_}     

            if($LASTEXITCODE -ne 0)
            {
                Write-Error $out
                Break
            }

            $f = $out[4..($out.length-2)]
            $features = for($i=0; $i -lt $f.length;$i+=2)
            {
                $tmp = $f[$i],$f[$i+1] -replace '^([^:]+:\s)'
                
                New-Object PSObject -Property @{
                    Name = $tmp[0]
                    State = $tmp[1]
                }
            }

            $features | Export-Clixml $cachepath

            return $features
        }
        catch
        {
            Throw
        }
}

function features_powershell{
    $ProgressPreference = "SilentlyContinue"
     import-module servermanager
     $features = Get-WindowsFeature
     $features | Export-Clixml $cachepath
     return Get-WindowsFeature 
}