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.
markup-color-extractor
Advanced tools
Extract colors from HTML and XML. This library can detect all of the color types supported by TinyColor.
opt
)Extract colors from a buffer
opt
- An options object
buffer
- A Buffer containing markuperr
, array colors
) cb
- A function to be executed after the colors are extractedunique
- (Optional) If true
, the color array will not contain duplicates (Default true
)text
- (Optional) If true
, will search element inner text for colorsattributes
- (Optional) If true
, will search all element attributes for colors, or if an array, will search only the attributes listed in the arrayExample
fs.readFile(path.join(__dirname, 'colors.xml'), function(err, data) {
if (err) { throw err; }
extractColors.from.buffer({
buffer: data,
attributes: true,
text: true,
cb: function(err, colors) {
if (err) { throw err; }
console.log(colors);
}
});
});
opt
)Extract colors from a string
opt
- An options object
string
- A string containing markuperr
, array colors
) cb
- A function to be executed after the colors are extractedunique
- (Optional) If true
, the color array will not contain duplicates (Default true
)text
- (Optional) If true
, will search element inner text for colorsattributes
- (Optional) If true
, will search all element attributes for colors, or if an array, will search only the attributes listed in the arrayExample
extractColors.from.string({
string: '<color value="#E0162B">#0052A5</color>',
text: true,
attributes: ['value'],
cb: function(err, colors) {
if (err) { throw err; }
console.log(colors);
}
});
opt
)Extract colors from a file
opt
- An options object
file
- A path to a file containing markuperr
, array colors
) cb
- A function to be executed after the colors are extractedunique
- (Optional) If true
, the color array will not contain duplicates (Default true
)text
- (Optional) If true
, will search element inner text for colorsattributes
- (Optional) If true
, will search all element attributes for colors, or if an array, will search only the attributes listed in the arrayExample
extractColors.from.file({
file: path.join(__dirname, 'colors.xml'),
attributes: true,
text: true,
cb: function(err, colors) {
if (err) { throw err; }
console.log(colors);
}
});
opt
)Extract colors from a url
opt
- An options object
url
- A url to a file containing markuperr
, array colors
) cb
- A function to be executed after the colors are extractedunique
- (Optional) If true
, the color array will not contain duplicates (Default true
)text
- (Optional) If true
, will search element inner text for colorsattributes
- (Optional) If true
, will search all element attributes for colors, or if an array, will search only the attributes listed in the arrayExample
extractColors.from.url({
url: 'http://site.com/colors.html',
attributes: true,
text: true,
cb: function(err, colors) {
if (err) { throw err; }
console.log(colors);
}
});
You may also supply any of the htmlparser2 parser options in opt
for all of the methods listed above.
npm install markup-color-extractor
Before running the tests, Mocha must be installed:
npm install -g mocha
To run the tests:
npm test
FAQs
Extract colors from markup (XML and HTML)
We found that markup-color-extractor 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.