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.
cord ==== A `cord` is a sexy, styled JavaScript `String` that can print itself prettily.
A cord
is a sexy, styled JavaScript String
that can print itself prettily.
This project was forked off of percival.
Currently, this involves intelligently handling ANSI escape codes for printing styled strings to terminals; eventually, this should also print identically to HTML source that can be injected into a document.
cord
s are created with plain String
s and other cord
s as child elements.
The stylings on nested cord
s intelligently stack when printed.
Let’s look at some examples. A basic cord
just consists of a plain String
,
and some sort of styling:
sys.puts( cord.beget({ styles : {foreground: 'green'},
elements : ["Hello, world!"] }) );
Not too difficult, right? Let’s move on to nesting cord
, for more advanced
functionality:
sys.puts( cord.beget({ styles : {foreground: 'red'},
elements : ["Merry ",
cord.beget({ styles : {foreground: 'green'},
elements : ["Christmas"] }),
"!"] }) );
That, fairly obviously, creates a red cord
, containing another (green)
cord
as a child element. Finally, let’s examine a fairly complex multiply-
nested cord
:
var c = cord.beget(), c2 = cord.beget(),
c3 = cord.beget(), c4 = cord.beget();
c .elements.push('foo ', c2, ' grault');
c2.elements.push('bar ', c3, ' corge');
c3.elements.push('baz ', c4, ' quux');
c4.elements.push( 'qux' );
c .style({ foreground: 'red' }); c2.style({ underline: 'single' });
c3.style({ foreground: 'green' }); c4.style({ underline: 'single' });
sys.puts('['+c.toString()+']');
There’s several important things to notice about how that ended up getting displayed:
cord
with an
underline had not yet been reachedcord
had been reached, the red colour was
restored (quite a difficult task, using ANSI codes, if I do say so myself!)cord
, no wayward styles are left over
(i.e. the closing bracket is plain white, with no styling)… this is
important, as a stray code could screw up the display of everything else in
the user’s TerminalThese are the problems with previous, simpler ANSI printers that I was trying to solve with cord. I believe it achieves these goals wonderfully! ^_^
FAQs
React components for Cord
The npm package cord receives a total of 77 weekly downloads. As such, cord popularity was classified as not popular.
We found that cord 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.