wowdump 0.0.0 → 0.2.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 (41) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +131 -0
  3. package/dist/adapters.js +101 -0
  4. package/dist/agent.js +1335 -0
  5. package/dist/analysis-path.js +38 -0
  6. package/dist/analysis-process-log.js +146 -0
  7. package/dist/broker-client.js +411 -0
  8. package/dist/broker-codec.js +148 -0
  9. package/dist/broker-core.js +1045 -0
  10. package/dist/broker-gateway.js +447 -0
  11. package/dist/broker-ledger.js +196 -0
  12. package/dist/broker-main.js +291 -0
  13. package/dist/broker-protocol.js +119 -0
  14. package/dist/broker-runtime.js +1283 -0
  15. package/dist/broker-server.js +466 -0
  16. package/dist/build-bundle-loader.js +183 -0
  17. package/dist/build-bundle.js +11 -0
  18. package/dist/discovery.js +59 -0
  19. package/dist/dry-run.js +38 -0
  20. package/dist/error-log.js +71 -0
  21. package/dist/focus-errors.js +63 -0
  22. package/dist/focus-service.js +1855 -0
  23. package/dist/focused-session.js +1357 -0
  24. package/dist/frida-runtime.js +711 -0
  25. package/dist/mcp-main.js +51 -0
  26. package/dist/mcp.js +924 -0
  27. package/dist/observability.js +41 -0
  28. package/dist/process-log-lock.js +195 -0
  29. package/dist/processes.js +47 -0
  30. package/dist/runtime-config.js +399 -0
  31. package/dist/session.js +145 -0
  32. package/dist/storage.js +12 -0
  33. package/dist/types.js +26 -0
  34. package/dist/wow-analysis.js +1430 -0
  35. package/package.json +64 -13
  36. package/resources/builds/retail/12.0.7.68974/build-profile.json +290 -0
  37. package/resources/builds/retail/12.0.7.68974/data-sources.json +1633 -0
  38. package/resources/builds/retail/12.0.7.68974/lua-targets.jsonl +5130 -0
  39. package/resources/builds/retail/12.0.7.68974/manifest.json +63 -0
  40. package/resources/builds/retail/12.0.7.68974/signatures.json +260 -0
  41. package/index.js +0 -1
@@ -0,0 +1,145 @@
1
+ import { readFile } from "node:fs/promises";
2
+ import { ErrorEventSchema } from "./types.js";
3
+ import { brokerManagedCommand } from "./frida-runtime.js";
4
+ export class ProcessSession {
5
+ process;
6
+ agentFile;
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) {
16
+ this.process = process;
17
+ this.agentFile = agentFile;
18
+ this.store = store;
19
+ this.executor = executor;
20
+ this.messagePollMs = messagePollMs;
21
+ }
22
+ async attach() {
23
+ if (this.sessionId)
24
+ 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");
32
+ 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);
112
+ if (message.type !== "send")
113
+ continue;
114
+ const payload = asRecord(message.payload);
115
+ const parsed = ErrorEventSchema.safeParse({
116
+ ...payload,
117
+ pid: this.process.pid,
118
+ buildKey: this.process.install.build.buildKey,
119
+ flavor: this.process.install.flavor
120
+ });
121
+ if (parsed.success)
122
+ await this.store.append(parsed.data);
123
+ }
124
+ this.messageCursor = messages.length;
125
+ }
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
+ };
134
+ }
135
+ }
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
+ }
@@ -0,0 +1,12 @@
1
+ import { appendFile, mkdir } from "node:fs/promises";
2
+ import { dirname } from "node:path";
3
+ export class JsonlStore {
4
+ file;
5
+ constructor(file) {
6
+ this.file = file;
7
+ }
8
+ async append(event) {
9
+ await mkdir(dirname(this.file), { recursive: true });
10
+ await appendFile(this.file, JSON.stringify(event) + "\n", "utf8");
11
+ }
12
+ }
package/dist/types.js ADDED
@@ -0,0 +1,26 @@
1
+ import { z } from "zod";
2
+ export const ObservationTierSchema = z.enum([
3
+ "error_text",
4
+ "source_location",
5
+ "stack_trace",
6
+ "vm_metadata"
7
+ ]);
8
+ export const AgentReadyEventSchema = z.object({
9
+ schema: z.literal(1),
10
+ type: z.literal("agent_ready"),
11
+ semanticReadOnly: z.literal(true),
12
+ observationTiers: z.array(ObservationTierSchema)
13
+ });
14
+ export const ErrorEventSchema = z.object({
15
+ schema: z.literal(1),
16
+ type: z.literal("lua_error"),
17
+ timestamp: z.number(),
18
+ pid: z.number(),
19
+ threadId: z.number().optional(),
20
+ buildKey: z.string(),
21
+ flavor: z.string(),
22
+ addon: z.string().optional(),
23
+ message: z.string(),
24
+ stack: z.string().optional(),
25
+ sourceAddress: z.string().optional()
26
+ });