| 365 | * This follows the Dynamic Args Pattern recommended in component-development.md |
| 366 | */ |
| 367 | const buildAmassArgs = (options: BuildAmassArgsOptions): string[] => { |
| 368 | const args: string[] = ['enum']; |
| 369 | |
| 370 | // CRITICAL: Always use -silent to prevent progress bar spam |
| 371 | // Without this, Amass outputs "0 / 1 [____]" to stderr hundreds of times per second |
| 372 | // This floods Loki and can cause system overload (see incident report) |
| 373 | args.push('-silent'); |
| 374 | |
| 375 | // Domain file input |
| 376 | args.push('-df', options.domainFile); |
| 377 | |
| 378 | // Passive mode - recommended for quick scans |
| 379 | if (options.passive) { |
| 380 | args.push('-passive'); |
| 381 | } |
| 382 | |
| 383 | // Active techniques (zone transfers, cert grabs) |
| 384 | if (options.active) { |
| 385 | args.push('-active'); |
| 386 | } |
| 387 | |
| 388 | // Brute force |
| 389 | if (options.bruteForce) { |
| 390 | args.push('-brute'); |
| 391 | } |
| 392 | |
| 393 | // Alterations engine |
| 394 | if (options.enableAlterations) { |
| 395 | args.push('-alts'); |
| 396 | } |
| 397 | |
| 398 | // Include IP addresses |
| 399 | if (options.includeIps) { |
| 400 | args.push('-ip'); |
| 401 | } |
| 402 | |
| 403 | // Recursive brute forcing |
| 404 | if (!options.recursive) { |
| 405 | args.push('-norecursive'); |
| 406 | } else if (typeof options.minForRecursive === 'number' && options.minForRecursive >= 1) { |
| 407 | args.push('-min-for-recursive', String(options.minForRecursive)); |
| 408 | } |
| 409 | |
| 410 | // Max depth |
| 411 | if (typeof options.maxDepth === 'number' && options.maxDepth >= 1) { |
| 412 | args.push('-max-depth', String(options.maxDepth)); |
| 413 | } |
| 414 | |
| 415 | // DNS query rate |
| 416 | if (typeof options.dnsQueryRate === 'number' && options.dnsQueryRate >= 1) { |
| 417 | args.push('-dns-qps', String(options.dnsQueryRate)); |
| 418 | } |
| 419 | |
| 420 | // Timeout |
| 421 | if (typeof options.timeoutMinutes === 'number' && options.timeoutMinutes >= 1) { |
| 422 | args.push('-timeout', String(options.timeoutMinutes)); |
| 423 | } |
| 424 | |