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.
@e2b/code-interpreter
Advanced tools
The repository contains a template and modules for the code interpreter sandbox. It is based on the Jupyter server and implements the Jupyter Kernel messaging protocol. This allows for sharing context between code executions and improves support for plotting charts and other display-able data.
npm install @e2b/code-interpreter
import { Sandbox } from '@e2b/code-interpreter'
const sandbox = await Sandbox.create()
await sbx.runCode()('x = 1')
const execution = await sbx.runCode()('x+=1; x')
console.log(execution.text) // outputs 2
await sandbox.close()
import { Sandbox } from '@e2b/code-interpreter'
const sandbox = await Sandbox.create()
const code = `
import matplotlib.pyplot as plt
import numpy as np
x = np.linspace(0, 20, 100)
y = np.sin(x)
plt.plot(x, y)
plt.show()
`
// you can install dependencies in "jupyter notebook style"
await sandbox.runCode('!pip install matplotlib')
const execution = await sandbox.runCode(code)
// this contains the image data, you can e.g. save it to file or send to frontend
execution.results[0].png
await sandbox.kill()
import { Sandbox } from '@e2b/code-interpreter'
const code = `
import time
import pandas as pd
print("hello")
time.sleep(3)
data = pd.DataFrame(data=[[1, 2], [3, 4]], columns=["A", "B"])
display(data.head(10))
time.sleep(3)
print("world")
`
const sandbox = await Sandbox.create()
await sandbox.runCode(code, {
onStdout: (out) => console.log(out),
onStderr: (outErr) => console.error(outErr),
onResult: (result) => console.log(result.text),
})
await sandbox.kill()
Check out the JavaScript/TypeScript and Python "Hello World" guides to learn how to use our SDK.
See E2B documentation to get started.
Visit our Cookbook to get inspired by examples with different LLMs and AI frameworks.
FAQs
E2B Code Interpreter - Stateful code execution
The npm package @e2b/code-interpreter receives a total of 12,031 weekly downloads. As such, @e2b/code-interpreter popularity was classified as popular.
We found that @e2b/code-interpreter demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers 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.