@goodtools/wiregasm 1.1.0 → 1.2.0
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/dist/main.js.map +1 -1
- package/dist/module.js.map +1 -1
- package/dist/types.d.ts +10 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/wiregasm.data.gz +0 -0
- package/dist/wiregasm.wasm +0 -0
- package/dist/wiregasm.wasm.gz +0 -0
- package/package.json +4 -2
package/dist/main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;ACQO,SAAS,0CAAiB,GAAc,EAAO;IACpD,OAAO,IAAI,MAAM,IAAI,IAAI,IAAI,IAAI,CAAC,GAAG,GAAG,CAAC,CAAC,GAAG,KAAO,IAAI,GAAG,CAAC;AAC9D;;ADVA;;;;;AAeO,MAAM;IAMX,aAAc;QACZ,IAAI,CAAC,WAAW,GAAG,KAAK;QACxB,IAAI,CAAC,OAAO,GAAG,IAAI;IACrB;IAEA;;;;;GAKC,GACD,MAAM,KAAK,MAAsB,EAAE,YAAkC,CAAC,CAAC,EAAE;QACvE,IAAI,IAAI,CAAC,WAAW,EAClB;QAGF,IAAI,CAAC,GAAG,GAAG,MAAM,OAAO;QACxB,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,GAAG,CAAC,kBAAkB;QAC5C,IAAI,CAAC,GAAG,CAAC,IAAI;QACb,IAAI,CAAC,WAAW,GAAG,IAAI;IACzB;IAEA;;;;GAIC,GACD,YAAY,MAAc,EAAuB;QAC/C,OAAO,IAAI,CAAC,GAAG,CAAC,WAAW,CAAC;IAC9B;IAEA;;;;GAIC,GACD,KACE,IAAY,EACZ,IAA8B,EAC9B,OAAe,CAAC,CAAC,EACH;QACd,IAAI,IAAI,CAAC,OAAO,IAAI,IAAI,EACtB,IAAI,CAAC,OAAO,CAAC,MAAM;QAGrB,MAAM,OAAO,IAAI,CAAC,SAAS,GAAG,MAAM;QACpC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,SAAS,CAAC,MAAM,MAAM;QAElC,IAAI,CAAC,OAAO,GAAG,IAAI,IAAI,CAAC,GAAG,CAAC,cAAc,CAAC;QAE3C,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI;IAC1B;IAEA;;;;;;GAMC,GACD,OAAO,MAAc,EAAE,OAAO,CAAC,EAAE,QAAQ,CAAC,EAAkB;QAC1D,OAAO,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,QAAQ,MAAM;IAC9C;IAEA;;;;GAIC,GACD,MAAM,GAAW,EAAS;QACxB,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC;IAC/B;IAEA,UAAU;QACR,IAAI,IAAI,CAAC,WAAW,EAAE;YACpB,IAAI,IAAI,CAAC,OAAO,KAAK,IAAI,EAAE;gBACzB,IAAI,CAAC,OAAO,CAAC,MAAM;gBACnB,IAAI,CAAC,OAAO,GAAG,IAAI;YACrB,CAAC;YAED,IAAI,CAAC,GAAG,CAAC,OAAO;YAChB,IAAI,CAAC,WAAW,GAAG,KAAK;QAC1B,CAAC;IACH;IAEA;;GAEC,GACD,UAAoB;QAClB,MAAM,MAAM,IAAI,CAAC,GAAG,CAAC,UAAU;QAE/B,oCAAoC;QACpC,OAAO,CAAA,GAAA,yCAAY,EAAE;IACvB;AACF","sources":["src/index.ts","src/utils.ts","src/types.ts"],"sourcesContent":["import {\n CheckFilterResponse,\n DissectSession,\n Frame,\n FramesResponse,\n LoadResponse,\n WiregasmLib,\n WiregasmLibOverrides,\n WiregasmLoader,\n} from \"./types\";\nimport { vectorToArray } from \"./utils\";\n\n/**\n * Wraps the WiregasmLib lib functionality and manages a single DissectSession\n */\nexport class Wiregasm {\n lib: WiregasmLib;\n initialized: boolean;\n session: DissectSession | null;\n uploadDir: string;\n\n constructor() {\n this.initialized = false;\n this.session = null;\n }\n\n /**\n * Initialize the wrapper and the Wiregasm module\n *\n * @param loader Loader function for the Emscripten module\n * @param overrides Overrides\n */\n async init(loader: WiregasmLoader, overrides: WiregasmLibOverrides = {}) {\n if (this.initialized) {\n return;\n }\n\n this.lib = await loader(overrides);\n this.uploadDir = this.lib.getUploadDirectory();\n this.lib.init();\n this.initialized = true;\n }\n\n /**\n * Check the validity of a filter expression.\n *\n * @param filter A display filter expression\n */\n test_filter(filter: string): CheckFilterResponse {\n return this.lib.checkFilter(filter);\n }\n\n /**\n * Load a packet trace file for analysis.\n *\n * @returns Response containing the status and summary\n */\n load(\n name: string,\n data: string | ArrayBufferView,\n opts: object = {}\n ): LoadResponse {\n if (this.session != null) {\n this.session.delete();\n }\n\n const path = this.uploadDir + \"/\" + name;\n this.lib.FS.writeFile(path, data, opts);\n\n this.session = new this.lib.DissectSession(path);\n\n return this.session.load();\n }\n\n /**\n * Get Packet List information for a range of packets.\n *\n * @param filter Output those frames that pass this filter expression\n * @param skip Skip N frames\n * @param limit Limit the output to N frames\n */\n frames(filter: string, skip = 0, limit = 0): FramesResponse {\n return this.session.getFrames(filter, skip, limit);\n }\n\n /**\n * Get full information about a frame including the protocol tree.\n *\n * @param number Frame number\n */\n frame(num: number): Frame {\n return this.session.getFrame(num);\n }\n\n destroy() {\n if (this.initialized) {\n if (this.session !== null) {\n this.session.delete();\n this.session = null;\n }\n\n this.lib.destroy();\n this.initialized = false;\n }\n }\n\n /**\n * Returns the column headers\n */\n columns(): string[] {\n const vec = this.lib.getColumns();\n\n // convert it from a vector to array\n return vectorToArray(vec);\n }\n}\n\nexport * from \"./types\";\nexport * from \"./utils\";\n","import { Vector } from \"./types\";\n\n/**\n * Converts a Vector to a JS array\n *\n * @param vec Vector\n * @returns JS array of the Vector contents\n */\nexport function vectorToArray<T>(vec: Vector<T>): T[] {\n return new Array(vec.size()).fill(0).map((_, id) => vec.get(id));\n}\n","export interface EmscriptenFileSystem {\n writeFile(\n path: string,\n data: string | ArrayBufferView,\n opts?: { flags?: string | undefined }\n ): void;\n readdir(path: string): string[];\n}\n\nexport interface EmscriptenHeap {\n buffer: ArrayBufferLike;\n}\n\nexport interface EmscriptenModule {\n FS: EmscriptenFileSystem;\n HEAPU8: EmscriptenHeap;\n _malloc(size: number): number;\n}\n\nexport interface Vector<T> {\n size(): number;\n get(index: number): T;\n}\n\nexport interface DataSource {\n name: string;\n data: string;\n}\n\nexport interface ProtoTree {\n label: string;\n filter: string;\n start: number;\n length: number;\n data_source_idx: number;\n tree: Vector<ProtoTree>;\n}\n\nexport interface Frame {\n number: number;\n comments: Vector<string>;\n data_sources: Vector<DataSource>;\n tree: Vector<ProtoTree>;\n}\n\nexport interface FramesResponse {\n frames: Vector<FrameMeta>;\n matched: number;\n}\n\nexport interface FrameMeta {\n number: number;\n comments: boolean;\n ignored: boolean;\n marked: boolean;\n bg: number;\n fg: number;\n columns: Vector<string>;\n}\n\nexport interface LoadSummary {\n filename: string;\n file_type: string;\n file_length: number;\n file_encap_type: string;\n packet_count: number;\n start_time: number;\n stop_time: number;\n elapsed_time: number;\n}\n\nexport interface LoadResponse {\n code: number;\n error: string;\n summary: LoadSummary;\n}\n\nexport interface DissectSession {\n /**\n * Free up any memory used by the session\n */\n delete(): void;\n\n /**\n * Load a packet trace file for analysis.\n *\n * @returns Response containing the status and summary\n */\n load(): LoadResponse;\n\n /**\n * Get Packet List information for a range of packets.\n *\n * @param filter Output those frames that pass this filter expression\n * @param skip Skip N frames\n * @param limit Limit the output to N frames\n */\n getFrames(filter: string, skip: number, limit: number): FramesResponse;\n\n /**\n * Get full information about a frame including the protocol tree.\n *\n * @param number Frame number\n */\n getFrame(number: number): Frame;\n}\n\nexport interface DissectSessionConstructable {\n new (path: string): DissectSession;\n}\n\nexport interface CheckFilterResponse {\n ok: boolean;\n error: string;\n}\n\nexport interface WiregasmLibOverrides {\n /**\n * If set, this method will be called when the runtime needs to load a file,\n * such as a .wasm WebAssembly file, .mem memory init file, or a file generated\n * by the file packager. The function receives the relative path to the file as\n * configured in build process and a prefix (path to the main JavaScript file’s\n * directory), and should return the actual URL.\n *\n * This lets you host file packages or the .mem file etc. on a different location\n * than the directory of the JavaScript file (which is the default expectation),\n * for example if you want to host them on a CDN.\n *\n * @param path Path of the requested file.\n * @param prefix Prefix of the requested path. May be empty.\n *\n * @returns Path to the requested file.\n */\n locateFile?(path: string, prefix: string): string;\n\n /**\n * Called when something is printed to standard error (stderr)\n *\n * @param error Error content\n */\n printErr?(error: string): void;\n\n /**\n * Called when something is printed to standard output (stdout)\n *\n * @param message Message content\n */\n print?(message: string): void;\n\n /**\n * Called from within the Wiregasm Library to notify\n * about any status updates.\n *\n * @param type Type of the status\n * @param message Message content\n */\n handleStatus?(type: number, message: string): void;\n}\n\nexport interface WiregasmLib extends EmscriptenModule {\n DissectSession: DissectSessionConstructable;\n\n /**\n * Returns the directory where files are uploaded\n *\n * @returns Path of the directory\n */\n getUploadDirectory(): string;\n\n /**\n * Initialize the library, load preferences and register dissectors\n */\n init(): boolean;\n\n /**\n * Clean up any memory associated with the lib\n */\n destroy(): void;\n\n /**\n * Check the validity of a filter expression.\n *\n * @param filter A display filter expression\n */\n checkFilter(filter: string): CheckFilterResponse;\n\n /**\n * Returns the column headers\n */\n getColumns(): Vector<string>;\n\n /**\n * Creates a new file in the upload directory with the supplied data\n *\n * @param file_name Name of the file\n * @param data_ptr Pointer to the data\n * @param length Length of the data\n */\n upload(file_name: string, data_ptr: number, length: number): string;\n}\n\nexport type WiregasmLoader = (\n overrides: WiregasmLibOverrides\n) => Promise<WiregasmLib>;\n"],"names":[],"version":3,"file":"main.js.map"}
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;ACQO,SAAS,0CAAiB,GAAc,EAAO;IACpD,OAAO,IAAI,MAAM,IAAI,IAAI,IAAI,IAAI,CAAC,GAAG,GAAG,CAAC,CAAC,GAAG,KAAO,IAAI,GAAG,CAAC;AAC9D;;ADVA;;;;;AAeO,MAAM;IAMX,aAAc;QACZ,IAAI,CAAC,WAAW,GAAG,KAAK;QACxB,IAAI,CAAC,OAAO,GAA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C,GAAG,CAAC,OAAO;YAChB,IAAI,CAAC,WAAW,GAAG,KAAK;QAC1B,CAAC;IACH;IAEA;;GAEC,GACD,UAAoB;QAClB,MAAM,MAAM,IAAI,CAAC,GAAG,CAAC,UAAU;QAE/B,oCAAoC;QACpC,OAAO,CAAA,GAAA,yCAAY,EAAE;IACvB;AACF","sources":["src/index.ts","src/utils.ts","src/types.ts"],"sourcesContent":["import {\n CheckFilterResponse,\n DissectSession,\n Frame,\n FramesResponse,\n LoadResponse,\n WiregasmLib,\n WiregasmLibOverrides,\n WiregasmLoader,\n} from \"./types\";\nimport { vectorToArray } from \"./utils\";\n\n/**\n * Wraps the WiregasmLib lib functionality and manages a single DissectSession\n */\nexport class Wiregasm {\n lib: WiregasmLib;\n initialized: boolean;\n session: DissectSession | null;\n uploadDir: string;\n\n constructor() {\n this.initialized = false;\n this.session = null;\n }\n\n /**\n * Initialize the wrapper and the Wiregasm module\n *\n * @param loader Loader function for the Emscripten module\n * @param overrides Overrides\n */\n async init(loader: WiregasmLoader, overrides: WiregasmLibOverrides = {}) {\n if (this.initialized) {\n return;\n }\n\n this.lib = await loader(overrides);\n this.uploadDir = this.lib.getUploadDirectory();\n this.lib.init();\n this.initialized = true;\n }\n\n /**\n * Check the validity of a filter expression.\n *\n * @param filter A display filter expression\n */\n test_filter(filter: string): CheckFilterResponse {\n return this.lib.checkFilter(filter);\n }\n\n /**\n * Load a packet trace file for analysis.\n *\n * @returns Response containing the status and summary\n */\n load(\n name: string,\n data: string | ArrayBufferView,\n opts: object = {}\n ): LoadResponse {\n if (this.session != null) {\n this.session.delete();\n }\n\n const path = this.uploadDir + \"/\" + name;\n this.lib.FS.writeFile(path, data, opts);\n\n this.session = new this.lib.DissectSession(path);\n\n return this.session.load();\n }\n\n /**\n * Get Packet List information for a range of packets.\n *\n * @param filter Output those frames that pass this filter expression\n * @param skip Skip N frames\n * @param limit Limit the output to N frames\n */\n frames(filter: string, skip = 0, limit = 0): FramesResponse {\n return this.session.getFrames(filter, skip, limit);\n }\n\n /**\n * Get full information about a frame including the protocol tree.\n *\n * @param number Frame number\n */\n frame(num: number): Frame {\n return this.session.getFrame(num);\n }\n\n destroy() {\n if (this.initialized) {\n if (this.session !== null) {\n this.session.delete();\n this.session = null;\n }\n\n this.lib.destroy();\n this.initialized = false;\n }\n }\n\n /**\n * Returns the column headers\n */\n columns(): string[] {\n const vec = this.lib.getColumns();\n\n // convert it from a vector to array\n return vectorToArray(vec);\n }\n}\n\nexport * from \"./types\";\nexport * from \"./utils\";\n","import { Vector } from \"./types\";\n\n/**\n * Converts a Vector to a JS array\n *\n * @param vec Vector\n * @returns JS array of the Vector contents\n */\nexport function vectorToArray<T>(vec: Vector<T>): T[] {\n return new Array(vec.size()).fill(0).map((_, id) => vec.get(id));\n}\n","export interface EmscriptenFileSystem {\n writeFile(\n path: string,\n data: string | ArrayBufferView,\n opts?: { flags?: string | undefined }\n ): void;\n readdir(path: string): string[];\n}\n\nexport interface EmscriptenHeap {\n buffer: ArrayBufferLike;\n}\n\nexport interface EmscriptenModule {\n FS: EmscriptenFileSystem;\n HEAPU8: EmscriptenHeap;\n _malloc(size: number): number;\n}\n\nexport interface Vector<T> {\n size(): number;\n get(index: number): T;\n}\n\nexport interface DataSource {\n name: string;\n data: string;\n}\n\nexport interface ProtoTree {\n label: string;\n filter: string;\n start: number;\n length: number;\n data_source_idx: number;\n tree: Vector<ProtoTree>;\n}\n\nexport interface Frame {\n number: number;\n comments: Vector<string>;\n data_sources: Vector<DataSource>;\n tree: Vector<ProtoTree>;\n}\n\nexport interface FramesResponse {\n frames: Vector<FrameMeta>;\n matched: number;\n}\n\nexport interface FrameMeta {\n number: number;\n comments: boolean;\n ignored: boolean;\n marked: boolean;\n bg: number;\n fg: number;\n columns: Vector<string>;\n}\n\nexport interface LoadSummary {\n filename: string;\n file_type: string;\n file_length: number;\n file_encap_type: string;\n packet_count: number;\n start_time: number;\n stop_time: number;\n elapsed_time: number;\n}\n\nexport interface LoadResponse {\n code: number;\n error: string;\n summary: LoadSummary;\n}\n\nexport interface DissectSession {\n /**\n * Free up any memory used by the session\n */\n delete(): void;\n\n /**\n * Load a packet trace file for analysis.\n *\n * @returns Response containing the status and summary\n */\n load(): LoadResponse;\n\n /**\n * Get Packet List information for a range of packets.\n *\n * @param filter Output those frames that pass this filter expression\n * @param skip Skip N frames\n * @param limit Limit the output to N frames\n */\n getFrames(filter: string, skip: number, limit: number): FramesResponse;\n\n /**\n * Get full information about a frame including the protocol tree.\n *\n * @param number Frame number\n */\n getFrame(number: number): Frame;\n}\n\nexport interface DissectSessionConstructable {\n new (path: string): DissectSession;\n}\n\nexport interface CheckFilterResponse {\n ok: boolean;\n error: string;\n}\n\nexport interface WiregasmLibOverrides {\n /**\n * If set, this method will be called when the runtime needs to load a file,\n * such as a .wasm WebAssembly file, .mem memory init file, or a file generated\n * by the file packager. The function receives the relative path to the file as\n * configured in build process and a prefix (path to the main JavaScript file’s\n * directory), and should return the actual URL.\n *\n * This lets you host file packages or the .mem file etc. on a different location\n * than the directory of the JavaScript file (which is the default expectation),\n * for example if you want to host them on a CDN.\n *\n * @param path Path of the requested file.\n * @param prefix Prefix of the requested path. May be empty.\n *\n * @returns Path to the requested file.\n */\n locateFile?(path: string, prefix: string): string;\n\n /**\n * Called when something is printed to standard error (stderr)\n *\n * @param error Error content\n */\n printErr?(error: string): void;\n\n /**\n * Called when something is printed to standard output (stdout)\n *\n * @param message Message content\n */\n print?(message: string): void;\n\n /**\n * Called from within the Wiregasm Library to notify\n * about any status updates.\n *\n * @param type Type of the status\n * @param message Message content\n */\n handleStatus?(type: number, message: string): void;\n\n /**\n * If you can fetch the binary yourself, you can set it\n */\n wasmBinary?: ArrayBuffer;\n\n /**\n * If you want to manually manage the download of .data file packages for\n * custom caching, progress reporting and error handling behavior,\n * you can implement this override.\n */\n getPreloadedPackage?(name: string, size: number): ArrayBuffer;\n}\n\nexport interface WiregasmLib extends EmscriptenModule {\n DissectSession: DissectSessionConstructable;\n\n /**\n * Returns the directory where files are uploaded\n *\n * @returns Path of the directory\n */\n getUploadDirectory(): string;\n\n /**\n * Initialize the library, load preferences and register dissectors\n */\n init(): boolean;\n\n /**\n * Clean up any memory associated with the lib\n */\n destroy(): void;\n\n /**\n * Check the validity of a filter expression.\n *\n * @param filter A display filter expression\n */\n checkFilter(filter: string): CheckFilterResponse;\n\n /**\n * Returns the column headers\n */\n getColumns(): Vector<string>;\n\n /**\n * Creates a new file in the upload directory with the supplied data\n *\n * @param file_name Name of the file\n * @param data_ptr Pointer to the data\n * @param length Length of the data\n */\n upload(file_name: string, data_ptr: number, length: number): string;\n}\n\nexport type WiregasmLoader = (\n overrides: WiregasmLibOverrides\n) => Promise<WiregasmLib>;\n"],"names":[],"version":3,"file":"main.js.map"}
|
package/dist/module.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;ACQO,SAAS,0CAAiB,GAAc,EAAO;IACpD,OAAO,IAAI,MAAM,IAAI,IAAI,IAAI,IAAI,CAAC,GAAG,GAAG,CAAC,CAAC,GAAG,KAAO,IAAI,GAAG,CAAC;AAC9D;;ADVA;;;;;AAeO,MAAM;IAMX,aAAc;QACZ,IAAI,CAAC,WAAW,GAAG,KAAK;QACxB,IAAI,CAAC,OAAO,GAAG,IAAI;IACrB;IAEA;;;;;GAKC,GACD,MAAM,KAAK,MAAsB,EAAE,YAAkC,CAAC,CAAC,EAAE;QACvE,IAAI,IAAI,CAAC,WAAW,EAClB;QAGF,IAAI,CAAC,GAAG,GAAG,MAAM,OAAO;QACxB,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,GAAG,CAAC,kBAAkB;QAC5C,IAAI,CAAC,GAAG,CAAC,IAAI;QACb,IAAI,CAAC,WAAW,GAAG,IAAI;IACzB;IAEA;;;;GAIC,GACD,YAAY,MAAc,EAAuB;QAC/C,OAAO,IAAI,CAAC,GAAG,CAAC,WAAW,CAAC;IAC9B;IAEA;;;;GAIC,GACD,KACE,IAAY,EACZ,IAA8B,EAC9B,OAAe,CAAC,CAAC,EACH;QACd,IAAI,IAAI,CAAC,OAAO,IAAI,IAAI,EACtB,IAAI,CAAC,OAAO,CAAC,MAAM;QAGrB,MAAM,OAAO,IAAI,CAAC,SAAS,GAAG,MAAM;QACpC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,SAAS,CAAC,MAAM,MAAM;QAElC,IAAI,CAAC,OAAO,GAAG,IAAI,IAAI,CAAC,GAAG,CAAC,cAAc,CAAC;QAE3C,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI;IAC1B;IAEA;;;;;;GAMC,GACD,OAAO,MAAc,EAAE,OAAO,CAAC,EAAE,QAAQ,CAAC,EAAkB;QAC1D,OAAO,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,QAAQ,MAAM;IAC9C;IAEA;;;;GAIC,GACD,MAAM,GAAW,EAAS;QACxB,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC;IAC/B;IAEA,UAAU;QACR,IAAI,IAAI,CAAC,WAAW,EAAE;YACpB,IAAI,IAAI,CAAC,OAAO,KAAK,IAAI,EAAE;gBACzB,IAAI,CAAC,OAAO,CAAC,MAAM;gBACnB,IAAI,CAAC,OAAO,GAAG,IAAI;YACrB,CAAC;YAED,IAAI,CAAC,GAAG,CAAC,OAAO;YAChB,IAAI,CAAC,WAAW,GAAG,KAAK;QAC1B,CAAC;IACH;IAEA;;GAEC,GACD,UAAoB;QAClB,MAAM,MAAM,IAAI,CAAC,GAAG,CAAC,UAAU;QAE/B,oCAAoC;QACpC,OAAO,CAAA,GAAA,yCAAY,EAAE;IACvB;AACF","sources":["src/index.ts","src/utils.ts","src/types.ts"],"sourcesContent":["import {\n CheckFilterResponse,\n DissectSession,\n Frame,\n FramesResponse,\n LoadResponse,\n WiregasmLib,\n WiregasmLibOverrides,\n WiregasmLoader,\n} from \"./types\";\nimport { vectorToArray } from \"./utils\";\n\n/**\n * Wraps the WiregasmLib lib functionality and manages a single DissectSession\n */\nexport class Wiregasm {\n lib: WiregasmLib;\n initialized: boolean;\n session: DissectSession | null;\n uploadDir: string;\n\n constructor() {\n this.initialized = false;\n this.session = null;\n }\n\n /**\n * Initialize the wrapper and the Wiregasm module\n *\n * @param loader Loader function for the Emscripten module\n * @param overrides Overrides\n */\n async init(loader: WiregasmLoader, overrides: WiregasmLibOverrides = {}) {\n if (this.initialized) {\n return;\n }\n\n this.lib = await loader(overrides);\n this.uploadDir = this.lib.getUploadDirectory();\n this.lib.init();\n this.initialized = true;\n }\n\n /**\n * Check the validity of a filter expression.\n *\n * @param filter A display filter expression\n */\n test_filter(filter: string): CheckFilterResponse {\n return this.lib.checkFilter(filter);\n }\n\n /**\n * Load a packet trace file for analysis.\n *\n * @returns Response containing the status and summary\n */\n load(\n name: string,\n data: string | ArrayBufferView,\n opts: object = {}\n ): LoadResponse {\n if (this.session != null) {\n this.session.delete();\n }\n\n const path = this.uploadDir + \"/\" + name;\n this.lib.FS.writeFile(path, data, opts);\n\n this.session = new this.lib.DissectSession(path);\n\n return this.session.load();\n }\n\n /**\n * Get Packet List information for a range of packets.\n *\n * @param filter Output those frames that pass this filter expression\n * @param skip Skip N frames\n * @param limit Limit the output to N frames\n */\n frames(filter: string, skip = 0, limit = 0): FramesResponse {\n return this.session.getFrames(filter, skip, limit);\n }\n\n /**\n * Get full information about a frame including the protocol tree.\n *\n * @param number Frame number\n */\n frame(num: number): Frame {\n return this.session.getFrame(num);\n }\n\n destroy() {\n if (this.initialized) {\n if (this.session !== null) {\n this.session.delete();\n this.session = null;\n }\n\n this.lib.destroy();\n this.initialized = false;\n }\n }\n\n /**\n * Returns the column headers\n */\n columns(): string[] {\n const vec = this.lib.getColumns();\n\n // convert it from a vector to array\n return vectorToArray(vec);\n }\n}\n\nexport * from \"./types\";\nexport * from \"./utils\";\n","import { Vector } from \"./types\";\n\n/**\n * Converts a Vector to a JS array\n *\n * @param vec Vector\n * @returns JS array of the Vector contents\n */\nexport function vectorToArray<T>(vec: Vector<T>): T[] {\n return new Array(vec.size()).fill(0).map((_, id) => vec.get(id));\n}\n","export interface EmscriptenFileSystem {\n writeFile(\n path: string,\n data: string | ArrayBufferView,\n opts?: { flags?: string | undefined }\n ): void;\n readdir(path: string): string[];\n}\n\nexport interface EmscriptenHeap {\n buffer: ArrayBufferLike;\n}\n\nexport interface EmscriptenModule {\n FS: EmscriptenFileSystem;\n HEAPU8: EmscriptenHeap;\n _malloc(size: number): number;\n}\n\nexport interface Vector<T> {\n size(): number;\n get(index: number): T;\n}\n\nexport interface DataSource {\n name: string;\n data: string;\n}\n\nexport interface ProtoTree {\n label: string;\n filter: string;\n start: number;\n length: number;\n data_source_idx: number;\n tree: Vector<ProtoTree>;\n}\n\nexport interface Frame {\n number: number;\n comments: Vector<string>;\n data_sources: Vector<DataSource>;\n tree: Vector<ProtoTree>;\n}\n\nexport interface FramesResponse {\n frames: Vector<FrameMeta>;\n matched: number;\n}\n\nexport interface FrameMeta {\n number: number;\n comments: boolean;\n ignored: boolean;\n marked: boolean;\n bg: number;\n fg: number;\n columns: Vector<string>;\n}\n\nexport interface LoadSummary {\n filename: string;\n file_type: string;\n file_length: number;\n file_encap_type: string;\n packet_count: number;\n start_time: number;\n stop_time: number;\n elapsed_time: number;\n}\n\nexport interface LoadResponse {\n code: number;\n error: string;\n summary: LoadSummary;\n}\n\nexport interface DissectSession {\n /**\n * Free up any memory used by the session\n */\n delete(): void;\n\n /**\n * Load a packet trace file for analysis.\n *\n * @returns Response containing the status and summary\n */\n load(): LoadResponse;\n\n /**\n * Get Packet List information for a range of packets.\n *\n * @param filter Output those frames that pass this filter expression\n * @param skip Skip N frames\n * @param limit Limit the output to N frames\n */\n getFrames(filter: string, skip: number, limit: number): FramesResponse;\n\n /**\n * Get full information about a frame including the protocol tree.\n *\n * @param number Frame number\n */\n getFrame(number: number): Frame;\n}\n\nexport interface DissectSessionConstructable {\n new (path: string): DissectSession;\n}\n\nexport interface CheckFilterResponse {\n ok: boolean;\n error: string;\n}\n\nexport interface WiregasmLibOverrides {\n /**\n * If set, this method will be called when the runtime needs to load a file,\n * such as a .wasm WebAssembly file, .mem memory init file, or a file generated\n * by the file packager. The function receives the relative path to the file as\n * configured in build process and a prefix (path to the main JavaScript file’s\n * directory), and should return the actual URL.\n *\n * This lets you host file packages or the .mem file etc. on a different location\n * than the directory of the JavaScript file (which is the default expectation),\n * for example if you want to host them on a CDN.\n *\n * @param path Path of the requested file.\n * @param prefix Prefix of the requested path. May be empty.\n *\n * @returns Path to the requested file.\n */\n locateFile?(path: string, prefix: string): string;\n\n /**\n * Called when something is printed to standard error (stderr)\n *\n * @param error Error content\n */\n printErr?(error: string): void;\n\n /**\n * Called when something is printed to standard output (stdout)\n *\n * @param message Message content\n */\n print?(message: string): void;\n\n /**\n * Called from within the Wiregasm Library to notify\n * about any status updates.\n *\n * @param type Type of the status\n * @param message Message content\n */\n handleStatus?(type: number, message: string): void;\n}\n\nexport interface WiregasmLib extends EmscriptenModule {\n DissectSession: DissectSessionConstructable;\n\n /**\n * Returns the directory where files are uploaded\n *\n * @returns Path of the directory\n */\n getUploadDirectory(): string;\n\n /**\n * Initialize the library, load preferences and register dissectors\n */\n init(): boolean;\n\n /**\n * Clean up any memory associated with the lib\n */\n destroy(): void;\n\n /**\n * Check the validity of a filter expression.\n *\n * @param filter A display filter expression\n */\n checkFilter(filter: string): CheckFilterResponse;\n\n /**\n * Returns the column headers\n */\n getColumns(): Vector<string>;\n\n /**\n * Creates a new file in the upload directory with the supplied data\n *\n * @param file_name Name of the file\n * @param data_ptr Pointer to the data\n * @param length Length of the data\n */\n upload(file_name: string, data_ptr: number, length: number): string;\n}\n\nexport type WiregasmLoader = (\n overrides: WiregasmLibOverrides\n) => Promise<WiregasmLib>;\n"],"names":[],"version":3,"file":"module.js.map"}
|
|
1
|
+
{"mappings":";;;;;;ACQO,SAAS,0CAAiB,GAAc,EAAO;IACpD,OAAO,IAAI,MAAM,IAAI,IAAI,IAAI,IAAI,CAAC,GAAG,GAAG,CAAC,CAAC,GAA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I,CAAC,OAAO,KAAK,IAAI,EAAE;gBACzB,IAAI,CAAC,OAAO,CAAC,MAAM;gBACnB,IAAI,CAAC,OAAO,GAAG,IAAI;YACrB,CAAC;YAED,IAAI,CAAC,GAAG,CAAC,OAAO;YAChB,IAAI,CAAC,WAAW,GAAG,KAAK;QAC1B,CAAC;IACH;IAEA;;GAEC,GACD,UAAoB;QAClB,MAAM,MAAM,IAAI,CAAC,GAAG,CAAC,UAAU;QAE/B,oCAAoC;QACpC,OAAO,CAAA,GAAA,yCAAY,EAAE;IACvB;AACF","sources":["src/index.ts","src/utils.ts","src/types.ts"],"sourcesContent":["import {\n CheckFilterResponse,\n DissectSession,\n Frame,\n FramesResponse,\n LoadResponse,\n WiregasmLib,\n WiregasmLibOverrides,\n WiregasmLoader,\n} from \"./types\";\nimport { vectorToArray } from \"./utils\";\n\n/**\n * Wraps the WiregasmLib lib functionality and manages a single DissectSession\n */\nexport class Wiregasm {\n lib: WiregasmLib;\n initialized: boolean;\n session: DissectSession | null;\n uploadDir: string;\n\n constructor() {\n this.initialized = false;\n this.session = null;\n }\n\n /**\n * Initialize the wrapper and the Wiregasm module\n *\n * @param loader Loader function for the Emscripten module\n * @param overrides Overrides\n */\n async init(loader: WiregasmLoader, overrides: WiregasmLibOverrides = {}) {\n if (this.initialized) {\n return;\n }\n\n this.lib = await loader(overrides);\n this.uploadDir = this.lib.getUploadDirectory();\n this.lib.init();\n this.initialized = true;\n }\n\n /**\n * Check the validity of a filter expression.\n *\n * @param filter A display filter expression\n */\n test_filter(filter: string): CheckFilterResponse {\n return this.lib.checkFilter(filter);\n }\n\n /**\n * Load a packet trace file for analysis.\n *\n * @returns Response containing the status and summary\n */\n load(\n name: string,\n data: string | ArrayBufferView,\n opts: object = {}\n ): LoadResponse {\n if (this.session != null) {\n this.session.delete();\n }\n\n const path = this.uploadDir + \"/\" + name;\n this.lib.FS.writeFile(path, data, opts);\n\n this.session = new this.lib.DissectSession(path);\n\n return this.session.load();\n }\n\n /**\n * Get Packet List information for a range of packets.\n *\n * @param filter Output those frames that pass this filter expression\n * @param skip Skip N frames\n * @param limit Limit the output to N frames\n */\n frames(filter: string, skip = 0, limit = 0): FramesResponse {\n return this.session.getFrames(filter, skip, limit);\n }\n\n /**\n * Get full information about a frame including the protocol tree.\n *\n * @param number Frame number\n */\n frame(num: number): Frame {\n return this.session.getFrame(num);\n }\n\n destroy() {\n if (this.initialized) {\n if (this.session !== null) {\n this.session.delete();\n this.session = null;\n }\n\n this.lib.destroy();\n this.initialized = false;\n }\n }\n\n /**\n * Returns the column headers\n */\n columns(): string[] {\n const vec = this.lib.getColumns();\n\n // convert it from a vector to array\n return vectorToArray(vec);\n }\n}\n\nexport * from \"./types\";\nexport * from \"./utils\";\n","import { Vector } from \"./types\";\n\n/**\n * Converts a Vector to a JS array\n *\n * @param vec Vector\n * @returns JS array of the Vector contents\n */\nexport function vectorToArray<T>(vec: Vector<T>): T[] {\n return new Array(vec.size()).fill(0).map((_, id) => vec.get(id));\n}\n","export interface EmscriptenFileSystem {\n writeFile(\n path: string,\n data: string | ArrayBufferView,\n opts?: { flags?: string | undefined }\n ): void;\n readdir(path: string): string[];\n}\n\nexport interface EmscriptenHeap {\n buffer: ArrayBufferLike;\n}\n\nexport interface EmscriptenModule {\n FS: EmscriptenFileSystem;\n HEAPU8: EmscriptenHeap;\n _malloc(size: number): number;\n}\n\nexport interface Vector<T> {\n size(): number;\n get(index: number): T;\n}\n\nexport interface DataSource {\n name: string;\n data: string;\n}\n\nexport interface ProtoTree {\n label: string;\n filter: string;\n start: number;\n length: number;\n data_source_idx: number;\n tree: Vector<ProtoTree>;\n}\n\nexport interface Frame {\n number: number;\n comments: Vector<string>;\n data_sources: Vector<DataSource>;\n tree: Vector<ProtoTree>;\n}\n\nexport interface FramesResponse {\n frames: Vector<FrameMeta>;\n matched: number;\n}\n\nexport interface FrameMeta {\n number: number;\n comments: boolean;\n ignored: boolean;\n marked: boolean;\n bg: number;\n fg: number;\n columns: Vector<string>;\n}\n\nexport interface LoadSummary {\n filename: string;\n file_type: string;\n file_length: number;\n file_encap_type: string;\n packet_count: number;\n start_time: number;\n stop_time: number;\n elapsed_time: number;\n}\n\nexport interface LoadResponse {\n code: number;\n error: string;\n summary: LoadSummary;\n}\n\nexport interface DissectSession {\n /**\n * Free up any memory used by the session\n */\n delete(): void;\n\n /**\n * Load a packet trace file for analysis.\n *\n * @returns Response containing the status and summary\n */\n load(): LoadResponse;\n\n /**\n * Get Packet List information for a range of packets.\n *\n * @param filter Output those frames that pass this filter expression\n * @param skip Skip N frames\n * @param limit Limit the output to N frames\n */\n getFrames(filter: string, skip: number, limit: number): FramesResponse;\n\n /**\n * Get full information about a frame including the protocol tree.\n *\n * @param number Frame number\n */\n getFrame(number: number): Frame;\n}\n\nexport interface DissectSessionConstructable {\n new (path: string): DissectSession;\n}\n\nexport interface CheckFilterResponse {\n ok: boolean;\n error: string;\n}\n\nexport interface WiregasmLibOverrides {\n /**\n * If set, this method will be called when the runtime needs to load a file,\n * such as a .wasm WebAssembly file, .mem memory init file, or a file generated\n * by the file packager. The function receives the relative path to the file as\n * configured in build process and a prefix (path to the main JavaScript file’s\n * directory), and should return the actual URL.\n *\n * This lets you host file packages or the .mem file etc. on a different location\n * than the directory of the JavaScript file (which is the default expectation),\n * for example if you want to host them on a CDN.\n *\n * @param path Path of the requested file.\n * @param prefix Prefix of the requested path. May be empty.\n *\n * @returns Path to the requested file.\n */\n locateFile?(path: string, prefix: string): string;\n\n /**\n * Called when something is printed to standard error (stderr)\n *\n * @param error Error content\n */\n printErr?(error: string): void;\n\n /**\n * Called when something is printed to standard output (stdout)\n *\n * @param message Message content\n */\n print?(message: string): void;\n\n /**\n * Called from within the Wiregasm Library to notify\n * about any status updates.\n *\n * @param type Type of the status\n * @param message Message content\n */\n handleStatus?(type: number, message: string): void;\n\n /**\n * If you can fetch the binary yourself, you can set it\n */\n wasmBinary?: ArrayBuffer;\n\n /**\n * If you want to manually manage the download of .data file packages for\n * custom caching, progress reporting and error handling behavior,\n * you can implement this override.\n */\n getPreloadedPackage?(name: string, size: number): ArrayBuffer;\n}\n\nexport interface WiregasmLib extends EmscriptenModule {\n DissectSession: DissectSessionConstructable;\n\n /**\n * Returns the directory where files are uploaded\n *\n * @returns Path of the directory\n */\n getUploadDirectory(): string;\n\n /**\n * Initialize the library, load preferences and register dissectors\n */\n init(): boolean;\n\n /**\n * Clean up any memory associated with the lib\n */\n destroy(): void;\n\n /**\n * Check the validity of a filter expression.\n *\n * @param filter A display filter expression\n */\n checkFilter(filter: string): CheckFilterResponse;\n\n /**\n * Returns the column headers\n */\n getColumns(): Vector<string>;\n\n /**\n * Creates a new file in the upload directory with the supplied data\n *\n * @param file_name Name of the file\n * @param data_ptr Pointer to the data\n * @param length Length of the data\n */\n upload(file_name: string, data_ptr: number, length: number): string;\n}\n\nexport type WiregasmLoader = (\n overrides: WiregasmLibOverrides\n) => Promise<WiregasmLib>;\n"],"names":[],"version":3,"file":"module.js.map"}
|
package/dist/types.d.ts
CHANGED
|
@@ -133,6 +133,16 @@ export interface WiregasmLibOverrides {
|
|
|
133
133
|
* @param message Message content
|
|
134
134
|
*/
|
|
135
135
|
handleStatus?(type: number, message: string): void;
|
|
136
|
+
/**
|
|
137
|
+
* If you can fetch the binary yourself, you can set it
|
|
138
|
+
*/
|
|
139
|
+
wasmBinary?: ArrayBuffer;
|
|
140
|
+
/**
|
|
141
|
+
* If you want to manually manage the download of .data file packages for
|
|
142
|
+
* custom caching, progress reporting and error handling behavior,
|
|
143
|
+
* you can implement this override.
|
|
144
|
+
*/
|
|
145
|
+
getPreloadedPackage?(name: string, size: number): ArrayBuffer;
|
|
136
146
|
}
|
|
137
147
|
export interface WiregasmLib extends EmscriptenModule {
|
|
138
148
|
DissectSession: DissectSessionConstructable;
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"AAAA;IACE,SAAS,CACP,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,G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MpB","sources":["src/src/types.ts","src/src/utils.ts","src/src/index.ts","src/index.ts"],"sourcesContent":[null,null,null,"import {\n CheckFilterResponse,\n DissectSession,\n Frame,\n FramesResponse,\n LoadResponse,\n WiregasmLib,\n WiregasmLibOverrides,\n WiregasmLoader,\n} from \"./types\";\nimport { vectorToArray } from \"./utils\";\n\n/**\n * Wraps the WiregasmLib lib functionality and manages a single DissectSession\n */\nexport class Wiregasm {\n lib: WiregasmLib;\n initialized: boolean;\n session: DissectSession | null;\n uploadDir: string;\n\n constructor() {\n this.initialized = false;\n this.session = null;\n }\n\n /**\n * Initialize the wrapper and the Wiregasm module\n *\n * @param loader Loader function for the Emscripten module\n * @param overrides Overrides\n */\n async init(loader: WiregasmLoader, overrides: WiregasmLibOverrides = {}) {\n if (this.initialized) {\n return;\n }\n\n this.lib = await loader(overrides);\n this.uploadDir = this.lib.getUploadDirectory();\n this.lib.init();\n this.initialized = true;\n }\n\n /**\n * Check the validity of a filter expression.\n *\n * @param filter A display filter expression\n */\n test_filter(filter: string): CheckFilterResponse {\n return this.lib.checkFilter(filter);\n }\n\n /**\n * Load a packet trace file for analysis.\n *\n * @returns Response containing the status and summary\n */\n load(\n name: string,\n data: string | ArrayBufferView,\n opts: object = {}\n ): LoadResponse {\n if (this.session != null) {\n this.session.delete();\n }\n\n const path = this.uploadDir + \"/\" + name;\n this.lib.FS.writeFile(path, data, opts);\n\n this.session = new this.lib.DissectSession(path);\n\n return this.session.load();\n }\n\n /**\n * Get Packet List information for a range of packets.\n *\n * @param filter Output those frames that pass this filter expression\n * @param skip Skip N frames\n * @param limit Limit the output to N frames\n */\n frames(filter: string, skip = 0, limit = 0): FramesResponse {\n return this.session.getFrames(filter, skip, limit);\n }\n\n /**\n * Get full information about a frame including the protocol tree.\n *\n * @param number Frame number\n */\n frame(num: number): Frame {\n return this.session.getFrame(num);\n }\n\n destroy() {\n if (this.initialized) {\n if (this.session !== null) {\n this.session.delete();\n this.session = null;\n }\n\n this.lib.destroy();\n this.initialized = false;\n }\n }\n\n /**\n * Returns the column headers\n */\n columns(): string[] {\n const vec = this.lib.getColumns();\n\n // convert it from a vector to array\n return vectorToArray(vec);\n }\n}\n\nexport * from \"./types\";\nexport * from \"./utils\";\n"],"names":[],"version":3,"file":"types.d.ts.map"}
|
|
Binary file
|
package/dist/wiregasm.wasm
CHANGED
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@goodtools/wiregasm",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "Packet Analyzer powered by Wireshark compiled for WebAssembly",
|
|
5
5
|
"source": "src/index.ts",
|
|
6
6
|
"main": "dist/main.js",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"build:emscripten": "docker run -it --rm -v $(pwd):/src okhalid/wiregasm-builder:latest ./build-lib.sh",
|
|
12
12
|
"build:emscripten-local": "./build-lib.sh",
|
|
13
13
|
"build": "parcel build && npm run copy-assets",
|
|
14
|
-
"copy-assets": "cp built/bin/wiregasm
|
|
14
|
+
"copy-assets": "cp built/bin/wiregasm.* dist/",
|
|
15
15
|
"lint": "eslint src/ --fix",
|
|
16
16
|
"test": "jest --coverage",
|
|
17
17
|
"fix:prettier": "prettier \"src/**/*.ts\" --write"
|
|
@@ -35,12 +35,14 @@
|
|
|
35
35
|
"@semantic-release/git": "^10.0.1",
|
|
36
36
|
"@types/jest": "^29.2.5",
|
|
37
37
|
"@types/node": "^18.11.18",
|
|
38
|
+
"@types/pako": "^2.0.0",
|
|
38
39
|
"@typescript-eslint/eslint-plugin": "^5.48.1",
|
|
39
40
|
"@typescript-eslint/parser": "^5.48.1",
|
|
40
41
|
"eslint": "^8.31.0",
|
|
41
42
|
"eslint-config-prettier": "^8.6.0",
|
|
42
43
|
"eslint-plugin-prettier": "^4.2.1",
|
|
43
44
|
"jest": "^29.3.1",
|
|
45
|
+
"pako": "^2.1.0",
|
|
44
46
|
"parcel": "^2.8.2",
|
|
45
47
|
"prettier": "^2.8.2",
|
|
46
48
|
"ts-jest": "^29.0.3"
|