
Research
/Security News
Critical Vulnerability in NestJS Devtools: Localhost RCE via Sandbox Escape
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
screen-buffer
Advanced tools
A ScreenBuffer represents a visible portion of a terminal in a screen. A ScreenBuffer contains a lot of cells. Each cell contains a character and attributes, such as color and boldness. It also keeps track of cursor position.
var ScreenBuffer = require('screen-buffer')
<script src="path/to/screen-buffer.js"></script>
<script src="path/to/diff.js"></script><!-- if you need .diff -->
<script src="path/to/patch.js"></script><!-- if you need .patch -->
Currently the attributes is a 21-bit integer. From MSB:
There are two special values for colors:
An empty cell: default background and foreground with space character.
Override this function to be notified when changes are made to the buffer.
The X position of the cursor (0 = leftmost)
The Y position of the cursor (0 = topmost)
Set one line of data in the ScreenBuffer. y is the row in the screen and data array looks like this: [ [attribute, character], ... ]
Returns the string in the display buffer.
Sets the cursor position.
The X position of the cursor.
The Y position of the cursor.
Returns the number of rows in the buffer.
Returns the number of characters in this row.
Resizes the number of rows.
Resizes the number of columns in the specified row.
Returns the cell at (row, col). Returned value is in form of [ attributes, ch ].
Sets the cell at (row, col). A cell is in form of [ attributes, ch ].
Resizes the screen buffer.
Returns a clone of the screen buffer.
Returns a row data array. Don't modify it!
Sometimes, you may want to stream the content of a screen buffer over the network.
You can use ScreenBuffer.diff
and ScreenBuffer.patch
for this.
Suppose that you have two ScreenBuffer objects, a
and b
,
var operations = ScreenBuffer.diff(b, a)
This will compute the operations that needs to be done on b
to make its contents equal to a
.
The returned result is an array of operations,
which can be sent over the wire to another user.
At the other side, when they received the operations, they can apply it to their own buffer like this:
ScreenBuffer.patch(b, operations)
Computes the list of operation to be applied on the source to make it match the target.
A returned result will have this structure:
[OPERATION, ...]
An OPERATION represents an operation:
ROWS
(resize number of rows)[X, Y]
(set cursor position)[row, 0, COLUMNS]
(resize column)[row, 1, SOURCE ROW INDEX]
(copy)[row, column, "TEXT", "COMPRESSED ATTRIBUTE,..."]
(draw text)A COMPRESSED ATTRIBUTE has the form:
VALUE
VALUE*MULTIPLICITY
Applies the operations from the diff array onto the screenbuffer.
FAQs
A simple screen buffer component
The npm package screen-buffer receives a total of 3 weekly downloads. As such, screen-buffer popularity was classified as not popular.
We found that screen-buffer 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
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
Product
Customize license detection with Socket’s new license overlays: gain control, reduce noise, and handle edge cases with precision.
Product
Socket now supports Rust and Cargo, offering package search for all users and experimental SBOM generation for enterprise projects.