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.
The cli-boxes package provides a collection of predefined box styles for use in command-line interfaces. It allows developers to easily add boxes around text in the terminal for improved readability and aesthetic appeal.
Predefined box styles
cli-boxes comes with a set of predefined box styles that can be used to wrap around text. The above code sample logs the 'single' box style to the console.
const cliBoxes = require('cli-boxes');
console.log(cliBoxes.single);
Customizable boxes
Developers can use the predefined box styles to create customizable boxes around their text. The code sample demonstrates how to create a box with padding around the text 'Hello, World!'.
const cliBoxes = require('cli-boxes');
const box = cliBoxes.single;
const text = 'Hello, World!';
const padding = 1;
const lines = text.split('\n');
const maxLength = Math.max(...lines.map(line => line.length));
const top = box.topLeft + box.horizontal.repeat(maxLength + padding * 2) + box.topRight;
const bottom = box.bottomLeft + box.horizontal.repeat(maxLength + padding * 2) + box.bottomRight;
const side = box.vertical;
console.log(top);
lines.forEach(line => {
const paddingLeft = ' '.repeat(padding);
const paddingRight = ' '.repeat(maxLength - line.length + padding);
console.log(side + paddingLeft + line + paddingRight + side);
});
console.log(bottom);
Boxen is a similar package that allows for creating boxes in the terminal. It offers more customization options such as padding, margin, border style, and text alignment compared to cli-boxes, which primarily provides predefined box styles.
Terminal-kit is a full-featured terminal handling library that includes the ability to create boxes. It is more comprehensive than cli-boxes, providing a wide range of terminal manipulation features beyond just boxes.
Drawille is a unique package that uses Braille characters to draw in the terminal, allowing for creating boxes and other shapes with fine-grained detail. It differs from cli-boxes by focusing on drawing capabilities rather than just box styles.
Boxes for use in the terminal
The list of boxes is just a JSON file and can be used anywhere.
npm install cli-boxes
import cliBoxes from 'cli-boxes';
console.log(cliBoxes.single);
/*
{
topLeft: '┌',
top: '─',
topRight: '┐',
right: '│',
bottomRight: '┘',
bottom: '─',
bottomLeft: '└',
left: '│'
}
*/
single
┌────┐
│ │
└────┘
double
╔════╗
║ ║
╚════╝
round
╭────╮
│ │
╰────╯
bold
┏━━━━┓
┃ ┃
┗━━━━┛
singleDouble
╓────╖
║ ║
╙────╜
doubleSingle
╒════╕
│ │
╘════╛
classic
+----+
| |
+----+
arrow
↘↓↓↓↓↙
→ ←
↗↑↑↑↑↖
FAQs
Boxes for use in the terminal
The npm package cli-boxes receives a total of 11,892,402 weekly downloads. As such, cli-boxes popularity was classified as popular.
We found that cli-boxes 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.