mirror of
https://github.com/Yamato-Security/WELA.git
synced 2025-12-06 09:12:46 +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
|
- name: Generate csv from auditpol /list /subcategory:* /r
|
||||||
run: |
|
run: |
|
||||||
$output = auditpol /list /subcategory:* /r
|
$data = auditpol /list /subcategory:* /r
|
||||||
$data = $output | Select-Object -Skip 1 | Where-Object { $_ -match '.+\s{2,}.+' }
|
$category = ""
|
||||||
$csvData = $data | ForEach-Object {
|
foreach ($line in $data) {
|
||||||
$columns = $_ -split "\s{2,}"
|
if ($line -match "^Category/Subcategory") { continue }
|
||||||
[PSCustomObject]@{
|
if ($line -match "^\s+(.+),\{(.+)\}$") {
|
||||||
"Subcategory" = $columns[0].Trim()
|
$subcategory = $matches[1].Trim()
|
||||||
"Subcategory GUID" = $columns[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
|
$output | Export-Csv -Path "output.csv" -NoTypeInformation -Encoding UTF8
|
||||||
Write-Output "CSVファイルが作成されました: $csvFilePath"
|
$output | Format-Table -AutoSize
|
||||||
|
|
||||||
- name: Configure Git
|
- name: Configure Git
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
Reference in New Issue
Block a user