Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
bscript-assembler
Advanced tools
Node Bitcoin script parser
$ npm i bscript-parser --save
General help:
$ bscript -h
Usage: bscript [options] [command]
Options:
-v, --version output the version number
-h, --help output usage information
Commands:
assemble [options] <raw-script>
disassemble [options] <asm>
getopcode <word>
getword <opcode>
isvalid <opcode-or-word>
isdisabled <opcode-or-word>
describe <opcode-or-word>
Help for a specific command, e.g.:
$ bscript assemble -h
Usage: assemble [options] <raw-script>
Options:
-l, --literal-style [style] Literal Style normal|brackets|prefixed|verbose (default: "normal")
-e, --encoding [encoding] Encoding ascii|base64|binary|hex|utf8 (default: "hex")
-h, --help output usage information
$ bscript assemble --literal-style normal 76a914306e2ea1eed91bf66dfe5d94f3957d4ba63bde8488acOP_DUP OP_HASH160 306e2ea1eed91bf66dfe5d94f3957d4ba63bde84 OP_EQUALVERIFY OP_CHECKSIG
You can parse raw hex string into an assembly string using:
> const BScript = require('bscript-parser')
undefined
> BScript.rawToAsm('a914c664139327b98043febeab6434eba89bb196d1af87', 'hex')
'OP_HASH160 c664139327b98043febeab6434eba89bb196d1af OP_EQUAL'
You can parse an assembly string into a raw script hex string using:
> BScript.asmToRaw('OP_HASH160 c664139327b98043febeab6434eba89bb196d1af OP_EQUAL', 'hex')
'a914c664139327b98043febeab6434eba89bb196d1af87'
The library also exposes several utility functions for getting information about bscript opcodes.
> BScript.opcodes.opcodeForWord('OP_EQUAL')
135
> BScript.opcodes.wordForOpcode(135)
'OP_EQUAL'
> bscript.opcodes.opcodeIsValid(135)
true
> bscript.opcodes.opcodeIsValid(256)
false
> bscript.opcodes.wordIsValid('OP_EQUAL')
true
> bscript.opcodes.wordIsValid('OP_CLONE')
false
> bscript.opcodes.opcodeIsDisabled(135)
false
> bscript.opcodes.opcodeIsDisabled(126)
true
> bscript.opcodes.wordIsDisabled('OP_EQUAL')
false
> bscript.opcodes.wordIsDisabled('OP_CAT')
true
Note: The data is taken from the bitcoin.it wiki.
> bscript.opcodes.descriptionForOpcode(135)
'Returns 1 if the inputs are exactly equal, 0 otherwise.'
> bscript.opcodes.descriptionForWord('OP_HASH160')
'The input is hashed twice: first with SHA-256 and then with RIPEMD-160.'
> bscript.opcodes.inputDescriptionForOpcode(135)
'x1 x2'
> bscript.opcodes.inputDescriptionForWord('OP_HASH160')
'in'
> bscript.opcodes.outputDescriptionForOpcode(135)
'True / false'
> bscript.opcodes.outputDescriptionForWord('OP_HASH160')
'hash'
You can view the the API docs for this project by running npm run docs:serve
in the project directory and then accessing
the documentation in your browser.
You can also access the pre-built API documentation as markdown here.
To prepare the pre-built api docs to be committed after a change is made to the code, run npm run docs:build
. The should be done before every release.
FAQs
Node Bitcoin Script Parser
The npm package bscript-assembler receives a total of 1 weekly downloads. As such, bscript-assembler popularity was classified as not popular.
We found that bscript-assembler demonstrated a not healthy version release cadence and project activity because the last version was released 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.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.