@extends('layouts.app') @section('title', '滲透測試報告') @section('content')
{{-- 頁首操作列 --}}
返回掃描清單
@if($penTest->status === 'done') 匯出 PDF 重新掃描 @endif
@csrf @method('DELETE')
{{-- 基本資訊 --}} @php $modeInfo = $scanModes[$penTest->scan_mode] ?? ['label'=>$penTest->scan_mode,'icon'=>'bi-circle','desc'=>'']; $scannerInfo = $scannerTypes[$penTest->scanner_type ?? 'nmap'] ?? ['label'=>'Nmap','color'=>'danger']; $sec = $penTest->durationSeconds(); $dur = $sec ? ($sec>=60 ? floor($sec/60).'m '.($sec%60).'s' : $sec.'s') : null; @endphp
掃描目標
{{ $penTest->target }}
@if($penTest->project)
{{ $penTest->project->name }}
@endif
掃描工具
{{ $penTest->scannerLabel() }}
{{ $modeInfo['label'] }}
狀態
@if($penTest->status==='done') 完成 @elseif($penTest->status==='running') 執行中 @elseif($penTest->status==='failed') 失敗 @else 待執行 @endif
開始
{{ $penTest->started_at?->format('Y-m-d H:i:s') ?? '—' }}
結束
{{ $penTest->finished_at?->format('H:i:s') ?? '—' }}
@if($dur)
{{ $dur }}
@endif
{{-- 即時 log --}} @if(in_array($penTest->status, ['pending','running']))
掃描進行中 每 5 秒更新
等待輸出…
@endif {{-- 失敗 --}} @if($penTest->status === 'failed' && $penTest->error_log)
錯誤訊息:
{{ $penTest->error_log }}
@endif {{-- 結果 --}} @if($penTest->status === 'done') @php $bySev = $summary['by_severity'] ?? []; $total = $summary['total'] ?? 0; $openPorts = $summary['open_ports'] ?? 0; $hostsUp = $summary['hosts_up'] ?? 0; $pagesScanned = $summary['pages_scanned'] ?? null; $byOwasp = $summary['by_owasp'] ?? []; $fileCount = $summary['file_count'] ?? null; $sevCounts = []; foreach($findings as $f) { $s=$f['severity']??'info'; $sevCounts[$s]=($sevCounts[$s]??0)+1; } @endphp {{-- 統計 --}}
{{ $total }}
總計
@if($openPorts > 0)
{{ $openPorts }}
開放埠
@endif @foreach(['critical'=>['danger','嚴重'],'high'=>['warning','高'],'medium'=>['info','中'],'low'=>['primary','低'],'info'=>['secondary','資訊']] as $sev=>[$col,$lbl])
{{ $bySev[$sev] ?? 0 }}
{{ $lbl }}
@endforeach
{{-- 掃描範圍提示 --}} @php $hasMeta = ($hostsUp > 0 || $pagesScanned !== null); @endphp @if($hasMeta)
@if($hostsUp > 0) 存活主機:{{ $hostsUp }} 開放埠:{{ $openPorts }} @endif @if($pagesScanned !== null) 掃描頁面:{{ number_format($pagesScanned) }} @endif
@endif {{-- OWASP 分類(Nikto 會有)--}} @if(!empty($byOwasp))
OWASP Top 10
@php $owaspLabels = \App\Models\VulnScan::owaspLabels(); @endphp @foreach($owaspLabels as $oid => $olabel) @php $cnt = $byOwasp[$oid] ?? 0; @endphp
{{ $oid }} {{ $olabel }} @if($cnt>0){{ $cnt }} @else-@endif
@endforeach
@endif {{-- 發現清單 --}}
@foreach(['critical'=>['danger','嚴重'],'high'=>['warning','高'],'medium'=>['info','中'],'low'=>['primary','低'],'info'=>['secondary','資訊']] as $sev=>[$col,$lbl]) @if(($sevCounts[$sev]??0)>0) @endif @endforeach
@if(($penTest->scanner_type ?? 'nmap') === 'nmap') @else @endif @forelse($findings as $f) @php $sev = $f['severity'] ?? 'info'; $col = ['critical'=>'danger','high'=>'warning','medium'=>'info','low'=>'primary','info'=>'secondary'][$sev] ?? 'secondary'; $textCls = in_array($sev,['high','medium']) ? ' text-dark' : ''; $search = strtolower(($f['matched_at']??'').($f['service']??'').($f['port']??'').($f['version']??'').($f['name']??'').($f['description']??'')); @endphp @if(($penTest->scanner_type ?? 'nmap') === 'nmap') @else @endif @empty @endforelse
嚴重度 目標 / URL埠/協定 服務 版本 / 說明問題說明 修補建議
{{ strtoupper($sev) }} {{ $f['matched_at'] ?? '—' }}{{ $f['port'] ?? '—' }}/{{ $f['protocol'] ?? 'tcp' }} {{ $f['service'] ?? '—' }} @if(!empty($f['version']))
{{ $f['version'] }}
@endif {{ $f['description'] ?? '' }} @if(!empty($f['script_output']))
Script 輸出
{{ $f['script_output'] }}
@endif
{{ $f['description'] ?? $f['name'] ?? '—' }} {{ $f['remediation'] ?? '' }}
未發現安全問題
@endif
@endsection @push('scripts') @endpush