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/cyinnove/tldify
tldify
is a Go package that extends the functionality of the standard net/url
package by adding support for parsing URLs into additional fields such as Subdomain, Domain, TLD (Top-Level Domain), and Port. It is designed to simplify URL parsing when you need finer granularity beyond the default URL structure.
This package is inspired by go-tld by @jpillora.
golang.org/x/net/publicsuffix
.net/url
for easy integration into existing projects.To install tldify
, use go get
:
go get github.com/cyinnove/tldify
Here's an example of how to use tldify
:
package main
import (
"fmt"
"github.com/cyinnove/tldify"
)
func main() {
url, err := tldify.Parse("http://sub.example.co.uk:8080/path?query=1")
if err != nil {
fmt.Println("Error:", err)
return
}
fmt.Println("Subdomain:", url.Subdomain)
fmt.Println("Domain:", url.Domain)
fmt.Println("TLD:", url.TLD)
fmt.Println("Port:", url.Port)
fmt.Println("ICANN:", url.ICANN)
}
Output:
Subdomain: sub
Domain: example
TLD: co.uk
Port: 8080
ICANN: true
tldify
exposes a single main function Parse
, which mirrors net/url.Parse
but returns an enriched URL
struct:
func Parse(s string) (*URL, error)
The URL
struct embeds the standard net/url.URL
and adds the following fields:
Subdomain
: The subdomain portion of the URL.Domain
: The domain portion of the URL.TLD
: The Top-Level Domain (TLD) portion of the URL.Port
: The port specified in the URL (if any).ICANN
: A boolean indicating whether the TLD is an ICANN-managed public suffix.This package was inspired by go-tld, a powerful tool for extracting domains and TLDs from URLs.
tldify
is licensed under the MIT License. See the LICENSE
file for more information.
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.