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.
Simple way to get server information as json. Easy to extend with a config.rb
file.
Embeddable in Rails
Requirements ruby, min version 2
sudo apt-get install -y ruby build-essential ruby-dev
Usage standalone, you might need to run some commands as sudo.
gem install stats_lite --no-ri --no-rdoc
stats-lite
curl http://localhost:9111
Add to startup, crontab
crontab -e
# then add
@reboot /usr/local/bin/stats-lite /home/deploy/.stats-lite/config.rb
create a config.rb
then stats-lite
# example config.rb
# basic usage
StatsLite.configure do |s|
s.password "1234" # password protection
s.port 9111 # listening port
end
# now it's protected by passowrd
curl http://localhost:9111?password=1234
gem "stats_lite"
# routes.rb
mount StatsLite::App => "/server-stats"
StatsLite.configure do |s, h|
s.password ENV["STATS_LITE_PASS"] # defaults to nil, unprotected
s.port ENV["STATS_LITE_PORT"] # defaults to 9111
s.data -> (data) do # add more data
data[:ruby_current_time] = Time.now # simple value
data[:linux_time] = h.command("date") # bash command, supports {cache: true, expires_in: 60}
data[:slow_command] = h.fetch :slow_command, -> {
sleep 1
"slow command"
}, expires_in: 5 # cached ruby value
end
s.app do |sinatra| # extend the app, add multiple routes, which are protected by the password
sinatra.get("/another_route") do
content_type :json
{ cpus: h.command("nproc", { cache: true }) }.to_json
end
end
s.rack do # use rack builder, it's also password protected from above^
map "/rack" do
run lambda { |env| [200, {'Content-Type' => 'text/plain'}, ['OK']] }
end
end
s.cron do |rufus| # uses the Rufus scheduler, more details here https://github.com/jmettraux/rufus-scheduler
rufus.every "5s" do
print "\n cron job"
end
rufus.every "1h" do
print "\n hourly cron job"
end
end
end
FAQs
Unknown package
We found that stats_lite demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
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.