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.
github.com/HaoZi-Team/letteravatar
Letter avatar generation for Go.
Generate a 100x100px 'A'-letter avatar:
img, err := letteravatar.Draw(100, 'A', nil)
The third parameter options *Options
can be used for customization:
type Options struct {
Font *truetype.Font
Palette []color.Color
LetterColor color.Color
PaletteKey string
FontSize int
}
Using a custom palette:
img, err := letteravatar.Draw(100, []rune{'A'}, &letteravatar.Options{
Palette: []color.Color{
color.RGBA{255, 0, 0, 255},
color.RGBA{0, 255, 0, 255},
color.RGBA{0, 0, 255, 255},
},
})
https://godoc.org/github.com/haozi-team/letteravatar
package main
import (
"image/png"
"log"
"os"
"unicode/utf8"
"github.com/haozi-team/letteravatar"
)
var names = []string{
"Alice",
"Bob",
"Carol",
"Dave",
"Eve",
"Frank",
"Gloria",
"Henry",
"Isabella",
"James",
"Жозефина",
"Ярослав",
}
func main() {
for _, name := range names {
firstLetter, _ := utf8.DecodeRuneInString(name)
img, err := letteravatar.Draw(75, []rune{firstLetter}, nil)
if err != nil {
log.Fatal(err)
}
file, err := os.Create(name + ".png")
if err != nil {
log.Fatal(err)
}
err = png.Encode(file, img)
if err != nil {
log.Fatal(err)
}
}
}
The package "letteravatar" is distributed under the terms of the MIT license.
The Roboto-Medium font is distributed under the terms of the Apache License v2.0.
See LICENSE.
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
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.