
Research
Two Malicious Rust Crates Impersonate Popular Logger to Steal Wallet Keys
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
recast-deamdify
Advanced tools
Transform AMD modules to CommonJS using recast.
Usage: recast-deamdify [source dir] {OPTIONS}
Options:
--output, -o Write the trasformed files to this dir.
This option is required if a source dir is specified.
If unspecified and a single source file is being transformed,
recast-deamdify will print to stdout.
Examples:
cat foo.js | recast-deamdify > bar.js
recast-deamdify src/ -o dest/
Retaining the correct format in the transformed code was important for my use case. Other modules exist but didn't quite fit the bill (e.g. require2commonjs).
Initial versions of this module used esprima then acorn plus their associated code generators, but I couldn't get the results I wanted. Hence, recast.
$ npm install -g recast-deamdify
Given a.js
:
define('a', ['./foo', './bar'], function(foo, bar){
'use strict';
var baz = require('baz');
var qux = require('qux');
console.log('some line of code');
return {
height: foo.height,
width: bar.width
};
});
This:
$ cat test/fixtures/a.js | recast-deamdify > foo.js
Or this:
var recastDeamdify = require('recast-deamdify');
var fs = require('fs');
fs.createReadStream('./test/fixtures/a.js')
.pipe(recastDeamdify())
.pipe(fs.createWriteStream('foo.js'));
Will produce foo.js
:
'use strict';
var foo = require('./foo');
var bar = require('./bar');
var baz = require('baz');
var qux = require('qux');
console.log('some line of code');
module.exports = {
height: foo.height,
width: bar.width
};
Let's say we want to transform all .js
files contained in src
and write them to dest
, whilst maintaining src
's directory structure:
$ recast-deamdify src -o dest
Or you can use the API:
var recastDeamdify = require('recast-deamdify');
recastDeamdify({
srcDir: 'src',
destDir: 'dest'
}, function(){
console.log('complete!');
});
$ npm test
MIT
FAQs
Transform AMD modules to CommonJS using recast.
We found that recast-deamdify 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.
Research
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
Research
A malicious package uses a QR code as steganography in an innovative technique.
Research
/Security News
Socket identified 80 fake candidates targeting engineering roles, including suspected North Korean operators, exposing the new reality of hiring as a security function.