Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
ansi-scrollbox
Advanced tools
a basic scrollable area for terminal apps
npm install ansi-scrollbox
var scrollbox = require('ansi-scrollbox')
var differ = require('ansi-diff')()
var lorem = require('@jamen/lorem')
var box = scrollbox({
width: 20,
height: 20
})
box.setContent(lorem(6000))
function render () {
process.stdout.write(differ.update(box.toString()))
}
setInterval(render, 100)
require('keypress')(process.stdin)
process.stdin.setRawMode(true)
process.stdin.resume()
// Optionally add default scroll keybindings (things like up, down, home, end)
process.stdin.on('keypress', box.keypress)
box = scrollbox(opts={})
Prepare a new scrollbox.
opts.width
- Width in columns of the scrollbox.opts.height
- Height in rows of the scrollbox.box.setContent(content)
, box.content = content
Set the content of the scrollbox.
box.content
Get the content of the scrollbox.
box.scroll(offset)
Set the scroll position. offset
is the number of rows from the start of the content. When offset
is negative, it's the number of rows from the end of the content. Use -1 to scroll to the very end; -1 is "sticky" so it will stay at the end when the content updates.
box.resize(opts)
Update the size of the scrollbox.
opts.width
- Width in columns of the scrollbox.opts.height
- Height in rows of the scrollbox.box.toString()
Get the visible contents of the box. Use with something like ansi-diff for efficient updates on screene.
unsub = box.subscribe(listener)
Call listener
whenever the box's content, size, or scroll position change. Do unsub()
to stop listening.
box.keypress
An event listener that implements basic keyboard controls:
up
or k
to scroll 1 row updown
or j
to scroll 1 row downhome
to scroll to the startend
to scroll to the startUse it with the keypress module:
require('keypress')(process.stdin)
process.stdin.on('keypress', box.keypress)
0.2.1
FAQs
a basic scrollable area for terminal apps
The npm package ansi-scrollbox receives a total of 5 weekly downloads. As such, ansi-scrollbox popularity was classified as not popular.
We found that ansi-scrollbox 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
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.