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.
pretty-ansi
Advanced tools
Convert ANSI escape sequences to human readable text.
This utility converts ANSI escape sequences to human readable text. It supports color, style and cursor control escapes and works with vanilla sequences as well as the output from libraries like chalk
, colors
, ansi-escapes
, ansi-styles
or terminal-kit
.
npm add -D pretty-ansi
For example, it can be useful to test the output of a command line tool:
import assert from "node:assert";
import test from "node:test";
import prettyAnsi from "pretty-ansi";
test("command output", () => {
const commandOutput = "\u001b[3;32mSuccess!\u001b[0m";
assert.strictEqual(prettyAnsi(commandOutput), "<italic, green>Success!</>");
});
Currently only 16 colors are all supported.
Keep in mind that the escape sequences are not validated. Unrecognized sequence will print as <ESC>[a1b2c3
, or as <?>
in case this is a color or style sequence.
jest-serializer-ansi-escapes
— Jest snapshot serializer for ANSI escape sequences.
FAQs
Convert ANSI escape sequences to human readable text
We found that pretty-ansi 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.