Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
"top" command for Node apps
The idea is to be able to quickly see the heaviest currently running Node functions using a single command in the terminal just like with "top" for regular processes. Another major point is only attaching the inspector for the time of the profiling so the tool can be always available in a production server without causing any overhead.
Once this is enabled there's no need to restart the app with "--profile" flag so any unexpected high CPU usage can be debugged more easily.
Usage - with no code changes required(Linux only)
npm i -g ntop
ntop inject 12345 // where 12345 is the process id
ntop 12345
Usage with includes in a project
npm i ntop
Add to the script to enable communication with CLI tool
const ntop = require('ntop')
ntop()
Then run the CLI. It will find all processes enabled for ntop communication
npx ntop
You'll see a list of ntop-enabled Node processes and their corresponding PIDs for convenience. Now you can see the list of functions for any process with
npx ntop 12345
Example output:
Custom sampling time 5s
npx ntop 12345 5000
Verbose output showing breadcrumbs i.e. to see what called (anonymous)
npx ntop 12345 5000 -v
Example output with "breadcrumbs":
(garbage collector) | 4.191ms |
utils.bulkPreparePacket | 3.034ms | file:///home/app/src/Utils.js:91:26
< prepareBulkData < (anonymous) < update < emit < update < processTick < (anonymous) < listOnTimeout < processTimers
(anonymous) | 2.574ms | evalmachine.:3:14
< listOnTimeout < processTimers
prepareBulkData | 1.516ms | file:///home/app/src/controllers/Map.js:672:17
< (anonymous) < update < emit < update < processTick < (anonymous) < listOnTimeout < processTimers
hasCallback | 1.141ms | file:///home/app/src/Scripting.js:271:13
< update < emit < update < processTick < (anonymous) < listOnTimeout < processTimers
Experimental flame chart
npx ntop 12345 5000 -f
"Flame chart" (initial experiment):
FAQs
Node CLI runtime profiler - easily debug unexpected high CPU usage
The npm package ntop receives a total of 4 weekly downloads. As such, ntop popularity was classified as not popular.
We found that ntop 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 researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.