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.
Pattern detection using Local Binary Patterns algorithm
http://en.wikipedia.org/wiki/Local_binary_patterns
npm install lbp
or
// put library in your javascript root directory
<script src="{js directory}/lbp/lib/LBP.js"></script>
<script>
var lbp = new LBP();
...
</script>
// image data (two dimensional array of pixel values in gray scale)
var data = [
[6,5,2, ...],
[7,6,1, ...],
[9,8,7, ...],
...
];
var lbp = new LBP(data, 8, 1); // 8 is number of sampling points, 1 is radius
// calculate LBP, contrast and variance for pixel at position [1,1]
console.log(lbp.calculate(1, 1));
// calculate LBP distribution, contrast and variance for whole image
console.log(lbp.distribution());
By default, library is using rotation independent binary patterns. It means, all following patterns will be rotated to one uniform pattern:
1100 0000 -> 0000 0011
0000 1100 -> 0000 0011
1000 0001 -> 0000 0011
If you want to desable this behaviour, please set LBP.rotationInvariantLBPs
to false
.
TODO
For better performance library uses local memory for storing calculation results. If you want to use your own memory adapter, it should implement following interface:
MyAdapter.prototype.set = function(key, value) {};
MyAdapter.prototype.get = function(key) {}; // returns null if key is not found
// assign custom memory adapter
LBP.memory = new MyAdapter();
If you'd like to contribute, open an issue ticket or send pull request.
mocha -R spec
FAQs
Pattern detection using Local Binary Patterns algorithm
We found that lbp 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.