Research
Security News
Threat Actor Exposes Playbook for Exploiting npm to Build Blockchain-Powered Botnets
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
find-in-files
Advanced tools
A simple tool to search text patterns across multiple files
find-in-files is a node module available via npm. You can install it with
$ npm install --save find-in-files
The module exposes two simple functions which expect three parameters each.
// Async
find(pattern, directory, fileFilter)
// Sync
findSync(pattern, directory, fileFilter)
The string you want to search for or object to control regex flags
The directory you want to search in.
A regex you can pass in to only search in files matching the filter.
var findInFiles = require('find-in-files');
Both functions return a promise which will receive the results object. The results object contains the matches, count of matches per file and the lines that match.
{
'fileOne.txt': {
matches: ['found string'],
count: 1,
lines: ['This line contains a found string.']
}
}
findInFiles.find("I'm Brian, and so's my wife!", '.', '.txt$')
.then(function(results) {
for (var result in results) {
var res = results[result];
console.log(
'found "' + res.matches[0] + '" ' + res.count
+ ' times in "' + result + '"'
);
}
});
// Use object to set flags on regular expression. This one will ignore case.
findInFiles.find({'term': "I'm Brian, and so's my wife!", 'flags': 'ig'}, '.', '.txt$')
.then(function(results) {
for (var result in results) {
var res = results[result];
console.log(
'found "' + res.matches[0] + '" ' + res.count
+ ' times in "' + result + '"'
);
}
});
MIT © Philipp Nowinski
FAQs
A simple tool to search text patterns across multiple files
The npm package find-in-files receives a total of 44,452 weekly downloads. As such, find-in-files popularity was classified as popular.
We found that find-in-files 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
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
Security News
NVD’s backlog surpasses 20,000 CVEs as analysis slows and NIST announces new system updates to address ongoing delays.
Security News
Research
A malicious npm package disguised as a WhatsApp client is exploiting authentication flows with a remote kill switch to exfiltrate data and destroy files.