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.
scandal provides two utilities:
Scanning a directory for paths matching a set of glob inclusions or exclusions. For example, you want to find a list of paths to search that match a certain pattern, but are not ignored by the .gitignore
.
Searching a list of paths for a regex. For example, you have a list of paths, you want to find all instances of /text/gi
.
Unsurprisingly, these two things can be combined to scan and search a directory.
It is written to be simple, flexible and efficient. Scandal does the minimum.
We want to provide modules to combine in any way you'd like. Want to scan in one process and search in another? You can do that.
To be clear, scandal is not a CLI. It can be used from the terminal, but in practice it's only used for benchmarking.
scandal provides two main modules: PathScanner
and PathSearcher
.
Usage is simple:
{PathScanner} = require 'scandal'
scanner = new PathScanner('/Users/me/myDopeProject', options)
scanner.on 'path-found', (path) ->
console.log(path)
scanner.on 'finished-scanning', ->
console.log('All done!')
scanner.scan()
PathScanner
keeps no state. You must consume paths via the 'path-found' event.
['dirname']
and ['dirname/']
will match all paths in direcotry dirname
inclusions
.{PathSearcher} = require 'scandal'
searcher = new PathSearcher()
# You can subscribe to a `results-found` event
searcher.on 'results-found', (result) ->
# result will contain all the matches for a single path
console.log("Single Path's Results", result)
# Search a list of paths
searcher.searchPaths /text/gi, ['/Some/path', ...], (results) ->
console.log('Done Searching', results)
# Search a single path
searcher.searchPath /text/gi, '/Some/path', (result) ->
console.log('Done Searching', result)
Results from line 10 (1 based) are in the following format.
{
"path": "/Some/path",
"matches": {
"matchText": "Text",
"lineText": "Text in this file!",
"lineTextOffset": 0,
"range": [[9, 0], [9, 4]]
}
}
Like the PathScanner
the searcher keeps no state. You need to consume results via the done callbacks or event.
File reading is fast and memory efficient. It reads in 10k chunks and writes over each previous chunk. Small object creation is kept to a minimum during the read to make light use of the GC.
A third object, PathFilter
is available, but intended for use by the PathScanner
.
If you dont want to think about combining the PathScanner
and PathSearcher
in your own way, a search
is function provided.
{search, PathScanner, PathSearcher} = require 'scandal'
path = '/path/to/search'
scanner = new PathScanner(path, excludeVcsIgnores: true)
searcher = new PathSearcher()
searcher.on 'results-found' (result) ->
# do something rad with the result!
name = "Search #{path}"
console.time name
console.log name
search /text/ig, scanner, searcher, ->
console.timeEnd name
FAQs
Directory Search and Scan Utilities
We found that scandal demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 8 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
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.