pentesting 0.12.12 → 0.14.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -11,61 +11,18 @@
11
11
  A U T O N O M O U S S E C U R I T Y A G E N T
12
12
  ```
13
13
 
14
- **v0.12.10 | Multi-Agent System | 50+ Security Tools**
15
14
 
16
15
  [![npm](https://img.shields.io/badge/npm-pentesting-red)](https://www.npmjs.org/package/pentesting)
17
- [![Docker](https://img.shields.io/badge/docker-kalilinux%2Fkali--rolling-blue)](https://hub.docker.com/r/kalilinux/kali-rolling)
18
- [![License: MIT](https://img.shields.io/badge/License-MIT-red.svg)](https://opensource.org/licenses/MIT)
19
16
 
20
17
  </div>
21
18
 
22
19
  ---
23
20
 
24
- ## ⚠️ Requirements
25
-
26
- **This agent requires Kali Linux environment for full functionality.**
27
-
28
- ### Option 1: Native Kali Linux (Recommended)
29
- ```bash
30
- # On Kali Linux
31
- sudo apt update && sudo apt install -y kali-linux-headless nodejs npm
32
- npm install -g pentesting
33
- pentesting
34
- ```
35
-
36
- ### Option 2: Docker with Kali Image
37
- ```bash
38
- # Pull official Kali Linux image
39
- docker pull kalilinux/kali-rolling
40
-
41
- # Run with full tools
42
- docker run -it --rm --network host \
43
- -e PENTEST_API_KEY="your_key" \
44
- -e PENTEST_BASE_URL="https://api.openai.com/v1" \
45
- -e PENTEST_MODEL="gpt-4-turbo" \
46
- kalilinux/kali-rolling bash -c "
47
- apt update && apt install -y nodejs npm kali-tools-top10 && \
48
- npm install -g pentesting && \
49
- pentesting
50
- "
51
- ```
52
-
53
- ### Option 3: Kali on WSL2 (Windows)
54
- ```bash
55
- # Install Kali from Microsoft Store, then:
56
- sudo apt update && sudo apt install -y kali-linux-headless nodejs npm
57
- sudo npm install -g pentesting
58
- pentesting
59
- ```
60
-
61
- ---
62
-
63
21
  ## Quick Start
64
22
 
65
23
  ```bash
66
24
  npm install -g pentesting
67
25
 
68
- # requirements
69
26
  export PENTEST_API_KEY="your_api_key"
70
27
  export PENTEST_BASE_URL="https://api.z.ai/api/anthropic"
71
28
  export PENTEST_MODEL="glm-4.7"
@@ -73,22 +30,14 @@ export PENTEST_MODEL="glm-4.7"
73
30
  pentesting
74
31
  ```
75
32
 
76
- **Note:** If a security tool is not installed, the agent will automatically attempt to install it using `apt`.
77
-
78
- ---
33
+ ## Purpose
79
34
 
80
- ## Core Features
35
+ This project is a pentesting tool that can be used to test the security of a system.
81
36
 
82
- | Feature | Description |
83
- |---------|-------------|
84
- | **Multi-Agent System** | 5 specialist agents (Recon, Web, Exploit, PrivEsc, Lateral) |
85
- | **Autonomous Orchestration** | Strategic planning, self-diagnostics, quality gates |
86
- | **50+ Security Tools** | nmap, sqlmap, ffuf, gobuster, hydra, metasploit... |
87
- | **Auto-Install** | Missing tools are automatically installed via apt |
88
- | **CTF Research** | Writeup search (0xdf, IppSec), scenario-based research |
89
- | **Audit & Safety** | Tool execution logging, risk scoring, approval system |
37
+ ## issue report
90
38
 
91
- ---
39
+ email: agnusdei1207@gmail.com
40
+ linkedin: https://www.linkedin.com/in/sang-woo-park-158685393/en
92
41
 
93
42
  ## TUI Commands
94
43
 
@@ -113,44 +62,6 @@ pentesting
113
62
 
114
63
  ---
115
64
 
116
- ## Supported Tools
117
-
118
- The agent supports 50+ security tools. If a tool is missing, it will be installed automatically:
119
-
120
- | Category | Tools |
121
- |----------|-------|
122
- | **Reconnaissance** | nmap, rustscan, masscan, subfinder, amass |
123
- | **Web** | ffuf, gobuster, nikto, nuclei, sqlmap, whatweb |
124
- | **Exploitation** | metasploit, searchsploit, msfvenom |
125
- | **Credential** | hydra, john, hashcat, crackmapexec |
126
- | **Windows/AD** | impacket-*, bloodhound, kerbrute, enum4linux |
127
- | **Utilities** | netcat, socat, chisel, proxychains |
128
-
129
- ---
130
-
131
- ## Web Research (Playwright)
132
-
133
- The agent includes a powerful **Playwright-based web research** engine:
134
-
135
- - **CAPTCHA bypass** - Headless browser avoids detection
136
- - **Deep search** - Follows links and extracts content
137
- - **Multi-source** - Google, DuckDuckGo, exploit-db, CVE databases
138
- - **CTF research** - Searches 0xdf, ippsec, HackTheBox writeups
139
-
140
- ```bash
141
- # Features available in autonomous mode:
142
- # - searchGoogle(query)
143
- # - deepSearch(query, { depth: 2 })
144
- # - searchWriteups("htb box name")
145
- # - ctfResearch("Lame", "linux")
146
- ```
147
-
148
65
  ## Documentation
149
66
 
150
- - **[ARCHITECTURE.md](docs/ARCHITECTURE.md)** - System architecture
151
-
152
- ---
153
-
154
- ## License
155
-
156
- MIT | ⚠️ **For authorized security testing and CTF competitions only.**
67
+ - **[ARCHITECTURE.md](docs/ARCHITECTURE.md)** System architecture & data flow
@@ -5,7 +5,8 @@ var AGENT_STATUS = {
5
5
  PAUSED: "paused",
6
6
  STUCK: "stuck",
7
7
  WAITING_INPUT: "waiting_input",
8
- COMPLETED: "completed"
8
+ COMPLETED: "completed",
9
+ STOPPED: "stopped"
9
10
  };
10
11
  var PHASE_ID = {
11
12
  RECON: "recon",
@@ -72,6 +73,7 @@ var AGENT_EVENT = {
72
73
  PAUSED: "paused",
73
74
  RESUMED: "resumed",
74
75
  RESET: "reset",
76
+ STATUS_CHANGED: "status_changed",
75
77
  // Discoveries
76
78
  FINDING: "finding",
77
79
  CREDENTIAL: "credential",
@@ -101,6 +103,17 @@ var MESSAGE_TYPE = {
101
103
  SYSTEM: "system",
102
104
  RESULT: "result"
103
105
  };
106
+ var DEFAULTS = {
107
+ MAX_ITERATIONS: 200,
108
+ MAX_TOOL_CALLS_PER_ITERATION: 10,
109
+ DEFAULT_TIMEOUT: 6e4,
110
+ LONG_RUNNING_TIMEOUT: 6e5,
111
+ STUCK_THRESHOLD: 5,
112
+ STUCK_TIME_THRESHOLD: 3e5,
113
+ MAX_PHASE_ATTEMPTS: 20,
114
+ APPROVAL_TIMEOUT: 3e5
115
+ // 5 minutes
116
+ };
104
117
  var TOOL_NAME = {
105
118
  // System
106
119
  BASH: "bash",
@@ -236,7 +249,138 @@ var TOOL_NAME = {
236
249
  SEARCH_LINUX_PRIVESC: "search_linux_privesc",
237
250
  SEARCH_WINDOWS_PRIVESC: "search_windows_privesc",
238
251
  CTF_RESEARCH: "ctf_research",
239
- SECURITY_RESEARCH: "security_research"
252
+ SECURITY_RESEARCH: "security_research",
253
+ // Advanced Web Tools
254
+ XSSTRIKE: "xsstrike",
255
+ ARJUN: "arjun",
256
+ PARAMSPIDER: "paramspider",
257
+ COMMIX: "commix",
258
+ WPSCAN: "wpscan",
259
+ JOOMSCAN: "joomscan",
260
+ DROOPESCAN: "droopescan",
261
+ DALFOX: "dalfox",
262
+ SSRFMAP: "ssrfmap",
263
+ NOSQLMAP: "nosqlmap",
264
+ JWT_TOOL: "jwt_tool",
265
+ GITDUMPER: "gitdumper",
266
+ // Advanced Network & AD Tools
267
+ RESPONDER: "responder",
268
+ LIGOLO: "ligolo",
269
+ EVIL_WINRM: "evil_winrm",
270
+ NETEXEC: "netexec",
271
+ CERTIPY: "certipy",
272
+ RUBEUS: "rubeus",
273
+ MIMIKATZ: "mimikatz",
274
+ COVENANT: "covenant",
275
+ PYPYKATZ: "pypykatz",
276
+ LDEEP: "ldeep",
277
+ ADIDNSDUMP: "adidnsdump",
278
+ PETITPOTAM: "petitpotam",
279
+ PRINTERBUG: "printerbug",
280
+ // Advanced Exploitation
281
+ PWNTOOLS: "pwntools",
282
+ ROPPER: "ropper",
283
+ CHECKSEC: "checksec",
284
+ ONE_GADGET: "one_gadget",
285
+ ANGR: "angr",
286
+ GHIDRA: "ghidra",
287
+ // Deep Research
288
+ SEARCH_CVE: "search_cve",
289
+ SEARCH_EXPLOIT_DB: "search_exploit_db",
290
+ DEEP_SEARCH: "deep_search",
291
+ FETCH_URL: "fetch_url",
292
+ // Advanced Web Exploitation (SSTI, Prototype Pollution, GraphQL, SSRF)
293
+ TPLMAP: "tplmap",
294
+ // SSTI exploitation
295
+ GRAPHQLMAP: "graphqlmap",
296
+ // GraphQL introspection & exploitation
297
+ CORS_SCANNER: "cors_scanner",
298
+ // CORS misconfiguration
299
+ CRLFUZZ: "crlfuzz",
300
+ // CRLF injection
301
+ SMUGGLER: "smuggler",
302
+ // HTTP request smuggling
303
+ YSOSERIAL: "ysoserial",
304
+ // Java deserialization
305
+ // Cloud & Container
306
+ CLOUDFOX: "cloudfox",
307
+ // AWS/Azure/GCP enumeration
308
+ PACU: "pacu",
309
+ // AWS exploitation framework
310
+ SCOUT_SUITE: "scout_suite",
311
+ // Multi-cloud security audit
312
+ TRIVY: "trivy",
313
+ // Container vulnerability scanner
314
+ KUBECTL: "kubectl",
315
+ // Kubernetes exploitation
316
+ DOCKER_ESCAPE: "docker_escape",
317
+ // Docker breakout tools
318
+ // Zero-Day Research & Fuzzing
319
+ AFL_FUZZ: "afl_fuzz",
320
+ // American Fuzzy Lop
321
+ BOOFUZZ: "boofuzz",
322
+ // Network protocol fuzzing
323
+ SYZKALLER: "syzkaller",
324
+ // Kernel fuzzing
325
+ // Recursive Web Search
326
+ RECURSIVE_SEARCH: "recursive_search",
327
+ // Deep recursive URL crawling
328
+ WAYBACK_MACHINE: "wayback_machine",
329
+ // Wayback Machine deep dive
330
+ UNIFIED_SEARCH: "unified_search",
331
+ // Multi-engine unified search
332
+ ZERO_DAY_RESEARCH: "zero_day_research",
333
+ // Multi-source 0day/PoC research
334
+ // Mobile & API Testing
335
+ FRIDA: "frida",
336
+ // Dynamic instrumentation
337
+ OBJECTION: "objection",
338
+ // Runtime mobile exploration
339
+ APKTOOL: "apktool",
340
+ // Android APK reverse engineering
341
+ MITMPROXY: "mitmproxy",
342
+ // TLS interception proxy
343
+ POSTMAN: "postman",
344
+ // API endpoint testing
345
+ // Wireless & Network MITM
346
+ AIRCRACK_NG: "aircrack_ng",
347
+ // Wireless cracking suite
348
+ REAVER: "reaver",
349
+ // WPS brute force
350
+ BETTERCAP: "bettercap",
351
+ // Network attack & monitoring
352
+ WIFITE: "wifite",
353
+ // Automated wireless attack
354
+ // Active Directory — Advanced
355
+ COERCER: "coercer",
356
+ // Authentication coercion (PetitPotam/PrinterBug unified)
357
+ NTLMRELAYX: "ntlmrelayx",
358
+ // NTLM relay attacks
359
+ KRBRELAYX: "krbrelayx",
360
+ // Kerberos relay attacks
361
+ NOPAC: "nopac",
362
+ // SAM-Account-Name spoofing (CVE-2021-42278/42287)
363
+ ZEROLOGON: "zerologon",
364
+ // ZeroLogon exploit (CVE-2020-1472)
365
+ // Social Engineering & Phishing
366
+ GOPHISH: "gophish",
367
+ // Phishing framework
368
+ EVILGINX: "evilginx",
369
+ // Adversary-in-the-middle phishing
370
+ // Advanced Code Analysis & Research
371
+ CODEQL: "codeql",
372
+ // Semantic code analysis for vulns
373
+ SEMGREP: "semgrep",
374
+ // Static analysis pattern matching
375
+ RET2DLRESOLVE: "ret2dlresolve",
376
+ // Return-oriented exploitation
377
+ KERNEL_EXPLOIT: "kernel_exploit",
378
+ // Kernel exploitation toolkit
379
+ // Continuous Persistent Search
380
+ CONTINUOUS_SEARCH: "continuous_search",
381
+ // Persistent background research
382
+ EXPLOIT_CHAIN_RESEARCH: "exploit_chain_research"
383
+ // Multi-stage exploit chain discovery
240
384
  };
241
385
  var APT_PACKAGE = {
242
386
  // Network
@@ -451,7 +595,113 @@ var TOOL_TO_APT = {
451
595
  [TOOL_NAME.SEARCH_LINUX_PRIVESC]: null,
452
596
  [TOOL_NAME.SEARCH_WINDOWS_PRIVESC]: null,
453
597
  [TOOL_NAME.CTF_RESEARCH]: null,
454
- [TOOL_NAME.SECURITY_RESEARCH]: null
598
+ [TOOL_NAME.SECURITY_RESEARCH]: null,
599
+ // Advanced Web Tools (pip/go install)
600
+ [TOOL_NAME.XSSTRIKE]: null,
601
+ [TOOL_NAME.ARJUN]: null,
602
+ [TOOL_NAME.PARAMSPIDER]: null,
603
+ [TOOL_NAME.COMMIX]: null,
604
+ [TOOL_NAME.WPSCAN]: null,
605
+ [TOOL_NAME.JOOMSCAN]: null,
606
+ [TOOL_NAME.DROOPESCAN]: null,
607
+ [TOOL_NAME.DALFOX]: null,
608
+ [TOOL_NAME.SSRFMAP]: null,
609
+ [TOOL_NAME.NOSQLMAP]: null,
610
+ [TOOL_NAME.JWT_TOOL]: null,
611
+ [TOOL_NAME.GITDUMPER]: null,
612
+ // Advanced Network & AD Tools
613
+ [TOOL_NAME.RESPONDER]: null,
614
+ [TOOL_NAME.LIGOLO]: null,
615
+ [TOOL_NAME.EVIL_WINRM]: APT_PACKAGE.EVIL_WINRM,
616
+ [TOOL_NAME.NETEXEC]: null,
617
+ [TOOL_NAME.CERTIPY]: null,
618
+ [TOOL_NAME.RUBEUS]: null,
619
+ [TOOL_NAME.MIMIKATZ]: null,
620
+ [TOOL_NAME.COVENANT]: null,
621
+ [TOOL_NAME.PYPYKATZ]: null,
622
+ [TOOL_NAME.LDEEP]: null,
623
+ [TOOL_NAME.ADIDNSDUMP]: null,
624
+ [TOOL_NAME.PETITPOTAM]: null,
625
+ [TOOL_NAME.PRINTERBUG]: null,
626
+ // Advanced Exploitation
627
+ [TOOL_NAME.PWNTOOLS]: null,
628
+ [TOOL_NAME.ROPPER]: null,
629
+ [TOOL_NAME.CHECKSEC]: null,
630
+ [TOOL_NAME.ONE_GADGET]: null,
631
+ [TOOL_NAME.ANGR]: null,
632
+ [TOOL_NAME.GHIDRA]: null,
633
+ // Deep Research (no apt package)
634
+ [TOOL_NAME.SEARCH_CVE]: null,
635
+ [TOOL_NAME.SEARCH_EXPLOIT_DB]: null,
636
+ [TOOL_NAME.DEEP_SEARCH]: null,
637
+ [TOOL_NAME.FETCH_URL]: null,
638
+ // Advanced Web Exploitation
639
+ [TOOL_NAME.TPLMAP]: null,
640
+ [TOOL_NAME.GRAPHQLMAP]: null,
641
+ [TOOL_NAME.CORS_SCANNER]: null,
642
+ [TOOL_NAME.CRLFUZZ]: null,
643
+ [TOOL_NAME.SMUGGLER]: null,
644
+ [TOOL_NAME.YSOSERIAL]: null,
645
+ // Cloud & Container
646
+ [TOOL_NAME.CLOUDFOX]: null,
647
+ [TOOL_NAME.PACU]: null,
648
+ [TOOL_NAME.SCOUT_SUITE]: null,
649
+ [TOOL_NAME.TRIVY]: null,
650
+ [TOOL_NAME.KUBECTL]: null,
651
+ [TOOL_NAME.DOCKER_ESCAPE]: null,
652
+ // Zero-Day Research & Fuzzing
653
+ [TOOL_NAME.AFL_FUZZ]: null,
654
+ [TOOL_NAME.BOOFUZZ]: null,
655
+ [TOOL_NAME.SYZKALLER]: null,
656
+ // Recursive Web Search
657
+ [TOOL_NAME.RECURSIVE_SEARCH]: null,
658
+ [TOOL_NAME.WAYBACK_MACHINE]: null,
659
+ [TOOL_NAME.UNIFIED_SEARCH]: null,
660
+ [TOOL_NAME.ZERO_DAY_RESEARCH]: null,
661
+ // Mobile & API Testing
662
+ [TOOL_NAME.FRIDA]: null,
663
+ // pip install frida-tools
664
+ [TOOL_NAME.OBJECTION]: null,
665
+ // pip install objection
666
+ [TOOL_NAME.APKTOOL]: null,
667
+ // binary install
668
+ [TOOL_NAME.MITMPROXY]: null,
669
+ // pip install mitmproxy
670
+ [TOOL_NAME.POSTMAN]: null,
671
+ // binary install
672
+ // Wireless & Network MITM
673
+ [TOOL_NAME.AIRCRACK_NG]: "aircrack-ng",
674
+ [TOOL_NAME.REAVER]: "reaver",
675
+ [TOOL_NAME.BETTERCAP]: null,
676
+ // go install
677
+ [TOOL_NAME.WIFITE]: null,
678
+ // pip install
679
+ // Active Directory — Advanced
680
+ [TOOL_NAME.COERCER]: null,
681
+ // pip install
682
+ [TOOL_NAME.NTLMRELAYX]: null,
683
+ // impacket
684
+ [TOOL_NAME.KRBRELAYX]: null,
685
+ // pip install
686
+ [TOOL_NAME.NOPAC]: null,
687
+ // python script
688
+ [TOOL_NAME.ZEROLOGON]: null,
689
+ // python script
690
+ // Social Engineering & Phishing
691
+ [TOOL_NAME.GOPHISH]: null,
692
+ // binary install
693
+ [TOOL_NAME.EVILGINX]: null,
694
+ // go install
695
+ // Advanced Code Analysis & Research
696
+ [TOOL_NAME.CODEQL]: null,
697
+ // binary install
698
+ [TOOL_NAME.SEMGREP]: null,
699
+ // pip install
700
+ [TOOL_NAME.RET2DLRESOLVE]: null,
701
+ [TOOL_NAME.KERNEL_EXPLOIT]: null,
702
+ // Continuous Persistent Search
703
+ [TOOL_NAME.CONTINUOUS_SEARCH]: null,
704
+ [TOOL_NAME.EXPLOIT_CHAIN_RESEARCH]: null
455
705
  };
456
706
  var SENSITIVE_TOOLS = [
457
707
  TOOL_NAME.WRITE_FILE,
@@ -462,10 +712,63 @@ var SENSITIVE_TOOLS = [
462
712
  TOOL_NAME.GENERATE_PAYLOAD,
463
713
  TOOL_NAME.LATERAL_MOVEMENT
464
714
  ];
715
+ var RESOURCE_THRESHOLD = {
716
+ MEMORY_WARNING: 0.7,
717
+ MEMORY_CRITICAL: 0.85,
718
+ CONTEXT_TOKEN_LIMIT: 1e5,
719
+ CHECK_INTERVAL_MS: 1e4
720
+ };
721
+ var AGENT_CONFIG = {
722
+ // Core
723
+ MAX_ITERATIONS: 200,
724
+ MAX_TOOL_CALLS_PER_ITERATION: 10,
725
+ DEFAULT_TIMEOUT: 6e4,
726
+ LONG_RUNNING_TIMEOUT: 6e5,
727
+ // Stuck Detection
728
+ STUCK_THRESHOLD: 5,
729
+ STUCK_TIME_THRESHOLD: 3e5,
730
+ MAX_PHASE_ATTEMPTS: 20,
731
+ // Context Management
732
+ MAX_CONTEXT_TOKENS: 1e5,
733
+ CONTEXT_COMPACTION_THRESHOLD: 0.8,
734
+ // Resource Management
735
+ MEMORY_WARNING_THRESHOLD: 0.7,
736
+ MEMORY_CRITICAL_THRESHOLD: 0.85,
737
+ RESOURCE_CHECK_INTERVAL: 1e4,
738
+ // Approval
739
+ APPROVAL_TIMEOUT: 6e4,
740
+ // Audit
741
+ AUDIT_MAX_ENTRIES: 1e3,
742
+ AUDIT_RETENTION_DAYS: 7
743
+ };
465
744
 
466
745
  // src/config/constants.ts
467
- var APP_NAME = "pentesting";
468
- var APP_VERSION = "0.12.12";
746
+ import { homedir } from "os";
747
+ import { join } from "path";
748
+ var PENTEST_ROOT = join(homedir(), ".pentesting");
749
+ var PATHS = {
750
+ /** Root directory for all pentesting data: ~/.pentesting */
751
+ ROOT: PENTEST_ROOT,
752
+ /** Session snapshots and wire logs */
753
+ SESSIONS: join(PENTEST_ROOT, "sessions"),
754
+ /** Self-reflection learning data */
755
+ LEARNING: join(PENTEST_ROOT, "learning"),
756
+ /** Audit logs */
757
+ AUDIT: join(PENTEST_ROOT, "audit"),
758
+ /** User skill definitions (SKILL.md files) */
759
+ SKILLS: join(PENTEST_ROOT, "skills"),
760
+ /** Context checkpoints for undo/revert */
761
+ CHECKPOINTS: join(PENTEST_ROOT, "checkpoints"),
762
+ /** Config files (config.toml / config.json) */
763
+ CONFIG_TOML: join(PENTEST_ROOT, "config.toml"),
764
+ CONFIG_JSON: join(PENTEST_ROOT, "config.json"),
765
+ /** Agent spec YAML files */
766
+ AGENT_SPECS: join("src", "agents", "specs")
767
+ };
768
+ function getPath(base, ...segments) {
769
+ return join(base, ...segments);
770
+ }
771
+ var APP_VERSION = "0.14.1";
469
772
  var APP_DESCRIPTION = "Autonomous Penetration Testing AI Agent";
470
773
  var LLM_API_KEY = process.env.PENTEST_API_KEY || process.env.ANTHROPIC_API_KEY || "";
471
774
  var LLM_BASE_URL = process.env.PENTEST_BASE_URL || void 0;
@@ -479,7 +782,7 @@ var CONTEXT_WINDOW = {
479
782
  reservedTokens: 4e3
480
783
  // Reserved for system prompt
481
784
  };
482
- var AGENT_CONFIG = {
785
+ var AGENT_CONFIG2 = {
483
786
  maxIterations: 200,
484
787
  maxToolCallsPerIteration: 10,
485
788
  autoApprove: false,
@@ -511,9 +814,13 @@ export {
511
814
  AGENT_EVENT,
512
815
  CLI_COMMAND,
513
816
  MESSAGE_TYPE,
817
+ DEFAULTS,
514
818
  TOOL_NAME,
515
819
  TOOL_TO_APT,
516
- APP_NAME,
820
+ RESOURCE_THRESHOLD,
821
+ AGENT_CONFIG,
822
+ PATHS,
823
+ getPath,
517
824
  APP_VERSION,
518
825
  APP_DESCRIPTION,
519
826
  LLM_API_KEY,
@@ -521,5 +828,5 @@ export {
521
828
  LLM_MODEL,
522
829
  LLM_MAX_TOKENS,
523
830
  CONTEXT_WINDOW,
524
- AGENT_CONFIG
831
+ AGENT_CONFIG2
525
832
  };
@@ -1,3 +1,56 @@
1
+ // src/constants/_shared/timing.const.ts
2
+ var TIMEOUT = {
3
+ // 재시도 지연
4
+ RETRY_INITIAL: 300,
5
+ RETRY_MAX: 1e4,
6
+ // 네트워크 타임아웃
7
+ HTTP_REQUEST: 3e4,
8
+ // 30초
9
+ API_CALL: 15e3,
10
+ // 15초
11
+ WEBSOCKET_CONNECT: 5e3,
12
+ // 5초
13
+ // 도구 실행 타임아웃
14
+ TOOL_DEFAULT: 3e5,
15
+ // 5분
16
+ TOOL_SCAN: 6e5,
17
+ // 10분
18
+ TOOL_EXPLOIT: 18e4,
19
+ // 3분
20
+ TOOL_ANALYSIS: 12e4,
21
+ // 2분 - 분석 도구용
22
+ // UI 업데이트 인터벌
23
+ STATUS_UPDATE: 1e3,
24
+ // 1초
25
+ PROGRESS_UPDATE: 500,
26
+ // 0.5초
27
+ // 세션/체크포인트
28
+ CHECKPOINT_INTERVAL: 3e4,
29
+ // 30초
30
+ SESSION_CLEANUP: 7 * 24 * 60 * 60 * 1e3,
31
+ // 7일
32
+ CHECKPOINT_RETENTION: 30 * 24 * 60 * 60 * 1e3,
33
+ // 30일
34
+ // 감시/감사 임계값
35
+ AUDIT_LONG_EXECUTION: 3e5,
36
+ // 5분 - 비정상적으로 긴 실행 시간 감지
37
+ // 리스너/백그라운드 서비스 타임아웃
38
+ LISTENER_TIMEOUT: 36e5
39
+ // 1시간 - 리스너/백그라운드 서비스용
40
+ };
41
+ var DELAY = {
42
+ // 짧은 지연
43
+ SHORT: 100,
44
+ MEDIUM: 500,
45
+ LONG: 1e3,
46
+ // 재시도 백오프
47
+ BACKOFF_BASE: 1e3,
48
+ BACKOFF_MAX: 6e4,
49
+ // 사용자 확인 타임아웃
50
+ CONFIRMATION_TIMEOUT: 1e4
51
+ // 10초 (Ctrl+C 더블 프레스 확인 등)
52
+ };
53
+
1
54
  // src/core/tools/web-search.ts
2
55
  var browser = null;
3
56
  var browserContext = null;
@@ -128,7 +181,7 @@ async function searchGoogle(query, options = {}) {
128
181
  waitUntil: "domcontentloaded"
129
182
  });
130
183
  }
131
- await page.waitForSelector("h3", { timeout: 1e4 }).catch(() => {
184
+ await page.waitForSelector("h3", { timeout: TIMEOUT.RETRY_MAX }).catch(() => {
132
185
  });
133
186
  const searchResults = await page.$$eval("div.g, div.tF2Cxc, div.MjjYud", (elements) => {
134
187
  return elements.map((el) => {
@@ -242,7 +295,7 @@ async function searchBrave(query, options = {}) {
242
295
  await page.goto("https://search.brave.com/search?q=" + encodeURIComponent(query), {
243
296
  waitUntil: "domcontentloaded"
244
297
  });
245
- await page.waitForSelector(".snippet", { timeout: 1e4 }).catch(() => {
298
+ await page.waitForSelector(".snippet", { timeout: TIMEOUT.RETRY_MAX }).catch(() => {
246
299
  });
247
300
  const searchResults = await page.$$eval("#results .snippet, .result, article, div.snippet", (elements) => {
248
301
  return elements.map((el) => {
@@ -433,8 +486,97 @@ async function ctfResearch(boxName, scenario) {
433
486
  ]);
434
487
  return { machine, scenario: scenarioResults, exploits, deepContent };
435
488
  }
489
+ async function recursiveSearch(query, options = {}) {
490
+ const { maxDepth = 2, maxPagesPerLevel = 3, timeout = 3e4 } = options;
491
+ const visited = /* @__PURE__ */ new Set();
492
+ const allResults = [];
493
+ async function crawlLevel(urls, currentDepth) {
494
+ if (currentDepth > maxDepth) return;
495
+ const unvisited = urls.filter((u) => !visited.has(u)).slice(0, maxPagesPerLevel);
496
+ for (const url of unvisited) {
497
+ visited.add(url);
498
+ let page = null;
499
+ try {
500
+ const context = await getFreshContext();
501
+ page = await context.newPage();
502
+ if (!page) continue;
503
+ page.setDefaultTimeout(timeout);
504
+ await page.goto(url, { waitUntil: "domcontentloaded" });
505
+ const content = await page.evaluate(() => {
506
+ document.querySelectorAll("script, style, nav, footer, header, aside").forEach((el) => el.remove());
507
+ const main = document.querySelector("main, article, .content, #content, .post-content") || document.body;
508
+ return main.textContent?.replace(/\s+/g, " ").trim().slice(0, 5e3) || "";
509
+ });
510
+ const links = await page.$$eval("a[href]", (anchors) => {
511
+ return anchors.map((a) => a.href).filter((href) => href.startsWith("http") && !href.includes("#")).slice(0, 15);
512
+ });
513
+ allResults.push({
514
+ title: await page.title(),
515
+ url,
516
+ snippet: content.slice(0, 200),
517
+ content,
518
+ links,
519
+ depth: currentDepth
520
+ });
521
+ if (currentDepth < maxDepth && links.length > 0) {
522
+ await crawlLevel(links, currentDepth + 1);
523
+ }
524
+ } catch {
525
+ } finally {
526
+ if (page) await page.close();
527
+ }
528
+ }
529
+ }
530
+ const initialResults = await unifiedSearch(query, { maxResults: maxPagesPerLevel });
531
+ const initialUrls = initialResults.map((r) => r.url).filter(Boolean);
532
+ await crawlLevel(initialUrls, 0);
533
+ return allResults;
534
+ }
535
+ async function waybackSearch(targetUrl, options = {}) {
536
+ const { limit = 20, timeout = 3e4 } = options;
537
+ const results = [];
538
+ let page = null;
539
+ try {
540
+ const context = await getFreshContext();
541
+ page = await context.newPage();
542
+ if (!page) return results;
543
+ page.setDefaultTimeout(timeout);
544
+ const cdxUrl = `https://web.archive.org/cdx/search/cdx?url=${encodeURIComponent(targetUrl)}&output=json&limit=${limit}&fl=timestamp,original,statuscode,mimetype`;
545
+ await page.goto(cdxUrl, { waitUntil: "domcontentloaded" });
546
+ const content = await page.evaluate(() => document.body.textContent || "");
547
+ try {
548
+ const parsed = JSON.parse(content);
549
+ for (let i = 1; i < parsed.length; i++) {
550
+ const [timestamp, url, status, mimeType] = parsed[i];
551
+ results.push({
552
+ timestamp,
553
+ url: `https://web.archive.org/web/${timestamp}/${url}`,
554
+ status,
555
+ mimeType
556
+ });
557
+ }
558
+ } catch {
559
+ }
560
+ } catch {
561
+ } finally {
562
+ if (page) await page.close();
563
+ }
564
+ return results;
565
+ }
566
+ async function zeroDayResearch(query) {
567
+ const [cves, pocs, advisories, githubExploits, nucleiTemplates] = await Promise.all([
568
+ unifiedSearch(`${query} site:nvd.nist.gov OR site:cve.mitre.org OR site:cvedetails.com`),
569
+ unifiedSearch(`${query} proof of concept exploit PoC site:github.com OR site:packetstormsecurity.com`),
570
+ unifiedSearch(`${query} security advisory bulletin site:security.snyk.io OR site:github.com/advisories`),
571
+ unifiedSearch(`${query} exploit RCE LFI site:github.com`),
572
+ unifiedSearch(`${query} nuclei template site:github.com/projectdiscovery`)
573
+ ]);
574
+ return { cves, pocs, advisories, githubExploits, nucleiTemplates };
575
+ }
436
576
 
437
577
  export {
578
+ TIMEOUT,
579
+ DELAY,
438
580
  closeBrowser,
439
581
  searchGoogle,
440
582
  searchDuckDuckGo,
@@ -453,5 +595,8 @@ export {
453
595
  searchLinuxPrivesc,
454
596
  searchWindowsPrivesc,
455
597
  securityResearch,
456
- ctfResearch
598
+ ctfResearch,
599
+ recursiveSearch,
600
+ waybackSearch,
601
+ zeroDayResearch
457
602
  };