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/loveholidays/ripley
Ripley replays HTTP traffic at multiples of the original rate. It simulates traffic ramp up or down by specifying rate phases for each run. For example, you can replay HTTP requests at twice the original rate for ten minutes, then three times the original rate for five minutes, then ten times the original rate for an hour and so on. Ripley's original use case is load testing by replaying HTTP access logs from production applications.
Clone and build ripley
git clone git@github.com:loveholidays/ripley.git
cd ripley
go build -o ripley main.go
Run a web server to replay traffic against
go run etc/dummyweb.go
Loop 10 times over a set of HTTP requests at 1x rate for 10 seconds, then at 5x for 10 seconds, then at 10x for the remaining requests
seq 10 | xargs -i cat etc/requests.jsonl | ./ripley -pace "10s@1 10s@5 1h@10"
Ripley reads a representation of HTTP requests in JSON Lines format from STDIN
and replays them at different rates in phases as specified by the -pace
flag.
An example ripley request:
{
"url": "http://localhost:8080/",
"verb": "GET",
"timestamp": "2021-11-08T18:59:59.9Z",
"headers": {"Accept": "text/plain"}
}
url
, verb
and timestamp
are required, headers
are optional.
-pace
specifies rate phases in [duration]@[rate]
format. For example, 10s@5 5m@10 1h30m@100
means replay traffic at 5x for 10 seconds, 10x for 5 minutes and 100x for one and a half hours. The run will stop either when ripley stops receiving requests from STDIN
or when the last phase elapses, whichever happens first.
Ripley writes request results as JSON Lines to STDOUT
echo '{"url": "http://localhost:8080/", "verb": "GET", "timestamp": "2021-11-08T18:59:50.9Z"}' | ./ripley | jq
produces
{
"statusCode": 200,
"latency": 3915447,
"request": {
"verb": "GET",
"url": "http://localhost:8080/",
"body": "",
"timestamp": "2021-11-08T18:59:50.9Z",
"headers": null
}
}
Results output can be suppressed using the -silent
flag.
It is possible to collect and print a run's statistics:
seq 10 | xargs -i cat etc/requests.jsonl | ./ripley -pace "10s@1 10s@5 1h@10" -silent -stats | jq
{
"totalRequests": 100,
"statusCodes": {
"200": 100
},
"latencyMicroseconds": {
"max": 2960,
"mean": 2008.25,
"median": 2085.5,
"min": 815,
"p95": 2577,
"p99": 2876,
"stdDev": 449.1945986986041
}
}
go test pkg/*go
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.