@jshookmcp/jshook 0.2.5 → 0.2.6

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.
Files changed (210) hide show
  1. package/README.md +5 -5
  2. package/README.zh.md +5 -5
  3. package/dist/packages/extension-sdk/src/workflow.d.ts +17 -2
  4. package/dist/packages/extension-sdk/src/workflow.js +36 -0
  5. package/dist/src/modules/browser/BrowserPool.d.ts +49 -0
  6. package/dist/src/modules/browser/BrowserPool.js +288 -0
  7. package/dist/src/modules/deobfuscator/AdvancedDeobfuscator.d.ts +5 -0
  8. package/dist/src/modules/deobfuscator/AdvancedDeobfuscator.js +43 -2
  9. package/dist/src/modules/deobfuscator/Deobfuscator.js +5 -0
  10. package/dist/src/modules/external/ExternalToolRunner.js +1 -1
  11. package/dist/src/server/MCPServer.context.d.ts +1 -0
  12. package/dist/src/server/domains/browser/handlers/stealth-injection.d.ts +1 -0
  13. package/dist/src/server/domains/browser/handlers/stealth-injection.js +3 -0
  14. package/dist/src/server/domains/shared-state-board/definitions.d.ts +2 -0
  15. package/dist/src/server/domains/shared-state-board/definitions.js +78 -0
  16. package/dist/src/server/domains/shared-state-board/handlers.impl.d.ts +58 -0
  17. package/dist/src/server/domains/shared-state-board/handlers.impl.js +419 -0
  18. package/dist/src/server/domains/shared-state-board/index.d.ts +2 -0
  19. package/dist/src/server/domains/shared-state-board/index.js +2 -0
  20. package/dist/src/server/domains/shared-state-board/manifest.d.ts +57 -0
  21. package/dist/src/server/domains/shared-state-board/manifest.js +74 -0
  22. package/dist/src/server/http/SseStream.d.ts +21 -0
  23. package/dist/src/server/http/SseStream.js +129 -0
  24. package/dist/src/server/teams/TeamManager.d.ts +43 -0
  25. package/dist/src/server/teams/TeamManager.js +238 -0
  26. package/dist/src/server/teams/index.d.ts +1 -0
  27. package/dist/src/server/teams/index.js +1 -0
  28. package/dist/src/server/workflows/WorkflowContract.d.ts +20 -4
  29. package/dist/src/server/workflows/WorkflowContract.js +40 -0
  30. package/dist/src/server/workflows/WorkflowEngine.js +190 -13
  31. package/dist/src/types/deobfuscator.d.ts +1 -0
  32. package/dist/src/utils/cache/CachedDecorator.d.ts +8 -0
  33. package/dist/src/utils/cache/CachedDecorator.js +55 -0
  34. package/dist/src/utils/cache/PersistentCache.d.ts +33 -0
  35. package/dist/src/utils/cache/PersistentCache.js +246 -0
  36. package/dist/src/utils/cache/index.d.ts +2 -0
  37. package/dist/src/utils/cache/index.js +2 -0
  38. package/package.json +11 -12
  39. package/scripts/postinstall.cjs +54 -27
  40. package/workflows/anti-bot-diagnoser/.jshook-install.json +14 -0
  41. package/workflows/anti-bot-diagnoser/LICENSE +21 -0
  42. package/workflows/anti-bot-diagnoser/README.md +105 -0
  43. package/workflows/anti-bot-diagnoser/docs/agent-recipes.md +44 -0
  44. package/workflows/anti-bot-diagnoser/meta.yaml +6 -0
  45. package/workflows/anti-bot-diagnoser/package.json +22 -0
  46. package/workflows/anti-bot-diagnoser/tsconfig.json +15 -0
  47. package/workflows/anti-bot-diagnoser/workflow.ts +224 -0
  48. package/workflows/api-openapi-probe/.jshook-install.json +14 -0
  49. package/workflows/api-openapi-probe/meta.yaml +6 -0
  50. package/workflows/api-openapi-probe/package.json +22 -0
  51. package/workflows/api-openapi-probe/pnpm-lock.yaml +819 -0
  52. package/workflows/api-openapi-probe/tsconfig.json +15 -0
  53. package/workflows/api-openapi-probe/workflow.ts +40 -0
  54. package/workflows/api-probe-batch/.jshook-install.json +14 -0
  55. package/workflows/api-probe-batch/LICENSE +21 -0
  56. package/workflows/api-probe-batch/README.md +45 -0
  57. package/workflows/api-probe-batch/meta.yaml +4 -0
  58. package/workflows/api-probe-batch/package.json +23 -0
  59. package/workflows/api-probe-batch/tsconfig.json +16 -0
  60. package/workflows/api-probe-batch/workflow.ts +111 -0
  61. package/workflows/auth-bootstrap/.jshook-install.json +14 -0
  62. package/workflows/auth-bootstrap/LICENSE +21 -0
  63. package/workflows/auth-bootstrap/README.md +74 -0
  64. package/workflows/auth-bootstrap/meta.yaml +4 -0
  65. package/workflows/auth-bootstrap/package.json +23 -0
  66. package/workflows/auth-bootstrap/tsconfig.json +16 -0
  67. package/workflows/auth-bootstrap/workflow.ts +141 -0
  68. package/workflows/auth-extract/.jshook-install.json +14 -0
  69. package/workflows/auth-extract/meta.yaml +6 -0
  70. package/workflows/auth-extract/package.json +22 -0
  71. package/workflows/auth-extract/pnpm-lock.yaml +819 -0
  72. package/workflows/auth-extract/tsconfig.json +15 -0
  73. package/workflows/auth-extract/workflow.ts +36 -0
  74. package/workflows/auth-surface-mapper/.jshook-install.json +14 -0
  75. package/workflows/auth-surface-mapper/meta.yaml +6 -0
  76. package/workflows/auth-surface-mapper/package.json +22 -0
  77. package/workflows/auth-surface-mapper/pnpm-lock.yaml +819 -0
  78. package/workflows/auth-surface-mapper/tsconfig.json +15 -0
  79. package/workflows/auth-surface-mapper/workflow.ts +104 -0
  80. package/workflows/batch-register/.jshook-install.json +14 -0
  81. package/workflows/batch-register/LICENSE +21 -0
  82. package/workflows/batch-register/README.md +39 -0
  83. package/workflows/batch-register/meta.yaml +4 -0
  84. package/workflows/batch-register/package.json +23 -0
  85. package/workflows/batch-register/tsconfig.json +16 -0
  86. package/workflows/batch-register/workflow.ts +67 -0
  87. package/workflows/bundle-recovery/.jshook-install.json +14 -0
  88. package/workflows/bundle-recovery/LICENSE +21 -0
  89. package/workflows/bundle-recovery/README.md +105 -0
  90. package/workflows/bundle-recovery/docs/agent-recipes.md +44 -0
  91. package/workflows/bundle-recovery/meta.yaml +6 -0
  92. package/workflows/bundle-recovery/package.json +22 -0
  93. package/workflows/bundle-recovery/tsconfig.json +15 -0
  94. package/workflows/bundle-recovery/workflow.ts +179 -0
  95. package/workflows/challenge-detector/.jshook-install.json +14 -0
  96. package/workflows/challenge-detector/meta.yaml +14 -0
  97. package/workflows/challenge-detector/package.json +22 -0
  98. package/workflows/challenge-detector/pnpm-lock.yaml +819 -0
  99. package/workflows/challenge-detector/tsconfig.json +15 -0
  100. package/workflows/challenge-detector/workflow.ts +298 -0
  101. package/workflows/deobfuscation-pipeline/.jshook-install.json +14 -0
  102. package/workflows/deobfuscation-pipeline/meta.yaml +6 -0
  103. package/workflows/deobfuscation-pipeline/package.json +22 -0
  104. package/workflows/deobfuscation-pipeline/pnpm-lock.yaml +819 -0
  105. package/workflows/deobfuscation-pipeline/tsconfig.json +15 -0
  106. package/workflows/deobfuscation-pipeline/workflow.ts +119 -0
  107. package/workflows/electron-bridge-mapper/.jshook-install.json +14 -0
  108. package/workflows/electron-bridge-mapper/meta.yaml +6 -0
  109. package/workflows/electron-bridge-mapper/package.json +22 -0
  110. package/workflows/electron-bridge-mapper/pnpm-lock.yaml +819 -0
  111. package/workflows/electron-bridge-mapper/tsconfig.json +15 -0
  112. package/workflows/electron-bridge-mapper/workflow.ts +125 -0
  113. package/workflows/evidence-pack/.jshook-install.json +14 -0
  114. package/workflows/evidence-pack/LICENSE +21 -0
  115. package/workflows/evidence-pack/README.md +105 -0
  116. package/workflows/evidence-pack/docs/agent-recipes.md +44 -0
  117. package/workflows/evidence-pack/meta.yaml +6 -0
  118. package/workflows/evidence-pack/package.json +22 -0
  119. package/workflows/evidence-pack/tsconfig.json +15 -0
  120. package/workflows/evidence-pack/workflow.ts +154 -0
  121. package/workflows/js-bundle-search/.jshook-install.json +14 -0
  122. package/workflows/js-bundle-search/LICENSE +21 -0
  123. package/workflows/js-bundle-search/README.md +46 -0
  124. package/workflows/js-bundle-search/meta.yaml +4 -0
  125. package/workflows/js-bundle-search/package.json +23 -0
  126. package/workflows/js-bundle-search/tsconfig.json +16 -0
  127. package/workflows/js-bundle-search/workflow.ts +118 -0
  128. package/workflows/protocol-registry/.jshook-install.json +14 -0
  129. package/workflows/protocol-registry/meta.yaml +6 -0
  130. package/workflows/protocol-registry/package.json +22 -0
  131. package/workflows/protocol-registry/pnpm-lock.yaml +819 -0
  132. package/workflows/protocol-registry/tsconfig.json +15 -0
  133. package/workflows/protocol-registry/workflow.ts +107 -0
  134. package/workflows/qwen-mail-open-latest/meta.yaml +7 -0
  135. package/workflows/qwen-mail-open-latest/package.json +22 -0
  136. package/workflows/qwen-mail-open-latest/pnpm-lock.yaml +819 -0
  137. package/workflows/qwen-mail-open-latest/tsconfig.json +15 -0
  138. package/workflows/qwen-mail-open-latest/workflow.ts +77 -0
  139. package/workflows/register-account-flow/.jshook-install.json +14 -0
  140. package/workflows/register-account-flow/LICENSE +21 -0
  141. package/workflows/register-account-flow/README.md +64 -0
  142. package/workflows/register-account-flow/meta.yaml +4 -0
  143. package/workflows/register-account-flow/package.json +23 -0
  144. package/workflows/register-account-flow/tsconfig.json +16 -0
  145. package/workflows/register-account-flow/workflow.ts +127 -0
  146. package/workflows/replay-lab/.jshook-install.json +14 -0
  147. package/workflows/replay-lab/meta.yaml +6 -0
  148. package/workflows/replay-lab/package.json +22 -0
  149. package/workflows/replay-lab/pnpm-lock.yaml +819 -0
  150. package/workflows/replay-lab/tsconfig.json +15 -0
  151. package/workflows/replay-lab/workflow.ts +106 -0
  152. package/workflows/script-evidence-scan/.jshook-install.json +14 -0
  153. package/workflows/script-evidence-scan/LICENSE +21 -0
  154. package/workflows/script-evidence-scan/README.md +61 -0
  155. package/workflows/script-evidence-scan/meta.yaml +4 -0
  156. package/workflows/script-evidence-scan/package.json +23 -0
  157. package/workflows/script-evidence-scan/tsconfig.json +16 -0
  158. package/workflows/script-evidence-scan/workflow.ts +89 -0
  159. package/workflows/signature-hunter/.jshook-install.json +14 -0
  160. package/workflows/signature-hunter/LICENSE +21 -0
  161. package/workflows/signature-hunter/README.md +105 -0
  162. package/workflows/signature-hunter/docs/agent-recipes.md +44 -0
  163. package/workflows/signature-hunter/meta.yaml +6 -0
  164. package/workflows/signature-hunter/package.json +22 -0
  165. package/workflows/signature-hunter/tsconfig.json +15 -0
  166. package/workflows/signature-hunter/workflow.ts +170 -0
  167. package/workflows/signing-lineage/.jshook-install.json +14 -0
  168. package/workflows/signing-lineage/meta.yaml +6 -0
  169. package/workflows/signing-lineage/package.json +22 -0
  170. package/workflows/signing-lineage/pnpm-lock.yaml +819 -0
  171. package/workflows/signing-lineage/tsconfig.json +15 -0
  172. package/workflows/signing-lineage/workflow.ts +120 -0
  173. package/workflows/temp-mail-extract-link/.jshook-install.json +14 -0
  174. package/workflows/temp-mail-extract-link/LICENSE +21 -0
  175. package/workflows/temp-mail-extract-link/README.md +71 -0
  176. package/workflows/temp-mail-extract-link/meta.yaml +4 -0
  177. package/workflows/temp-mail-extract-link/package.json +23 -0
  178. package/workflows/temp-mail-extract-link/tsconfig.json +16 -0
  179. package/workflows/temp-mail-extract-link/workflow.ts +221 -0
  180. package/workflows/temp-mail-open-latest/.jshook-install.json +14 -0
  181. package/workflows/temp-mail-open-latest/LICENSE +21 -0
  182. package/workflows/temp-mail-open-latest/README.md +61 -0
  183. package/workflows/temp-mail-open-latest/meta.yaml +4 -0
  184. package/workflows/temp-mail-open-latest/package.json +23 -0
  185. package/workflows/temp-mail-open-latest/tsconfig.json +16 -0
  186. package/workflows/temp-mail-open-latest/workflow.ts +136 -0
  187. package/workflows/template/.jshook-install.json +14 -0
  188. package/workflows/template/LICENSE +21 -0
  189. package/workflows/template/README.md +45 -0
  190. package/workflows/template/docs/SKILL.md +111 -0
  191. package/workflows/template/meta.yaml +6 -0
  192. package/workflows/template/package.json +22 -0
  193. package/workflows/template/pnpm-lock.yaml +819 -0
  194. package/workflows/template/tsconfig.json +15 -0
  195. package/workflows/template/workflow.ts +73 -0
  196. package/workflows/web-api-capture-session/.jshook-install.json +14 -0
  197. package/workflows/web-api-capture-session/LICENSE +21 -0
  198. package/workflows/web-api-capture-session/README.md +64 -0
  199. package/workflows/web-api-capture-session/meta.yaml +4 -0
  200. package/workflows/web-api-capture-session/package.json +23 -0
  201. package/workflows/web-api-capture-session/tsconfig.json +16 -0
  202. package/workflows/web-api-capture-session/workflow.ts +124 -0
  203. package/workflows/ws-protocol-lifter/.jshook-install.json +14 -0
  204. package/workflows/ws-protocol-lifter/LICENSE +21 -0
  205. package/workflows/ws-protocol-lifter/README.md +105 -0
  206. package/workflows/ws-protocol-lifter/docs/agent-recipes.md +44 -0
  207. package/workflows/ws-protocol-lifter/meta.yaml +6 -0
  208. package/workflows/ws-protocol-lifter/package.json +22 -0
  209. package/workflows/ws-protocol-lifter/tsconfig.json +15 -0
  210. package/workflows/ws-protocol-lifter/workflow.ts +163 -0
@@ -0,0 +1,15 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2022",
4
+ "module": "NodeNext",
5
+ "moduleResolution": "NodeNext",
6
+ "noEmit": false,
7
+ "outDir": "dist",
8
+ "rootDir": ".",
9
+ "strict": true,
10
+ "skipLibCheck": true,
11
+ "types": ["node"]
12
+ },
13
+ "include": ["workflow.ts"],
14
+ "exclude": ["dist", "node_modules"]
15
+ }
@@ -0,0 +1,298 @@
1
+ import {
2
+ createWorkflow,
3
+ type WorkflowExecutionContext,
4
+ SequenceNodeBuilder,
5
+ } from '@jshookmcp/extension-sdk/workflow';
6
+
7
+ const workflowId = 'workflow.challenge-detector.v2';
8
+
9
+ export default createWorkflow(workflowId, 'Challenge Detector')
10
+ .description(
11
+ 'Detects and classifies browser challenges: Cloudflare Turnstile/JS Challenge, hCaptcha, reCAPTCHA, DataDome, Akamai Bot Manager, PerimeterX, Kasada, CTF platforms (JuiceShop, DVWA, HackTheBox, TryHackMe, OverTheWire, picoCTF), and custom JS detection scripts — producing a challenge report with bypass difficulty assessment.',
12
+ )
13
+ .tags(['reverse', 'captcha', 'challenge', 'cloudflare', 'antibot', 'detection', 'turnstile', 'mission', 'ctf', 'juiceshop', 'dvwa', 'hackthebox'])
14
+ .timeoutMs(8 * 60_000)
15
+ .defaultMaxConcurrency(4)
16
+ .buildGraph((ctx: WorkflowExecutionContext) => {
17
+ const prefix = 'workflows.challengeDetector';
18
+ const url = String(ctx.getConfig(`${prefix}.url`, 'https://example.com'));
19
+ const waitUntil = String(ctx.getConfig(`${prefix}.waitUntil`, 'networkidle0'));
20
+ const requestTail = Number(ctx.getConfig(`${prefix}.requestTail`, 50));
21
+ const maxConcurrency = Number(ctx.getConfig(`${prefix}.parallel.maxConcurrency`, 4));
22
+
23
+ const challengeProbeScript = `
24
+ (function() {
25
+ const challenges = {};
26
+
27
+ // === Security Challenges (Bot Detection) ===
28
+ // Cloudflare
29
+ challenges.cfTurnstile = !!document.querySelector('[data-sitekey]') || !!document.querySelector('.cf-turnstile');
30
+ challenges.cfChallenge = !!document.querySelector('#cf-challenge-running') || !!document.getElementById('challenge-form');
31
+ challenges.cfRay = document.querySelector('meta[name="cf-ray"]')?.content || null;
32
+ // reCAPTCHA
33
+ challenges.recaptcha = !!document.querySelector('.g-recaptcha') || !!document.querySelector('[data-sitekey]');
34
+ challenges.recaptchaV3 = typeof grecaptcha !== 'undefined';
35
+ // hCaptcha
36
+ challenges.hcaptcha = !!document.querySelector('.h-captcha') || !!document.querySelector('[data-hcaptcha-widget-id]');
37
+ // DataDome
38
+ challenges.datadome = !!document.querySelector('[data-dd]') || document.cookie.includes('datadome');
39
+ // Akamai Bot Manager
40
+ challenges.akamai = !!document.querySelector('script[src*="akamai"]') || !!document.querySelector('script[src*="bm/"]');
41
+ // PerimeterX / HUMAN
42
+ challenges.perimeterx = !!document.querySelector('script[src*="px"]') || !!window._pxUuid;
43
+ // Kasada
44
+ challenges.kasada = !!document.querySelector('script[src*="ips.js"]') || !!window.__kasada;
45
+ // Generic JS challenge signals
46
+ challenges.hasIframeChallenge = !!document.querySelector('iframe[src*="challenge"]');
47
+ challenges.hasNoscript = !!document.querySelector('noscript');
48
+ challenges.httpStatus = document.querySelector('meta[http-equiv="status"]')?.content || null;
49
+
50
+ // === CTF Platform Challenges ===
51
+ // OWASP Juice Shop
52
+ challenges.juiceShop = {
53
+ detected: !!document.querySelector('juice-shop-app') ||
54
+ !!document.querySelector('[ng-app="juiceShop"]') ||
55
+ !!document.querySelector('mat-toolbar[color="warn"]') ||
56
+ document.title.includes('OWASP Juice Shop'),
57
+ challenges: [],
58
+ score: null,
59
+ user: null
60
+ };
61
+ if (challenges.juiceShop.detected) {
62
+ try {
63
+ // Extract challenge list from localStorage or DOM
64
+ const completedChallenges = JSON.parse(localStorage.getItem('completedChallenges') || '[]');
65
+ const totalChallenges = document.querySelectorAll('[id^="challenge-"]').length ||
66
+ document.querySelectorAll('.challenge-item').length ||
67
+ document.querySelectorAll('mat-card').length || 0;
68
+ challenges.juiceShop.challenges = {
69
+ completed: Array.isArray(completedChallenges) ? completedChallenges.length : 0,
70
+ total: totalChallenges,
71
+ percentage: totalChallenges > 0 ? Math.round((completedChallenges.length / totalChallenges) * 100) : 0
72
+ };
73
+ // Try to get current user/score
74
+ const token = localStorage.getItem('token');
75
+ if (token) {
76
+ try {
77
+ const payload = JSON.parse(atob(token.split('.')[1]));
78
+ challenges.juiceShop.user = payload?.email || payload?.username || null;
79
+ } catch(e) {}
80
+ }
81
+ // Score board link
82
+ challenges.juiceShop.scoreBoardLink = !!document.querySelector('a[href="/#/score-board"]');
83
+ } catch(e) {
84
+ challenges.juiceShop.error = e.message;
85
+ }
86
+ }
87
+
88
+ // DVWA (Damn Vulnerable Web Application)
89
+ challenges.dvwa = {
90
+ detected: !!document.querySelector('div#main_navbar') ||
91
+ document.title.includes('Damn Vulnerable Web Application') ||
92
+ !!document.querySelector('img[src*="dvwa"]') ||
93
+ !!document.querySelector('a[href="vulnerabilities/xss_d/"]'),
94
+ securityLevel: null,
95
+ currentVulnerability: null
96
+ };
97
+ if (challenges.dvwa.detected) {
98
+ try {
99
+ // Extract security level from session cookie or DOM
100
+ const securityCookie = document.cookie.match(/security=([^;]+)/);
101
+ challenges.dvwa.securityLevel = securityCookie ? securityCookie[1] : null;
102
+ // Current page/vulnerability
103
+ const currentPage = new URLSearchParams(window.location.search).get('page');
104
+ challenges.dvwa.currentVulnerability = currentPage || window.location.pathname;
105
+ // Menu items indicate available vulnerabilities
106
+ const menuItems = document.querySelectorAll('li[id*="_menu"]');
107
+ challenges.dvwa.availableModules = menuItems.length;
108
+ } catch(e) {
109
+ challenges.dvwa.error = e.message;
110
+ }
111
+ }
112
+
113
+ // HackTheBox
114
+ challenges.hackthebox = {
115
+ detected: !!document.querySelector('[class*="htb"]') ||
116
+ document.title.includes('Hack The Box') ||
117
+ !!document.querySelector('a[href*="hackthebox"]') ||
118
+ !!document.querySelector('meta[property="og:site_name"][content*="Hack The Box"]'),
119
+ machineName: null,
120
+ machineType: null,
121
+ progress: null
122
+ };
123
+ if (challenges.hackthebox.detected) {
124
+ try {
125
+ // Try to extract machine info from DOM
126
+ const machineTitle = document.querySelector('h1[class*="machine"]')?.textContent ||
127
+ document.querySelector('[class*="machine-name"]')?.textContent;
128
+ challenges.hackthebox.machineName = machineTitle?.trim() || null;
129
+ // Progress bar
130
+ const progressBar = document.querySelector('[role="progressbar"]')?.getAttribute('aria-valuenow');
131
+ challenges.hackthebox.progress = progressBar ? parseInt(progressBar) : null;
132
+ } catch(e) {
133
+ challenges.hackthebox.error = e.message;
134
+ }
135
+ }
136
+
137
+ // TryHackMe
138
+ challenges.tryhackme = {
139
+ detected: !!document.querySelector('[class*="tryhackme"]') ||
140
+ document.title.includes('TryHackMe') ||
141
+ !!document.querySelector('a[href*="tryhackme.com"]') ||
142
+ !!document.querySelector('[data-testid="task-content"]'),
143
+ roomName: null,
144
+ taskProgress: null
145
+ };
146
+ if (challenges.tryhackme.detected) {
147
+ try {
148
+ const roomTitle = document.querySelector('h1[class*="room"]')?.textContent ||
149
+ document.querySelector('[class*="room-title"]')?.textContent;
150
+ challenges.tryhackme.roomName = roomTitle?.trim() || null;
151
+ // Task completion
152
+ const completedTasks = document.querySelectorAll('[data-complete="true"]').length;
153
+ const totalTasks = document.querySelectorAll('[data-task-id]').length;
154
+ if (totalTasks > 0) {
155
+ challenges.tryhackme.taskProgress = { completed: completedTasks, total: totalTasks };
156
+ }
157
+ } catch(e) {
158
+ challenges.tryhackme.error = e.message;
159
+ }
160
+ }
161
+
162
+ // OverTheWire / wargame platforms
163
+ challenges.overthewire = {
164
+ detected: document.title.includes('OverTheWire') ||
165
+ document.title.includes('wargame') ||
166
+ document.title.includes('bandit') ||
167
+ !!document.querySelector('pre[class*="terminal"]'),
168
+ gameName: null,
169
+ level: null
170
+ };
171
+ if (challenges.overthewire.detected) {
172
+ try {
173
+ const titleMatch = document.title.match(/([\\w]+)\\s*[:\\-]?/i);
174
+ challenges.overthewire.gameName = titleMatch ? titleMatch[1] : null;
175
+ } catch(e) {
176
+ challenges.overthewire.error = e.message;
177
+ }
178
+ }
179
+
180
+ // picoCTF
181
+ challenges.picoctf = {
182
+ detected: document.title.includes('picoCTF') ||
183
+ !!document.querySelector('[class*="pico"]') ||
184
+ !!document.querySelector('a[href*="picoctf"]'),
185
+ challengeName: null,
186
+ category: null,
187
+ solved: null
188
+ };
189
+ if (challenges.picoctf.detected) {
190
+ try {
191
+ challenges.picoctf.challengeName = document.querySelector('h1[class*="challenge"]')?.textContent?.trim() || null;
192
+ challenges.picoctf.category = document.querySelector('[class*="category"]')?.textContent?.trim() || null;
193
+ // Check for solved indicator
194
+ const solvedIndicator = document.querySelector('[class*="solved"]') ||
195
+ document.querySelector('[class*="correct"]');
196
+ challenges.picoctf.solved = !!solvedIndicator;
197
+ } catch(e) {
198
+ challenges.picoctf.error = e.message;
199
+ }
200
+ }
201
+
202
+ // Root-Me
203
+ challenges.rootme = {
204
+ detected: document.title.includes('Root-Me') ||
205
+ !!document.querySelector('a[href*="root-me.org"]') ||
206
+ !!document.querySelector('[class*="rm-"]'),
207
+ challengeInfo: null
208
+ };
209
+ if (challenges.rootme.detected) {
210
+ try {
211
+ const validationForm = document.querySelector('form[name="validation"]');
212
+ challenges.rootme.canSubmit = !!validationForm;
213
+ } catch(e) {
214
+ challenges.rootme.error = e.message;
215
+ }
216
+ }
217
+
218
+ // Generic metadata
219
+ challenges.title = document.title;
220
+ challenges.bodyTextLength = document.body?.innerText?.length || 0;
221
+ challenges.url = window.location.href;
222
+
223
+ return challenges;
224
+ })()`;
225
+
226
+ const root = new SequenceNodeBuilder('challenge-detector-root');
227
+
228
+ root
229
+ // Phase 1: Network & Navigate
230
+ .tool('enable-network', 'network_enable', { input: { enableExceptions: true } })
231
+ .tool('navigate', 'page_navigate', { input: { url, waitUntil } })
232
+
233
+ // Phase 2: Challenge Probe
234
+ .tool('probe-challenges', 'page_evaluate', {
235
+ input: { expression: challengeProbeScript },
236
+ })
237
+
238
+ // Phase 3: Parallel Analysis
239
+ .parallel('analyse-challenges', (p) => {
240
+ p.maxConcurrency(maxConcurrency)
241
+ .failFast(false)
242
+ .tool('get-requests', 'network_get_requests', { input: { tail: requestTail } })
243
+ .tool('captcha-detect', 'captcha_detect', { input: {} })
244
+ .tool('search-challenge-scripts', 'search_in_scripts', {
245
+ input: { query: 'challenge,captcha,turnstile,datadome,akamai,perimeterx,kasada,botmanager', matchType: 'any' },
246
+ })
247
+ .tool('search-ctf-keywords', 'search_in_scripts', {
248
+ input: { query: 'juiceshop,dvwa,hackthebox,tryhackme,overthewire,picoctf,rootme,flag,ctf', matchType: 'any' },
249
+ })
250
+ .tool('screenshot', 'page_screenshot', { input: { fullPage: true } })
251
+ .tool('detect-obfuscation', 'detect_obfuscation', { input: {} })
252
+ .tool('stealth-verify', 'stealth_verify', { input: { categories: 'webdriver,navigator,timing,canvas' } })
253
+ .tool('get-localstorage', 'page_get_local_storage', { input: {} })
254
+ .tool('dom-structure', 'dom_get_structure', { input: { maxDepth: 2, includeText: false } });
255
+ })
256
+
257
+ // Phase 4: Response Analysis
258
+ .tool('get-network-stats', 'network_get_stats', { input: {} })
259
+ .tool('get-cookies', 'page_get_cookies')
260
+
261
+ // Phase 5: Evidence Recording
262
+ .tool('create-evidence-session', 'instrumentation_session_create', {
263
+ input: {
264
+ name: `challenge-detection-${new Date().toISOString().slice(0, 10)}`,
265
+ metadata: { url, workflowId },
266
+ },
267
+ })
268
+ .tool('record-artifact', 'instrumentation_artifact_record', {
269
+ input: {
270
+ type: 'challenge_detection_report',
271
+ label: `Challenge detection for ${url}`,
272
+ metadata: { url },
273
+ },
274
+ })
275
+
276
+ // Phase 6: Session Insight
277
+ .tool('emit-insight', 'append_session_insight', {
278
+ input: {
279
+ insight: JSON.stringify({
280
+ status: 'challenge_detector_complete',
281
+ workflowId,
282
+ url,
283
+ }),
284
+ },
285
+ });
286
+
287
+ return root;
288
+ })
289
+ .onStart((ctx) => {
290
+ ctx.emitMetric('workflow_runs_total', 1, 'counter', { workflowId, mission: 'challenge_detector', stage: 'start' });
291
+ })
292
+ .onFinish((ctx) => {
293
+ ctx.emitMetric('workflow_runs_total', 1, 'counter', { workflowId, mission: 'challenge_detector', stage: 'finish' });
294
+ })
295
+ .onError((ctx, error) => {
296
+ ctx.emitMetric('workflow_errors_total', 1, 'counter', { workflowId, mission: 'challenge_detector', stage: 'error', error: error.name });
297
+ })
298
+ .build();
@@ -0,0 +1,14 @@
1
+ {
2
+ "version": 1,
3
+ "kind": "workflow",
4
+ "slug": "deobfuscation-pipeline",
5
+ "id": "workflow.deobfuscation-pipeline.v1",
6
+ "source": {
7
+ "type": "git",
8
+ "repo": "https://github.com/vmoranv/jshook_workflow_deobfuscation_pipeline",
9
+ "ref": "main",
10
+ "commit": "97f3401d7e1ba446423a84e66be190d633f7d463",
11
+ "subpath": ".",
12
+ "entry": "workflow.ts"
13
+ }
14
+ }
@@ -0,0 +1,6 @@
1
+ name: deobfuscation-pipeline
2
+ description: JSHook workflow for deobfuscation-pipeline
3
+ author: vmoranv
4
+ tags:
5
+ - workflow
6
+ - deobfuscation-pipeline
@@ -0,0 +1,22 @@
1
+ {
2
+ "name": "jshook-workflow-deobfuscation-pipeline",
3
+ "private": true,
4
+ "version": "0.1.0",
5
+ "description": "jshookmcp workflow: deobfuscation-pipeline",
6
+ "type": "module",
7
+ "packageManager": "pnpm@10.28.2",
8
+ "scripts": {
9
+ "build": "tsc -p tsconfig.json",
10
+ "check": "tsc -p tsconfig.json --noEmit"
11
+ },
12
+ "dependencies": {
13
+ "@jshookmcp/extension-sdk": "^0.3.0"
14
+ },
15
+ "devDependencies": {
16
+ "@types/node": "^25.3.0",
17
+ "typescript": "^5.9.3"
18
+ },
19
+ "engines": {
20
+ "node": ">=20.0.0"
21
+ }
22
+ }