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.
pidusage-fork
Advanced tools
Process cpu % and memory use of a PID
Ideas from https://github.com/arunoda/node-usage/ but with no C-bindings
var pusage = require('pidusage')
pusage.stat(process.pid, function(err, stat) {
expect(err).to.be.null
expect(stat).to.be.an('object')
expect(stat).to.have.property('cpu')
expect(stat).to.have.property('memory')
console.log('Pcpu: %s', stat.cpu)
console.log('Mem: %s', stat.memory) //those are bytes
})
// Unmonitor process
pusage.unmonitor(18902);
A check on the os.platform
is done to determine the method to use.
We use /proc/{pid}/stat
in addition to the the PAGE_SIZE
and the CLK_TCK
direclty from getconf()
command. Uptime comes from proc/uptime
file because it's more accurate than the nodejs os.uptime()
.
We use a fallback with the ps -o pcpu,rss -p PID
command to get the same informations.
AIX is tricky because I have no AIX test environement, at the moment we use: ps -o pcpu,rssize -p PID
but /proc
results should be more accurate! If you're familiar with the AIX environment and now how to get the same results as we've got with Linux systems, please help.
#4
Windows is really tricky, atm it uses the wmic.exe
, feel free to share ideas on how to improve this.
MIT
FAQs
Process cpu % and memory use of a PID
The npm package pidusage-fork receives a total of 4 weekly downloads. As such, pidusage-fork popularity was classified as not popular.
We found that pidusage-fork 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.