-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvalidate_all.ps1
More file actions
35 lines (33 loc) · 1.36 KB
/
Copy pathvalidate_all.ps1
File metadata and controls
35 lines (33 loc) · 1.36 KB
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
# Validar JSON — usa caminho relativo ao diretório do projeto
$projectDir = Split-Path -Parent $MyInvocation.MyCommand.Path
$opsFile = Join-Path $projectDir 'v10\allowed-operations.json'
try {
$json = Get-Content $opsFile -Raw | ConvertFrom-Json
$count = if ($json.operations) { $json.operations.Count } else { $json.Count }
Write-Output "✅ JSON valido - operacoes: $count"
} catch {
Write-Output "❌ JSON Erro: $($_.Exception.Message)"
}
# Validar HTML
$htmlFile = Join-Path $projectDir 'v10\index.html'
$content = Get-Content $htmlFile -Raw
if ($content -match 'chmod_644') {
Write-Output "✅ chmod 644 encontrado no HTML"
}
if ($content -match 'chown user:group') {
Write-Output "✅ chown user:group encontrado no HTML"
}
$chmodCount = ([regex]::Matches($content, 'chmod_')).Count
$chownCount = ([regex]::Matches($content, 'chown ')).Count
Write-Output "✅ Comandos chmod no HTML: $chmodCount"
Write-Output "✅ Comandos chown no HTML: $chownCount"
# Contar subcategorias de seguranca
$secStart = $content.IndexOf('cat_sec')
if ($secStart -ge 0) {
$secEnd = $content.IndexOf('];', $secStart)
$secSection = $content.Substring($secStart, $secEnd - $secStart)
$subCount = ([regex]::Matches($secSection, 'label:')).Count
Write-Output "✅ Subcategorias na categoria Seguranca: $subCount"
} else {
Write-Output "⚠️ Categoria 'cat_sec' não encontrada no HTML"
}