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/siverpinevalley/parseduration
The built-in package time offer very useful functions.
However, when you use time.ParseDuration, you cannot use time unit that is bigger than hours. This package also offer day, week, month, year time units for parsing string to duration.
go get https://github.com/SiverPineValley/parseduration
The standard for parsing is same as time.ParseDuration. You can use ParseDuration
sending parameters such as 2w3d20h
.
Negative numbers are also provided, and if you enter only letters without entering a number, it will be recognized as 0. d == 0d
Time units are as provided in the table below. A time unit that is not provided or a time unit that is duplicated will cause an error.
In addition, the maximum value for each unit was not separately filtered.
Time Unit | Duration |
---|---|
ns | 1 Nano seconds |
us | 1 Micro Seconds |
ms | 1 Milli Seconds |
s | 1 Seconds |
m | 1 Minutes |
h | 1 Hours |
d | 1 Days |
w | 1 Weeks (7 Days) |
M | 1 Months (30 Days) |
y | 1 Years (365 Days) |
package main
import (
"fmt"
pd "github.com/SiverPineValley/parseduration"
)
// It returns 4 weeks + 2 days + 3 hours Duration
func main() {
fmt.Println(pd.ParseDuration("4w2d3h"))
}
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.