Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
@webassemblyjs/wasm-parser
Advanced tools
The @webassemblyjs/wasm-parser package is a tool for parsing WebAssembly binaries (.wasm files) into a format that is easier to interact with in JavaScript. It can be used to analyze and manipulate WebAssembly modules without having to execute them.
Parsing WebAssembly binaries
This feature allows you to parse .wasm files into an abstract syntax tree (AST) that represents the structure and content of the WebAssembly module.
const { decode } = require('@webassemblyjs/wasm-parser');
const fs = require('fs');
const wasmBuffer = fs.readFileSync('module.wasm');
const ast = decode(wasmBuffer);
console.log(ast);
The 'wabt' package is a set of tools for WebAssembly, built around the WebAssembly Binary Toolkit. It includes functionality to convert between the binary and text representations of WebAssembly, as well as to validate and execute WebAssembly code. It is more comprehensive than @webassemblyjs/wasm-parser, offering a wider range of tools for working with WebAssembly.
The 'wasmparser' package is another WebAssembly binary parser that provides an API for parsing WebAssembly modules. It is designed for performance and can be used in both Node.js and browser environments. Compared to @webassemblyjs/wasm-parser, it may offer better performance and a different API design that might be preferred in certain use cases.
The 'binaryen' package provides a compiler and toolchain infrastructure for WebAssembly. It includes capabilities for optimizing WebAssembly modules, converting between binary and text formats, and generating WebAssembly code. While @webassemblyjs/wasm-parser focuses on parsing, 'binaryen' offers a broader set of tools for compiling and optimizing WebAssembly code.
WebAssembly binary format parser
yarn add @webassemblyjs/wasm-parser
import { decode } from "@webassemblyjs/wasm-parser";
import { readFileSync } from "fs";
const binary = readFileSync("/path/to/module.wasm");
const decoderOpts = {};
const ast = decode(binary, decoderOpts);
dump
: print dump information while decoding (default false
)ignoreCodeSection
: ignore the code section (default false
)ignoreDataSection
: ignore the data section (default false
)FAQs
WebAssembly binary format parser
The npm package @webassemblyjs/wasm-parser receives a total of 22,619,705 weekly downloads. As such, @webassemblyjs/wasm-parser popularity was classified as popular.
We found that @webassemblyjs/wasm-parser demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.