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/nickpoorman/go-amp-message
High level AMP Message
implementation for manipulating, encoding and decoding AMP messages in Go.
$ go get github.com/nickpoorman/go-amp-message
Encoding a message:
msg := ampmessage.New(nil)
fmt.Printf("<Bytes: %x>\n", msg.ToBytes())
// => <Bytes: 10>
msg.Push(ampmessage.NewStringArg("foo"))
msg.PushString("bar") // convenience method for pushing a new StringArg
msg.PushString("baz")
fmt.Printf("<Bytes: %x>\n", msg.ToBytes())
// => <Bytes: 1300000005733a666f6f00000005733a62617200000005733a62617a>
// json
jsonObj, _ := ampmessage.NewJSONArg(map[string]string{"foo": "bar"})
msg.Push(jsonObj)
fmt.Printf("<Bytes: %x>\n", msg.ToBytes())
// => <Bytes: 1400000005733a666f6f00000005733a62617200000005733a62617a0000000f6a3a7b22666f6f223a22626172227d>
// convenience method for pushing a new JSONArg
msg.PushJSON(map[string]string{"ping": "pong"})
fmt.Printf("<Bytes: %x>\n", msg.ToBytes())
// => <Bytes: 1500000005733a666f6f00000005733a62617200000005733a62617a0000000f6a3a7b22666f6f223a22626172227d000000116a3a7b2270696e67223a22706f6e67227d>
blob := []byte("beep")
msg.Push(ampmessage.NewBlobArg(blob))
msg.PushBlob([]byte("boop")) // convenience method for pushing a new BlobArg
fmt.Printf("<Bytes: %x>\n", msg.ToBytes())
// => <Bytes: 1700000005733a666f6f00000005733a62617200000005733a62617a0000000f6a3a7b22666f6f223a22626172227d000000116a3a7b2270696e67223a22706f6e67 ... >
Decoding a message:
msg := ampmessage.New(nil)
msg.PushString("foo")
msg.PushJSON(map[string]string{"hello": "world"})
msg.PushBlob([]byte("hello"))
other, _ := ampmessage.NewFromBytes(msg.ToBytes())
fmt.Printf("%s\n", other.Shift())
// => &foo
fmt.Printf("%s\n", other.Shift())
// => &{"hello":"world"}
fmt.Printf("%s\n", other.Shift())
// => &hello
ampmessage.New(nil)
Initialize an empty message.
ampmessage.NewFromBytes(bytes)
Decode the buffer
AMP message to populate the Message
.
ampmessage.New(args)
Initialize a message populated with args
.
MIT
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.