
Research
/Security News
60 Malicious Ruby Gems Used in Targeted Credential Theft Campaign
A RubyGems malware campaign used 60 malicious packages posing as automation tools to steal credentials from social media and marketing tool users.
github.com/tunabay/go-randdata
go-randdata is a Go package providing a mechanism for unit testing to generate and verify reproducible pseudo-random byte sequences.
Reader is the pseudo-random byte sequence generator. It implements the io.Reader interface and can be Read the generated byte sequence. Verifier is the Reader companion object that implements the io.Writer interface. It verifies that the data written is exactly the same as the byte sequence generated by the Reader.
import (
"fmt"
"github.com/tunabay/go-randdata"
)
func main() {
// 5 MB pseudo-random byte sequence, using random seed 123
r := randdata.New(randdata.Binary, 123, 5000000)
// paired verifier
v := r.NewVerifier()
// read and veriry data
buf := make([]byte, 256)
for {
n, err := r.Read(buf)
if 0 < n {
if _, err := v.Write(buf[:n]); err != nil {
fmt.Println(err)
break
}
}
if err != nil {
if err != io.EOF {
fmt.Println(err)
}
break
}
}
// verify that written data is enough
if err := v.Close(); err != nil {
fmt.Println(err)
}
fmt.Println("Read:", r.TotalRead())
}
The Reader also generates "jitter" to reading operation. In the above example, calling Read method with the 256 bytes buffer returns randomly shorter written length. While the Read method of the io.Reader interface can return shorter length than passed buffer, program should be able to handle that.
go-randdata is available 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
A RubyGems malware campaign used 60 malicious packages posing as automation tools to steal credentials from social media and marketing tool users.
Security News
The CNA Scorecard ranks CVE issuers by data completeness, revealing major gaps in patch info and software identifiers across thousands of vulnerabilities.
Research
/Security News
Two npm packages masquerading as WhatsApp developer libraries include a kill switch that deletes all files if the phone number isn’t whitelisted.