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.
@medv/finder
Advanced tools
The CSS Selector Generator
npm install @medv/finder
import {finder} from '@medv/finder'
document.addEventListener('click', event => {
const selector = finder(event.target)
console.log(selector)
})
An example of a generated selector:
.blog > article:nth-child(3) .add-comment
const selector = finder(event.target, {
root: document.body, // Root of search, defaults to document.body.
idName: (name) => true, // Check if this ID can be used.
className: (name) => true, // Check if this class name can be used.
tagName: (name) => true, // Check if tag name can be used.
attr: (name, value) => false, // Check if attr name can be used.
seedMinLength: 1,
optimizedMinLength: 2,
threshold: 1000,
maxNumberOfTries: 10_000,
})
Minimum length of levels in fining selector. Starts from 1
.
For more robust selectors give this param value around 4-5 depending on depth of
you DOM tree. If finder hits the root
, this param is ignored.
Minimum length for optimising selector. Starts from 2
.
For example selector body > div > div > p
can be optimised to body p
.
Max number of selectors to check before falling into nth-child
usage.
Checking for uniqueness of selector is very costly operation, if you have DOM
tree depth of 5, with 5 classes on each level, that gives you more than 3k
selectors to check. Default 1000
is good enough in most cases.
Max number of tries for the optimization. This is a trade-off between
optimization and efficiency. Default 10_000
is good enough in most cases.
FAQs
CSS Selector Generator
The npm package @medv/finder receives a total of 84,501 weekly downloads. As such, @medv/finder popularity was classified as popular.
We found that @medv/finder demonstrated a healthy version release cadence and project activity because the last version was released less than 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.