mirror of
https://github.com/Yamato-Security/WELA.git
synced 2025-12-06 17:22:50 +01:00
add actions
This commit is contained in:
32
.github/workflows/create-csv.yml
vendored
32
.github/workflows/create-csv.yml
vendored
@@ -11,18 +11,30 @@ jobs:
|
||||
|
||||
- name: Generate csv from auditpol /list /subcategory:* /r
|
||||
run: |
|
||||
$output = auditpol /list /subcategory:* /r
|
||||
$data = $output | Select-Object -Skip 1 | Where-Object { $_ -match '.+\s{2,}.+' }
|
||||
$csvData = $data | ForEach-Object {
|
||||
$columns = $_ -split "\s{2,}"
|
||||
[PSCustomObject]@{
|
||||
"Subcategory" = $columns[0].Trim()
|
||||
"Subcategory GUID" = $columns[1].Trim()
|
||||
$data = auditpol /list /subcategory:* /r
|
||||
$category = ""
|
||||
foreach ($line in $data) {
|
||||
if ($line -match "^Category/Subcategory") { continue }
|
||||
if ($line -match "^\s+(.+),\{(.+)\}$") {
|
||||
$subcategory = $matches[1].Trim()
|
||||
$guid = $matches[2].Trim()
|
||||
$output += [PSCustomObject]@{
|
||||
Category = $category
|
||||
Subcategory = $subcategory
|
||||
GUID = $guid
|
||||
}
|
||||
} elseif ($line -match "^(.+),\{(.+)\}$") {
|
||||
$category = $matches[1].Trim()
|
||||
$guid = $matches[2].Trim()
|
||||
$output += [PSCustomObject]@{
|
||||
Category = $category
|
||||
Subcategory = ""
|
||||
GUID = $guid
|
||||
}
|
||||
}
|
||||
$csvFilePath = "$PWD\auditpol_output.csv"
|
||||
$csvData | Export-Csv -Path $csvFilePath -NoTypeInformation -Encoding UTF8
|
||||
Write-Output "CSVファイルが作成されました: $csvFilePath"
|
||||
}
|
||||
$output | Export-Csv -Path "output.csv" -NoTypeInformation -Encoding UTF8
|
||||
$output | Format-Table -AutoSize
|
||||
|
||||
- name: Configure Git
|
||||
run: |
|
||||
|
||||
Reference in New Issue
Block a user