如何用Chrome控制台(DevTools)手动生成强密码
1. 打开控制台
- 任意网页按下
F12
或Ctrl + Shift + I
(Mac 是Cmd + Option + I
) - 选择「Console」标签
2. 粘贴以下代码生成一个强密码:
const password = Array.from(crypto.getRandomValues(new Uint8Array(16)))
.map(b => 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()_+[]{}<>?'.charAt(b % 72))
.join('');
console.log("💡 生成的随机密码是:", password);
示例输出(每次不同):
xA9@M+zLDt)K31^#
你可以将 16 改为你想要的密码长度,例如 crypto.getRandomValues(new Uint8Array(24))
生成 24 位密码。
无法粘贴代码?
提示:Warning: Don’t paste code into the DevTools Console that you don’t understand or haven’t reviewed yourself. This could allow attackers to steal your identity or take control of your computer. Please type ‘allow pasting’ below and press Enter to allow pasting.
只需要输allow pasting即可粘贴代码
allow pasting
暂无标签