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.
Node.js module. Parse HTML and extract «a» elements.
$ npm install --save html-a
HTML string example:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Example HTML</title>
</head>
<body>
<p id="first">
<a href="http://site.com"><b>Some site</b></a>
</p>
<p>
<a href="#first">Link in page</a>
<a href="javascript:alert('Hello, World!');">Hello!</a>
<a href="/foo/bar">FooBar</a>
</p>
</body>
</html>
CommonJS example:
const htmla = require ( 'html-a' );
const html = 'an example HTML is given above';
// Get href and innerHTML from «a» elements.
// For more information, use the options.
htmla ( html );
//=>
// [
// { innerHTML: '<b>Some site</b>', href: 'http://site.com' },
// { innerHTML: 'Link in page', href: '#first' },
// { innerHTML: 'Hello!', href: 'javascript:alert(\'Hello, World!\');' },
// { innerHTML: 'FooBar', href: '/foo/bar' }
// ]
// OR just get all DOM «a» elements
htmla.getElements ( html );
Gets custom info about «a» elements.
Returns an Array
.
Type: string
HTML string for extract «a» elements.
Type: object
Settings to obtain the desired information.
Type: boolean
Default: false
Gets inner text in element.
Type: boolean
Default: true
Gets inner HTML in element.
Type: boolean
Default: true
Gets attribute href in element.
Type: boolean
Default: false
Gets all attributes in element.
Type: boolean
Default: false
Gets element DOM object.
Parses HTML, gets all DOM «a» elements.
Returns an Array
.
Type: string
HTML string for extract «a» elements.
MIT © Nikita «Arttse» Bystrov
FAQs
Parse HTML and extract «a» elements
The npm package html-a receives a total of 0 weekly downloads. As such, html-a popularity was classified as not popular.
We found that html-a 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’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.