Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
zgo.at/termtext
termtext is a Go package to deal with monospace text as interpreted by terminals.
Mostly intended to neatly align/wrap stuff terminal. There are a few tricky bits with this:
This package takes care of these issue.
Import as zgo.at/termtext
– godoc: https://godocs.io/zgo.at/termtext
The main function is termtext.Width()
:
Width("\ta") → 9 Tab expands to 8 spaces, followed by "a".
Width("a\t") → 8 Tab expands to 7 spaces.
Width("🧑\t🧑") → 10 🧑 is double-width
Width("\x1b[1mbold\x1b[0m") → 4 Escape sequences are ignored.
You can configure the tab width by setting termtext.TabWidth
.
There are a few other functions too:
Expand() Expand tabs.
Slice() Slice a string by display width, like str[n:m].
AlignLeft() Align a string, filling up the remainder with spaces.
AlignRight()
AlignCenter()
Wrap() Wrap a string. This is a simple wrap which just breaks
if a line's width is too long.
WordWrap() Word-wrap a string: lines are at most w wide, but don't
break in the middle of words.
FAQs
Unknown package
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 malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.