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.
A tiny JavaScript interpreter written in TypeScript
Note: This project was originally developed for use in YouTube.js.
npm install jintr
Execute some JavaScript code:
// const Jinter = require('jintr').default;
import { Jinter } from 'jintr';
const code = `
function sayHiTo(person) {
console.log('Hi ' + person + '!');
}
sayHiTo('mom');
`
const jinter = new Jinter();
jinter.evaluate(code);
Inject your own functions, objects, etc:
import { Jinter } from 'jintr';
const jinter = new Jinter();
const code = `
console.log(new SomeClass().a);
console.log('hello'.toArray());
function myFn() {
console.log('[myFn]: Who called me?');
}
myFn();
`;
class SomeClass {
constructor() {
this.a = 'this is a test';
}
}
jinter.defineObject('SomeClass', SomeClass);
// Ex: str.toArray();
jinter.visitor.on('toArray', (node, visitor) => {
if (node.type === 'CallExpression' && node.callee.type === 'MemberExpression') {
const obj = visitor.visitNode(node.callee.object);
return obj.split('');
}
});
// Intercept function calls
jinter.visitor.on('myFn', (node) => {
if (node.type == 'CallExpression')
console.info('myFn was called!');
return '__continue_exec';
});
jinter.evaluate(code);
For more examples see /test
and /examples
.
evaluate(input: string)
Evaluates the given JavaScript code.
visitor
The node visitor. This is responsible for walking the AST and executing the nodes.
scope
Represents the global scope of the program.
Distributed under the MIT License.
FAQs
A tiny JavaScript interpreter written in TypeScript.
The npm package jintr receives a total of 18,358 weekly downloads. As such, jintr popularity was classified as popular.
We found that jintr 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.
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.