import NodeImei from 'node-imei' import util from 'util' import randomstring from 'randomstring' import fs from 'fs' import url from 'url' import path from 'path' const filePath = url.fileURLToPath(import.meta.url) const __dirname = path.dirname(filePath) const nodeImei = new NodeImei() function randomeNumber(length) { let n = randomstring.generate({ length, charset: 'numeric' }) while (n[0] === '0') { n = randomstring.generate({ length, charset: 'numeric' }) } return n } const mcc = '310' const mnc = '240' const iccid = randomeNumber(20) const number = randomeNumber(10) const imei = nodeImei.random() const imsi = mcc + mnc + randomeNumber(15 - (mcc + mnc).length) const country = 'us' const vars = { mcc, mnc, iccid, number, imei, imsi, country } console.log(JSON.stringify(vars, null, 4)) fs.writeFileSync(path.resolve(__dirname, 'vars.json'), JSON.stringify(vars, null, 4)) fs.writeFileSync( path.resolve(__dirname, 'scripts/spoof_phone.js'), fs .readFileSync(path.resolve(__dirname, 'scripts/spoof_phone.js')) .toString() .replace(/config = (\{[\w\W\s\W]+?\})/g, `config = ${JSON.stringify(vars, null, 4)}`) )