gen.js 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. import NodeImei from 'node-imei'
  2. import util from 'util'
  3. import randomstring from 'randomstring'
  4. import fs from 'fs'
  5. import url from 'url'
  6. import path from 'path'
  7. const filePath = url.fileURLToPath(import.meta.url)
  8. const __dirname = path.dirname(filePath)
  9. const nodeImei = new NodeImei()
  10. function randomeNumber(length) {
  11. let n = randomstring.generate({ length, charset: 'numeric' })
  12. while (n[0] === '0') {
  13. n = randomstring.generate({ length, charset: 'numeric' })
  14. }
  15. return n
  16. }
  17. const mcc = '310'
  18. const mnc = '240'
  19. const iccid = randomeNumber(20)
  20. const number = randomeNumber(10)
  21. const imei = nodeImei.random()
  22. const imsi = mcc + mnc + randomeNumber(15 - (mcc + mnc).length)
  23. const country = 'us'
  24. const vars = {
  25. mcc,
  26. mnc,
  27. iccid,
  28. number,
  29. imei,
  30. imsi,
  31. country
  32. }
  33. console.log(JSON.stringify(vars, null, 4))
  34. fs.writeFileSync(path.resolve(__dirname, 'vars.json'), JSON.stringify(vars, null, 4))
  35. fs.writeFileSync(
  36. path.resolve(__dirname, 'scripts/spoof_phone.js'),
  37. fs
  38. .readFileSync(path.resolve(__dirname, 'scripts/spoof_phone.js'))
  39. .toString()
  40. .replace(/config = (\{[\w\W\s\W]+?\})/g, `config = ${JSON.stringify(vars, null, 4)}`)
  41. )