
Security News
/Research
Wallet-Draining npm Package Impersonates Nodemailer to Hijack Crypto Transactions
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
github.com/agtorre/gocolorize
#Gocolorize Gocolorize is a package that allows Go programs to provide ANSI coloring in a stateful manner. Gocolorize is ideal for logging or cli applications.
##Features
##Install Gocolorize To install:
$ go get github.com/agtorre/gocolorize
##Usage Ways to initialize a Colorize object:
//It can be done like this
var c gocolorize.Colorize
c.SetFg(gocolorize.Red)
c.SetBg(gocolorize.Black)
//Or this
c := gocolorize.Colorize{Fg: gocolorize.Red, Bg: gocolorize.Black}
//Or this
c := gocolorize.NewColor("red:black")
Once you have an object:
//Call Paint to take inputs and return a colored string
c.Paint("This", "accepts", "multiple", "arguments", "and", "types:", 1, 1.25, "etc")
//If you want a short-hand closure
p = c.Paint
p("Neat")
//To print it:
Fmt.Println(p("test"))
//It can also be appended to other strings, used in logging to stdout, etc.
a := "test " + p("case")
//The closure allows you to reuse the original object, for example
p = c.Paint
c.SetFg(gocolorize.Green)
p2 = c.Paint
Fmt.Println(p("different" + " " + p2("colors")))
Object Properties:
//These will only apply if there is a Fg and Bg respectively
c.ToggleFgIntensity()
c.ToggleBgIntensity()
//Set additional attributes
c.ToggleBold()
c.ToggleBlink()
c.ToggleUnderLine()
c.ToggleInverse()
//To disable or renable everything color (for example on Windows)
//the other functions will still work, they'll just return plain
//text for portability
gocolorize.SetPlain(true)
##NewColor String Format
"foregroundColor+attributes:backgroundColor+attributes"
Colors:
Attributes:
##Examples See examples directory for examples:
$ cd examples/
$ go run song.go
$ go run logging.go
##Tests Tests are another good place to see examples. In order to run tests:
$ go test -cover
##Portability ANSI coloring will not work in default Windows environments and may not work in other environments correctly. In order to allow compatibility with these environments, you can call:
gocolorize.SetPlain(true)
Once toggled, the library will still function, but it will not color the output.
Wikipedia ANSI escape codes Colors
A stylesheet author's guide to terminal colors
https://github.com/mgutz/ansi was an inspiration for the latest version. I did a lot of rewriting, removed the 'paints' module, and did a lot of general cleanup. I learned a lot reading this and using this code.
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.
Security News
/Research
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
Security News
/Research
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.