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.
electron-screen-plugin
Advanced tools
electron 截图插件
import debug from 'electron-debug'
import { app, globalShortcut } from 'electron'
import Screenshots from './screenshots'
app.on('ready', () => {
const screenshots = new Screenshots()
globalShortcut.register('ctrl+shift+a', () => screenshots.startCapture())
// 点击确定按钮回调事件
screenshots.on('ok', (e, { viewer }) => {
console.log('capture', viewer)
})
// 点击取消按钮回调事件
screenshots.on('cancel', () => {
console.log('capture', 'cancel1')
})
screenshots.on('cancel', e => {
// 执行了preventDefault
// 点击取消不会关闭截图窗口
e.preventDefault()
console.log('capture', 'cancel2')
})
// 点击保存按钮回调事件
screenshots.on('save', (e, { viewer }) => {
console.log('capture', viewer)
})
debug({ showDevTools: true, devToolsMode: 'undocked' })
})
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
app.quit()
}
})
{
externals: {
'electron-screenshots': 'require("electron-screenshots")'
}
}
vue-cli-plugin-electron-builder
配置示例vue-cli-plugin-electron-builder-issue// vue.config.js
module.exports = {
publicPath: '.',
pluginOptions: {
electronBuilder: {
// 不打包,使用 require 加载
externals: ['shortcut-capture']
}
}
}
名称 | 说明 | 参数 | 返回值 |
---|---|---|---|
startCapture | 调用截图方法截图 | - | - |
endCapture | 手动结束截图 | - | - |
interface Bounds {
x1: number
y1: number
x2: number
y2: number
}
interface CaptureData {
dataURL: string // 图片资源base64
bounds: Bounds // 截图区域坐标信息
}
type OkData = CaptureData
type SaveData = CaptureData
名称 | 说明 | 回调参数 |
---|---|---|
ok | 截图确认事件 | event :事件对象, data:OkData : 截图信息 |
cancel | 截图取消事件 | event :事件对象 |
save | 截图保存事件 | event :事件对象,data:OkData : 截图信息 |
event
对象可调用preventDefault
方法来阻止默认事件,例如阻止默认保存事件
const screenshots = new Screenshots()
screenshots.on('save', (e, data) => {
// 阻止插件自带的保存功能
// 用户自己控制保存功能
e.preventDefault()
// 用户可在这里自己定义保存功能
console.log('capture', data)
})
screenshots.startCapture()
FAQs
electron 截图插件
The npm package electron-screen-plugin receives a total of 0 weekly downloads. As such, electron-screen-plugin popularity was classified as not popular.
We found that electron-screen-plugin 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.