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.
@hscmap/magic-trackpad-detector
Advanced tools
* Apple's Magic trackpad emits *pseudo inertial* scroll event. This module determines wheter a wheel event is a **real** event (generated by a user's action)Ï or a **pseudo inertial** event. * [Working Demo](https://michitaro.github.io/magic-trackpad-dete
npm instasll --save @hscmap/magic-trackpad-detector
import { MagicTrackpadDetector } from "@hscmap/magic-trackpad-detector"
window.addEventListener('load', e => {
const trackpad = document.querySelector('.trackpad') as HTMLDivElement
const canvas = document.querySelector('canvas') as HTMLCanvasElement
const history: [number, boolean][] = []
const mtd = new MagicTrackpadDetector()
const historyCanvas = new HistoryCanvas(history, canvas)
trackpad.addEventListener('wheel', e => {
e.preventDefault()
history.unshift([e.deltaY, mtd.inertial(e)])
if (history.length > canvas.width)
history.splice(canvas.width)
historyCanvas.refresh()
})
historyCanvas.refresh()
})
class HistoryCanvas {
private ctx: CanvasRenderingContext2D
private w: number
private h: number
constructor(private history: [number, boolean][], canvas: HTMLCanvasElement) {
this.ctx = canvas.getContext('2d')!
this.w = canvas.width
this.h = canvas.height
}
refresh() {
this.clear()
this.drawInertialAreas()
this.drawAxis()
this.drawHistory()
}
private clear() {
this.ctx.clearRect(0, 0, this.w, this.h)
}
private drawInertialAreas() {
const ctx = this.ctx
let state = false
let start: number
this.history.push([0, false])
for (let x = 0; x < this.history.length; ++x) {
const [, i] = this.history[x]
if (state != i) {
if (state = i)
start = x
else {
ctx.fillStyle = '#ccf'
ctx.fillRect(start!, 0, x - start, this.h)
}
}
}
this.history.pop()
}
private drawHistory() {
const ctx = this.ctx
ctx.strokeStyle = '#f00'
ctx.beginPath()
for (let x = 0; x < this.history.length; ++x) {
const [y,] = this.history[x]
ctx.lineTo(x, y + this.h / 2)
}
ctx.stroke()
}
private drawAxis() {
const ctx = this.ctx
ctx.beginPath()
ctx.strokeStyle = '#777'
ctx.lineTo(0, this.h / 2)
ctx.lineTo(this.w, this.h / 2)
ctx.stroke()
}
}
FAQs
* Apple's Magic trackpad emits *pseudo inertial* scroll event. This module determines wheter a wheel event is a **real** event (generated by a user's action) or a **pseudo inertial** event. * [Working Demo](https://michitaro.github.io/magic-trackpad-detec
We found that @hscmap/magic-trackpad-detector 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.