displayFullScreen 全屏显示扫描状态
()
| 180 | |
| 181 | // displayFullScreen 全屏显示扫描状态 |
| 182 | func (rp *ResultProcessor) displayFullScreen() { |
| 183 | // 清屏 |
| 184 | fmt.Print("\033[2J\033[H") |
| 185 | |
| 186 | // 显示标题 |
| 187 | fmt.Printf("扫描进行中...\n") |
| 188 | fmt.Printf("═══════════════════════════════════════════════════════════════\n\n") |
| 189 | |
| 190 | // 计算进度百分比 |
| 191 | var percentage float64 |
| 192 | if rp.totalTargets > 0 { |
| 193 | percentage = float64(rp.totalCount) / float64(rp.totalTargets) * 100 |
| 194 | } |
| 195 | |
| 196 | // 计算进度条长度(总共50个字符) |
| 197 | const progressBarLength = 50 |
| 198 | filledLength := int(percentage / 100 * progressBarLength) |
| 199 | |
| 200 | // 构建进度条 |
| 201 | progressBar := "" |
| 202 | for i := 0; i < progressBarLength; i++ { |
| 203 | if i < filledLength { |
| 204 | progressBar += "▋" |
| 205 | } else { |
| 206 | progressBar += " " |
| 207 | } |
| 208 | } |
| 209 | |
| 210 | // 显示进度条 |
| 211 | fmt.Printf("[%s] %.1f%%\n", progressBar, percentage) |
| 212 | fmt.Printf("已扫描: %d | 发现合规: %d | 错误: %d\n", |
| 213 | rp.totalCount, rp.feasibleCount, rp.errorCount) |
| 214 | |
| 215 | if rp.totalTargets > 0 { |
| 216 | remaining := rp.totalTargets - rp.totalCount |
| 217 | fmt.Printf("剩余: %d\n", remaining) |
| 218 | } |
| 219 | |
| 220 | fmt.Printf("\n") |
| 221 | |
| 222 | // 显示最近的成功结果(最多显示最后10个) |
| 223 | if len(rp.successResults) > 0 { |
| 224 | fmt.Printf("最近发现的合规目标:\n") |
| 225 | fmt.Printf("─────────────────────────────────────────────────────────────\n") |
| 226 | |
| 227 | start := 0 |
| 228 | if len(rp.successResults) > 10 { |
| 229 | start = len(rp.successResults) - 10 |
| 230 | } |
| 231 | |
| 232 | for i := start; i < len(rp.successResults); i++ { |
| 233 | result := rp.successResults[i] |
| 234 | fmt.Printf("✅ %s (%s) - %s [%dms]\n", |
| 235 | result.IP, result.CertDomain, result.GeoCode, result.ResponseTime) |
| 236 | } |
| 237 | } |
| 238 | } |
| 239 |
no outgoing calls
no test coverage detected