Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
github.com/muktihari/expr
Expr is a simple, lightweight and performant programming toolkit for evaluating basic mathematical expression and boolean expression. The resulting value is one of these following primitive types: string, boolean, numerical (complex, float, integer).
- Binary (base-2) : 0b1011
- Octal (base-8) : 0o13 or 013
- Decimal (base-10) : 11
- Hexadecimal (base-16) : 0xB
- Scientific : 11e0
"1 + 1" -> 2
"1.0 / 2" -> 0.5
"2 < 2 + 2" -> true
"true && !false" -> true
"4 << 10" -> 4096
"0b0100 << 0b1010" -> 4096 (0b1000000000000)
"0x4 << 0xA" -> 4096 (0x1000)
"0o4 << 0o12" -> 4096 (0o10000)
"0b1000 | 0b1001" -> 9 (0b1001)
"(2+1i) + (2+2i)" -> (4+3i)
"0x4 << 0xA > 1024" -> true
For binding variables into expr string, see Bind
For explaining step-by-step operations, see Explain
str := "(2+1i) + (2+2i)"
v, err := expr.Any(str)
if err != nil {
panic(err)
}
fmt.Printf("%v", v) // (4+3i)
str := "((1 < 2 && 3 > 4) || 1 == 1) && 4 < 5"
v, err := expr.Bool(str)
if err != nil {
panic(err)
}
fmt.Printf("%t", v) // true
str := "(2+1i) + (2+2i)"
v, err := expr.Complex128(str)
if err != nil {
panic(err)
}
fmt.Printf("%f", v) // (4+3i)
str := "((2 * 2) * (8 + 2) * 2) + 2.56789"
v, err := expr.Float64(str)
if err != nil {
panic(err)
}
fmt.Printf("%f", v) // 82.56789
str := "((2 * 2) * (8 + 2) * 2) + 2.56789"
v, err := expr.Int64(str)
if err != nil {
panic(err)
}
fmt.Printf("%d", v) // 82
str := "12 + 24 - 10/0"
v, err := expr.Int64Strict(str)
if err != nil {
// err == ErrIntegerDividedByZero
}
fmt.Printf("%d", v) // 0
str := "1 + 10"
v, err := expr.Int(str)
if err != nil {
panic(err)
}
fmt.Printf("%d", v) // 11
Expr is released under Apache Licence 2.0
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
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.