INNER CODE UNIT · JavaScript

getRandomPassword

shadowsocks/shadowsocks-manager · plugins/account/index.js:12

const getRandomPassword = passowrdLength => {
  const passwordChars = '23456789ABCDEFGHJKMNPQRSTUVWXYZabcdefghjkmnpqrstuvwxyz';
  const password = Array(passowrdLength).fill(passwordChars).map(function(x) { return x[Math.floor(Math.random() * x.length)]; }).join('');
  return password;
};

const runCommand = async cmd => {
  const exec = require('child_process').exec;
  return new Promise((resolve, reject) => {
    exec(cmd, (err, stdout, stderr) => {
      if(err) {
        return reject(stderr);
      } else {
        return resolve(stdout);
      }
    });
  });
};

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…