
Security News
Axios Maintainer Confirms Social Engineering Attack Behind npm Compromise
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.
magic-packet
Advanced tools
一个简单而强大的 Node.js 工具,用于发送 Wake-on-LAN 魔术包唤醒局域网中的计算机。
npm install -g magic-packet
npm install magic-packet
全局安装后,可以直接使用 magic-packet 命令:
# 基本用法
magic-packet -m XX:XX:XX:XX:XX:XX
# 指定广播地址和端口
magic-packet -m XX:XX:XX:XX:XX:XX -i 192.168.1.255 -p 9
# 设置重试次数
magic-packet -m XX:XX:XX:XX:XX:XX -r 3
# 静默模式(不输出日志)
magic-packet -m XX:XX:XX:XX:XX:XX -s
# 查看帮助
magic-packet --help
const { sendMagicPacket, isValidMacAddress } = require('magic-packet');
// 验证MAC地址格式
if (isValidMacAddress('XX:XX:XX:XX:XX:XX')) {
// 发送魔术包
sendMagicPacket('XX:XX:XX:XX:XX:XX')
.then(() => console.log('魔术包已发送'))
.catch(err => console.error('发送失败:', err));
}
// 指定广播地址和端口
sendMagicPacket('XX:XX:XX:XX:XX:XX', '192.168.1.255', 9)
.then(() => console.log('魔术包已发送'))
.catch(err => console.error('发送失败:', err));
// 使用高级选项
sendMagicPacket('XX:XX:XX:XX:XX:XX', '192.168.1.255', 9, {
retries: 3, // 失败时最多重试3次
silent: true // 不输出日志
})
.then(() => console.log('魔术包已发送'))
.catch(err => console.error('发送失败:', err));
项目包含两个演示应用:
cd demo
npm install
npm start
提供了友好的命令行交互界面,可以:
cd demo
npm install
npm run web
启动后访问 http://localhost:3006 即可使用Web界面:
-m, --mac <address>: 目标计算机的 MAC 地址 (格式: XX:XX:XX:XX:XX:XX 或 XX-XX-XX-XX-XX-XX)-i, --ip <address>: 广播地址 (默认: 255.255.255.255)-p, --port <number>: 目标端口 (默认: 9)-r, --retries <number>: 发送失败时的重试次数 (默认: 0)-s, --silent: 静默模式,不输出日志sendMagicPacket(macAddress, ipAddress = '255.255.255.255', port = 9, options = {})
macAddress (字符串): MAC地址,格式为 XX:XX:XX:XX:XX:XX 或 XX-XX-XX-XX-XX-XXipAddress (字符串): 广播地址,默认为 255.255.255.255port (数字): 目标端口,默认为 9options (对象): 高级选项
retries (数字): 失败时的重试次数,默认为 0silent (布尔值): 是否静默模式,默认为 falseipconfig /all(Windows)或 ifconfig(Linux/Mac)命令查看npm install
npm test
npm run lint
MIT
FAQs
发送Wake-on-LAN魔术包唤醒局域网电脑
We found that magic-packet demonstrated a healthy version release cadence and project activity because the last version was released less than 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.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.