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.
directory-watcher
Advanced tools
A directory watcher that keeps an in memory list of the files in the directory, perfoming diffs on them when events arise from the underlying FSWatcher, which doesn't always reports back the files that are related to an event.
The API also provides "nicer" events using the EventEmitter API: "change", "add", "delete". (currently "change" doesn't function properly if the underlying watcher does not return the changed filename)
npm install directory-watcher
var DirectoryWatcher = require('directory-watcher');
DirectoryWatcher.create('/path/to/somewhere', function(err, watcher) {
watcher.once('change', function(files) {
console.log('will fire once');
});
watcher.on('delete', function(files) {
console.log('%s deleted', files);
});
watcher.on('add', function(files) {
console.log('%s added', files);
});
});
var DirectoryWatcher = require('directory-watcher');
DirectoryWatcher.createEx('/path/to/somewhere', function(err, watcher) {
var onFileEvent = watcher.listener();
onFileEvent('rename', undefined);
});
or
var DirectoryWatcher = require('directory-watcher');
var fs = require('fs');
DirectoryWatcher.createEx('/path/to/somewhere', function(err, watcher) {
fs.watch(path, watcher.listener(), { persistent: false });
});
note that watcher.kill() will only clear the internal files cache in this instance
FAQs
A directory watcher
The npm package directory-watcher receives a total of 4 weekly downloads. As such, directory-watcher popularity was classified as not popular.
We found that directory-watcher demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers 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.