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/suhailgupta03/smtppool
smtppool is a Go library that creates a pool of reusable SMTP connections for high throughput e-mailing. It gracefully handles idle connections, timeouts, and retries. The e-mail formatting, parsing, and preparation code is forked from jordan-wright/email.
Updates Made To This Fork
- adds support for email templates. See example below on how to use and generate HTML using templates
go get github.com/suhailgupta03/smtppool
package main
import (
"github.com/suhailgupta03/smtppool"
"log"
)
type TestEmail struct {
TemplateName string
TemplateType string
Name string
}
func main() {
emailSubject := "Welcome, {{ .Name }}"
tpl, err := smtppool.InitEmailTpl(emailSubject, "sample-template.tpl")
if err != nil {
log.Fatal("Failed to init template", err)
}
html, _ := smtppool.GetHTML(tpl, TestEmail{
TemplateName: "Test Template",
TemplateType: "Test",
Name: "FooBar",
})
log.Println(html.Body)
log.Println(html.Subject)
}
package main
import (
"fmt"
"log"
"github.com/suhailgupta03/smtppool"
)
func main() {
// Try https://github.com/mailhog/MailHog for running a local dummy SMTP server.
// Create a new pool.
pool, err := smtppool.New(smtppool.Opt{
Host: "localhost",
Port: 1025,
MaxConns: 10,
IdleTimeout: time.Second * 10,
PoolWaitTimeout: time.Second * 3,
})
if err != nil {
log.Fatalf("error creating pool: %v", err)
}
e:= Email{
From: "John Doe <john@example.com>",
To: []string{"doe@example.com"},
// Optional.
Bcc: []string{"doebcc@example.com"},
Cc: []string{"doecc@example.com"},
Subject: "Hello, World",
Text: []byte("This is a test e-mail"),
HTML: []byte("<strong>This is a test e-mail</strong>"),
}
// Add attachments.
if _, err := e.AttachFile("test.txt"); err != nil {
log.Fatalf("error attaching file: %v", err)
}
if err := pool.Send(e); err != nil {
log.Fatalf("error sending e-mail: %v", err)
}
}
Licensed under the MIT 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.