wowdump 0.2.0 → 0.3.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.
Files changed (47) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +56 -118
  3. package/dist/agent.js +5 -8
  4. package/dist/cli.js +497 -0
  5. package/dist/discovery.js +1 -12
  6. package/dist/dry-run.js +0 -2
  7. package/dist/focused-session.js +61 -1329
  8. package/dist/frida-runtime.js +51 -73
  9. package/dist/frida-worker.js +100 -0
  10. package/dist/ghidra.js +769 -0
  11. package/dist/main.js +66 -0
  12. package/dist/processes.js +2 -5
  13. package/dist/reader-broker.js +460 -0
  14. package/dist/reader-client.js +1 -0
  15. package/dist/reader-main.js +67 -0
  16. package/dist/session.js +17 -120
  17. package/dist/toolchain.js +594 -0
  18. package/dist/windows-launcher.js +207 -0
  19. package/dist/windows-reader.js +102 -0
  20. package/dist/wow-analysis.js +211 -236
  21. package/package.json +18 -35
  22. package/skills/wowdump/SKILL.md +15 -0
  23. package/skills/wowdump/commands.md +44 -0
  24. package/dist/analysis-path.js +0 -38
  25. package/dist/analysis-process-log.js +0 -146
  26. package/dist/broker-client.js +0 -411
  27. package/dist/broker-codec.js +0 -148
  28. package/dist/broker-core.js +0 -1045
  29. package/dist/broker-gateway.js +0 -447
  30. package/dist/broker-ledger.js +0 -196
  31. package/dist/broker-main.js +0 -291
  32. package/dist/broker-protocol.js +0 -119
  33. package/dist/broker-runtime.js +0 -1283
  34. package/dist/broker-server.js +0 -466
  35. package/dist/build-bundle-loader.js +0 -183
  36. package/dist/build-bundle.js +0 -11
  37. package/dist/focus-errors.js +0 -63
  38. package/dist/focus-service.js +0 -1855
  39. package/dist/mcp-main.js +0 -51
  40. package/dist/mcp.js +0 -924
  41. package/dist/process-log-lock.js +0 -181
  42. package/dist/runtime-config.js +0 -399
  43. package/resources/builds/retail/12.0.7.68974/build-profile.json +0 -290
  44. package/resources/builds/retail/12.0.7.68974/data-sources.json +0 -1633
  45. package/resources/builds/retail/12.0.7.68974/lua-targets.jsonl +0 -5130
  46. package/resources/builds/retail/12.0.7.68974/manifest.json +0 -63
  47. package/resources/builds/retail/12.0.7.68974/signatures.json +0 -260
package/dist/session.js CHANGED
@@ -1,117 +1,27 @@
1
1
  import { readFile } from "node:fs/promises";
2
+ import * as frida from "frida";
2
3
  import { ErrorEventSchema } from "./types.js";
3
- import { brokerManagedCommand } from "./frida-runtime.js";
4
4
  export class ProcessSession {
5
5
  process;
6
6
  agentFile;
7
7
  store;
8
- executor;
9
- messagePollMs;
10
- sessionId;
11
- scriptId;
12
- messageCursor = 0;
13
- pollTimer;
14
- polling;
15
- constructor(process, agentFile, store, executor, messagePollMs = 250) {
8
+ session;
9
+ script;
10
+ constructor(process, agentFile, store) {
16
11
  this.process = process;
17
12
  this.agentFile = agentFile;
18
13
  this.store = store;
19
- this.executor = executor;
20
- this.messagePollMs = messagePollMs;
21
14
  }
22
15
  async attach() {
23
- if (this.sessionId)
16
+ if (this.session)
24
17
  return;
25
- const context = this.context();
26
- const attached = await this.executor.execute({
27
- operation: "attach",
28
- pid: this.process.pid,
29
- buildKey: context.buildKey
30
- }, context);
31
- this.sessionId = requiredString(attached.sessionId, "attach.sessionId");
18
+ this.session = await frida.attach(this.process.pid);
32
19
  const source = await readFile(this.agentFile, "utf8");
33
- try {
34
- const loaded = await this.executor.execute(brokerManagedCommand({
35
- operation: "script_load",
36
- sessionId: this.sessionId,
37
- pid: this.process.pid,
38
- buildKey: context.buildKey,
39
- source
40
- }, "collector.script_load"), context);
41
- this.scriptId = requiredString(loaded.scriptId, "script_load.scriptId");
42
- await this.pollMessages();
43
- this.pollTimer = setInterval(() => {
44
- void this.pollMessages().catch(() => undefined);
45
- }, this.messagePollMs);
46
- this.pollTimer.unref?.();
47
- }
48
- catch (error) {
49
- await this.detach();
50
- throw error;
51
- }
52
- }
53
- async detach() {
54
- if (this.pollTimer)
55
- clearInterval(this.pollTimer);
56
- this.pollTimer = undefined;
57
- await this.polling?.catch(() => undefined);
58
- await this.pollMessages().catch(() => undefined);
59
- const context = this.context();
60
- const scriptId = this.scriptId;
61
- const sessionId = this.sessionId;
62
- this.scriptId = undefined;
63
- this.sessionId = undefined;
64
- if (scriptId && sessionId) {
65
- await this.executor.execute(brokerManagedCommand({
66
- operation: "script_unload",
67
- pid: this.process.pid,
68
- buildKey: context.buildKey,
69
- sessionId,
70
- scriptId
71
- }, "collector.script_unload"), context).catch(() => undefined);
72
- }
73
- if (sessionId) {
74
- await this.executor.execute({
75
- operation: "detach",
76
- pid: this.process.pid,
77
- buildKey: context.buildKey,
78
- sessionId
79
- }, context).catch(() => undefined);
80
- }
81
- this.messageCursor = 0;
82
- }
83
- async pollMessages() {
84
- if (this.polling)
85
- return this.polling;
86
- if (!this.sessionId || !this.scriptId)
87
- return;
88
- this.polling = this.readMessages();
89
- try {
90
- await this.polling;
91
- }
92
- finally {
93
- this.polling = undefined;
94
- }
95
- }
96
- async readMessages() {
97
- const sessionId = this.sessionId;
98
- const scriptId = this.scriptId;
99
- if (!sessionId || !scriptId)
100
- return;
101
- const result = await this.executor.execute(brokerManagedCommand({
102
- operation: "script_call",
103
- pid: this.process.pid,
104
- buildKey: this.process.install.build.buildKey,
105
- sessionId,
106
- scriptId,
107
- exportName: "collectorStatus"
108
- }, "collector.status"), this.context());
109
- const messages = Array.isArray(result.messages) ? result.messages : [];
110
- for (const item of messages.slice(this.messageCursor)) {
111
- const message = asRecord(asRecord(item).message);
20
+ this.script = await this.session.createScript(source);
21
+ this.script.message.connect(async (message) => {
112
22
  if (message.type !== "send")
113
- continue;
114
- const payload = asRecord(message.payload);
23
+ return;
24
+ const payload = message.payload;
115
25
  const parsed = ErrorEventSchema.safeParse({
116
26
  ...payload,
117
27
  pid: this.process.pid,
@@ -120,26 +30,13 @@ export class ProcessSession {
120
30
  });
121
31
  if (parsed.success)
122
32
  await this.store.append(parsed.data);
123
- }
124
- this.messageCursor = messages.length;
33
+ });
34
+ await this.script.load();
125
35
  }
126
- context() {
127
- return {
128
- pid: this.process.pid,
129
- buildKey: this.process.install.build.buildKey,
130
- flavor: this.process.install.flavor,
131
- executable: this.process.executable,
132
- processStartTime: this.process.startTime
133
- };
36
+ async detach() {
37
+ await this.script?.unload().catch(() => undefined);
38
+ await this.session?.detach().catch(() => undefined);
39
+ this.script = undefined;
40
+ this.session = undefined;
134
41
  }
135
42
  }
136
- function asRecord(value) {
137
- return value !== null && typeof value === "object" && !Array.isArray(value)
138
- ? value
139
- : {};
140
- }
141
- function requiredString(value, field) {
142
- if (typeof value !== "string" || value.length === 0)
143
- throw new Error(`${field} is required`);
144
- return value;
145
- }