
Research
Malicious NuGet Packages Typosquat Nethereum to Exfiltrate Wallet Keys
The Socket Threat Research Team uncovered malicious NuGet packages typosquatting the popular Nethereum project to steal wallet keys.
A framework-agnostic Go module for generating sitemaps in XML, TXT, HTML, and Google News formats. Inspired by php-sitemap, this package works seamlessly with any Go web framework including Gin, Echo, Fiber, Chi, and standard net/http.
go get go.rumenx.com/sitemap
package main
import (
"net/http"
"time"
"go.rumenx.com/sitemap"
)
func sitemapHandler(w http.ResponseWriter, r *http.Request) {
sm := sitemap.New()
// Add URLs
sm.Add("https://example.com/", time.Now(), 1.0, sitemap.Daily)
sm.Add("https://example.com/about", time.Now(), 0.8, sitemap.Monthly,
sitemap.WithImages([]sitemap.Image{
{URL: "https://example.com/img/about.jpg", Title: "About Us"},
}),
)
// Render as XML
w.Header().Set("Content-Type", "application/xml")
xml, err := sm.XML()
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
w.Write(xml)
}
func main() {
http.HandleFunc("/sitemap.xml", sitemapHandler)
http.ListenAndServe(":8080", nil)
}
sm := sitemap.New()
// Add with all supported fields
sm.Add(
"https://example.com/news",
time.Now(),
0.8,
sitemap.Daily,
sitemap.WithImages([]sitemap.Image{
{URL: "https://example.com/img/news.jpg", Title: "News Image"},
}),
sitemap.WithTitle("News Article"),
sitemap.WithTranslations([]sitemap.Translation{
{Language: "fr", URL: "https://example.com/fr/news"},
}),
sitemap.WithVideos([]sitemap.Video{
{Title: "News Video", Description: "Video description"},
}),
sitemap.WithGoogleNews(sitemap.GoogleNews{
SiteName: "Example News",
Language: "en",
PublicationDate: time.Now(),
}),
sitemap.WithAlternates([]sitemap.Alternate{
{Media: "print", URL: "https://example.com/news-print"},
}),
)
// Multiple output formats
xmlData, _ := sm.XML() // Standard XML sitemap
txtData, _ := sm.TXT() // Plain text format
htmlData, _ := sm.HTML() // HTML format
newsData, _ := sm.GoogleNews() // Google News sitemap
package main
import (
"github.com/gin-gonic/gin"
"go.rumenx.com/sitemap/adapters/gin"
)
func main() {
r := gin.Default()
r.GET("/sitemap.xml", ginadapter.Sitemap(func() *sitemap.Sitemap {
sm := sitemap.New()
sm.Add("https://example.com/", time.Now(), 1.0, sitemap.Daily)
return sm
}))
r.Run(":8080")
}
package main
import (
"github.com/labstack/echo/v4"
"go.rumenx.com/sitemap/adapters/echo"
)
func main() {
e := echo.New()
e.GET("/sitemap.xml", echoadapter.Sitemap(func() *sitemap.Sitemap {
sm := sitemap.New()
sm.Add("https://example.com/", time.Now(), 1.0, sitemap.Daily)
return sm
}))
e.Start(":8080")
}
package main
import (
"github.com/gofiber/fiber/v2"
"go.rumenx.com/sitemap/adapters/fiber"
)
func main() {
app := fiber.New()
app.Get("/sitemap.xml", fiberadapter.Sitemap(func() *sitemap.Sitemap {
sm := sitemap.New()
sm.Add("https://example.com/", time.Now(), 1.0, sitemap.Daily)
return sm
}))
app.Listen(":8080")
}
package main
import (
"net/http"
"github.com/go-chi/chi/v5"
"go.rumenx.com/sitemap/adapters/chi"
)
func main() {
r := chi.NewRouter()
r.Get("/sitemap.xml", chiadapter.Sitemap(func() *sitemap.Sitemap {
sm := sitemap.New()
sm.Add("https://example.com/", time.Now(), 1.0, sitemap.Daily)
return sm
}))
http.ListenAndServe(":8080", r)
}
You can add sitemap entries using either the Add()
or AddItem()
methods:
Add() โ Simple, type-safe, one-at-a-time:
// Recommended for most use cases
sm.Add(
"https://example.com/",
time.Now(),
1.0,
sitemap.Daily,
sitemap.WithImages([]sitemap.Image{
{URL: "https://example.com/img.jpg", Title: "Image"},
}),
sitemap.WithTitle("Homepage"),
)
AddItem() โ Advanced, struct-based, supports batch:
// Add a single item with a struct
sm.AddItem(sitemap.Item{
URL: "https://example.com/about",
LastMod: time.Now(),
Priority: 0.8,
ChangeFreq: sitemap.Monthly,
Title: "About Us",
Images: []sitemap.Image{{URL: "https://example.com/img/about.jpg", Title: "About"}},
})
// Add multiple items at once (batch add)
sm.AddItems([]sitemap.Item{
{URL: "https://example.com/page1", Title: "Page 1"},
{URL: "https://example.com/page2", Title: "Page 2"},
})
For comprehensive documentation and examples:
# Run all tests
go test ./...
# Run tests with coverage
go test -cover ./...
# Generate HTML coverage report
go test -coverprofile=coverage.out ./...
go tool cover -html=coverage.out -o coverage.html
# Run static analysis
go vet ./...
# Format code
go fmt ./...
# Run linter (if installed)
golangci-lint run
We welcome contributions! Please see our Contributing Guidelines for details on:
If you discover a security vulnerability, please review our Security Policy for responsible disclosure guidelines.
If you find this package helpful, consider:
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
The Socket Threat Research Team uncovered malicious NuGet packages typosquatting the popular Nethereum project to steal wallet keys.
Product
A single platform for static analysis, secrets detection, container scanning, and CVE checksโbuilt on trusted open source tools, ready to run out of the box.
Product
Socket is launching experimental protection for the Hugging Face ecosystem, scanning for malware and malicious payload injections inside model files to prevent silent AI supply chain attacks.