UNPKG

reavetard

Version:

CoffeeScript modules that provide AP rotation support and a host of data management and general usability enhancements for Reaver-WPS Cracker and its partner in crime, Wash-WPS Scanner

463 lines (431 loc) 18.6 kB
// Generated by CoffeeScript 1.3.3 (function() { var REAVER_BAR_STYLES, REAVETARD_TARGET_ACTIONS, REAVETARD_TITLE, REAVETARD_TITLE_S, REVIEW_SELECTORS, STATION_COLORS, arrwrite, cdwrite, charm, cwrite, _this = this, __slice = [].slice; charm = require('charm')(process.stdout); arrwrite = function(arr, cd) { var a, _i, _len, _results; if (cd == null) { cd = false; } _results = []; for (_i = 0, _len = arr.length; _i < _len; _i++) { a = arr[_i]; if (Array.isArray(a)) { if (cd) { _results.push(cdwrite.apply(null, a)); } else { _results.push(cwrite.apply(null, a)); } } else { if (cd) { _results.push(cdwrite.apply(null, [a])); } else { _results.push(cwrite.apply(null, [a])); } } } return _results; }; cwrite = function() { if (arguments.length === 1) { return charm.write(arguments[0]); } else if (arguments.length >= 2) { charm.foreground(arguments[0]); if (arguments.length >= 3) { charm.background(arguments[1]); return charm.write(arguments[2]); } else { return charm.write(arguments[1]); } } }; cdwrite = function(disp, fg, bg, str) { var args; charm.display('reset'); charm.display(disp); args = []; if (fg != null) { args.push(fg); } if (bg != null) { args.push(bg); } if (str != null) { args.push(str); } return cwrite.apply(null, args); }; REAVETARD_TITLE = [['reset', 'blue', ' eibbors.com/p/reavetard/\n'], ['dim', 'magenta', ' -------------------------------------------------------------\n'], ['bright', 57, ' - ▀█▀▀▀▄ ▄▀▀▀▄ ▀▀▀▀▄ █ █ ▄▀▀▀▄ ▄█▄▄ ▀▀▀▀▄ ▀█▀▀▀▄ ▀█ -\n'], ['bright', 56, ' - █ ▀ █▀▀▀▀ █▀▀▀█ ▀▄ ▄▀ █▀▀▀▀ █ ▄ █▀▀▀█ █ ▀ ▄▀▀▀█ -\n'], ['bright', 55, ' - ▀▀ ▀▀▀▀ ▀▀▀ ▀ ▀ ▀▀▀▀ ▀▀▀ ▀▀▀ ▀ ▀▀ ▀▀▀▀▀ -\n'], ['reset', 'blue', ' - Coffee-powered enhancements for WPS PIN Cracker, Reaver -\n'], ['dim', 'magenta', ' -------------------------------------------------------------\n'], ['reset', '\n']]; REAVETARD_TITLE_S = [['bright', 57, ' __ _ _ _ _ _ ___ _ __ _ \n'], ['bright', 56, ' |_| |_| _| | | |_| | _| | | _| '], ['reset', 'blue', 'CoffeeScript goodies for Reaver-WPS\n'], ['bright', 55, ' | \\ |__ |_\\ V |__ | |_\\ | |_|_ '], ['reset', 'blue', 'Courtesy of Robbie Saunders (eibbors.com)\n\n']]; REVIEW_SELECTORS = [['bright', 250, '\n Special Selectors: \n'], ['reset', 240, ' ---------------------------------------------------------------------------------'], ['bright', 'white', '\n 0 /'], ['reset', 'white', ' Select all'], ['bright', 'black', ', '], ['bright', 'green', ' -1 /'], ['reset', 'green', ' Cracked targets'], ['bright', 'black', ', '], ['bright', 'blue', '-2 /'], ['reset', 'blue', ' Targets in progress'], ['bright', 'black', ', '], ['bright', 5, '-3 /'], ['reset', 5, ' New targets\n\n'], ['reset', 240, ' Note: Delimit multiple selections with any non-digit character but `-`\n']]; STATION_COLORS = exports.STATION_COLORS = { C: 'green', W: 'blue', N: 5 }; REAVETARD_TARGET_ACTIONS = [['bright', 'magenta', ' (a)ttack : '], ['reset', 'magenta', 'Queue the station(s) for attack and begin cracking\n'], ['bright', 'magenta', ' (d)elete : '], ['reset', 'magenta', 'Delete their database entries and/or session files\n'], ['bright', 'magenta', ' (e)xport : '], ['reset', 'magenta', 'Export reaver.db and session file(s) to a new location\n'], ['bright', 'magenta', ' (j)son : '], ['reset', 'magenta', 'Output JSON object(s) containing all available target data\n'], ['bright', 'magenta', ' (s)essions : '], ['reset', 'magenta', 'Create and/or Customize their session files\n'], ['bright', 'magenta', ' (u)sage : '], ['reset', 'magenta', 'Print reavetard\'s best guess @ proper reaver arguments (usage)\n'], ['bright', 'magenta', ' e(x)it : '], ['reset', 'magenta', 'End process without doing anything else\n']]; REAVER_BAR_STYLES = { 1: [54, 'white', ' St ', '>'], 2: [55, 'white', ' Id ', '>'], 3: [56, 'white', ' Id ', '<'], 4: [18, 'white', ' M1 ', '>'], 5: [19, 'white', ' M2 ', '<'], 6: [20, 'white', ' M3 ', '>'], 7: [21, 'white', ' M4 ', '<'], 8: [23, 'white', ' M5 ', '>'], 9: [31, 'white', ' M6 ', '<'], 10: [22, 'white', ' M7 ', '>'], 0: [203, 'black', ' Na ', '<>'], nack: this[0], timeout: [52, 'white', ' TO '], failure: ['red', 'white', ' Fail '], fail3: ['red', 'white', ' WFx2 '], fail2: ['red', 'white', ' WFx3 '], fail4: ['red', 'white', ' WFx4 '], beacon: [234, 'white', ' WB '], associated: [23, 'white', ' Assoc '] }; exports.statusBar = function(btype, value, handling) { var bstyle, now, tstamp, _ref, _ref1, _ref2; if (btype === 'pinbar') { cdwrite('reset', 'blue', '\n |- Trying pin '); cdwrite('bright', 'blue', "" + value); cdwrite('reset', 'blue', ' - ['); charm.push(); cdwrite('reset', 'blue', ' ] '); if (handling) { cdwrite('reset', 'blue', '- ['); cdwrite('bright', 28, " " + ((_ref = handling.totalChecked) != null ? _ref : 0) + " "); cdwrite('bright', 52, " " + ((_ref1 = handling.consecutiveFailures) != null ? _ref1 : 0) + " "); cdwrite('bright', 166, " " + handling.totalFailures + " "); cdwrite('reset', 'blue', ']'); } charm.pop(); } else if (btype === 'procbar') { cdwrite('reset', 250, '\n _- New reaver process spawned for '); cdwrite('bright', 250, "" + value); cdwrite('reset', 250, ' - ['); charm.push(); cdwrite('reset', 250, ' ]'); now = new Date(); tstamp = "" + (now.getHours()) + ":" + (now.getMinutes()) + ":" + (now.getSeconds()) + " " + (now.getMonth()) + "-" + (now.getDate()) + "-" + (now.getFullYear()); cdwrite('reset', 'magenta', " @ " + tstamp); charm.pop(); } else if (btype === 'error') { cdwrite('bright', 'red', "\n ¯- " + value + " "); cdwrite('reset', 'red', "- " + handling + "\n"); } else if (btype === 'success') { cdwrite('bright', 'green', "\n ¯-_-¯- " + value); cdwrite('reset', 'green', " - " + handling + "\n"); } else { bstyle = (_ref2 = REAVER_BAR_STYLES[btype]) != null ? _ref2 : ['blue', 'white', "" + value]; cdwrite('reset', bstyle[1], bstyle[0], bstyle[2]); cdwrite('reset', ''); } return this; }; exports.title = function(full) { if (full == null) { full = true; } if (full) { arrwrite(REAVETARD_TITLE, true); } else { arrwrite(REAVETARD_TITLE_S, true); } return this; }; exports.targetActions = function() { arrwrite(REAVETARD_TARGET_ACTIONS, true); return this; }; exports.reviewSelectors = function() { arrwrite(REVIEW_SELECTORS, true); return this; }; exports.tableFrame = function(type, maxessid, maxpsk, foot, line) { var char, esect, psect; if (foot == null) { foot = false; } if (line == null) { line = false; } if (line) { char = '-'; } else { char = '='; } esect = new Array(maxessid + 1).join(char); psect = new Array(maxpsk + 1).join(char); if (type === 'C') { if (line) { return charm.write("\n |----+------+----+---+-------------------+" + esect + "--+-------+----------+--" + psect + "|\n"); } if (foot) { return charm.display('bright').write("\n \\=================================================================" + psect + esect + "/\n\n"); } charm.display('reset').foreground('green').display('bright'); charm.write(" /=================================================================" + psect + esect + "\\\n"); charm.write(" | ## | RSSI | Ch | L | BSSID |"); _this.tableCell('green', 'bright', 'ESSID', maxessid); charm.display('bright').write(' Att. | PIN |'); _this.tableCell('green', 'bright', 'WPA PSK', maxpsk); charm.display('bright').write("\n |=================================================================" + psect + esect + "|\n"); } else if (type === 'W') { if (line) { return charm.write("\n |----+------+----+---+-------------------+" + esect + "--+-------+---------------+------|\n"); } if (foot) { return charm.display('bright').write("\n \\==========================================================================" + esect + "/\n\n"); } charm.display('reset').foreground('blue').display('bright'); charm.write(" /==========================================================================" + esect + "\\\n"); charm.write(" | ## | RSSI | Ch | L | BSSID |"); _this.tableCell('blue', 'bright', 'ESSID', maxessid); charm.display('bright').write(' Att. | Progress | PIN |\n'); charm.write(" |==========================================================================" + esect + "|\n"); } else if (type === 'N') { if (line) { return charm.write("\n |----+------+----+---+-------------------+" + esect + "--|\n"); } if (foot) { return charm.display('bright').write("\n \\===========================================" + esect + "/\n"); } charm.display('reset').foreground(5).display('bright'); charm.display('bright').write(" /===========================================" + esect + "\\\n"); charm.write(" | ## | RSSI | Ch | L | BSSID |"); _this.tableCell(5, 'bright', 'ESSID', maxessid); charm.display('bright').write("\n |===========================================" + esect + "|\n"); } return _this; }; exports.tableCell = function(color, disp, value, size) { var fn, _this = this; if (value === 'undefined' || value === void 0) { value = ' '; } charm.display('reset').display(disp).foreground(color); if (value.length > size) { charm.write(" " + value.slice(0, (size - 1) + 1 || 9e9) + " "); } else { charm.write(" " + value + " "); if (value.length < size) { charm.write((new Array(size + 1 - value.length)).join(' ')); } } charm.display('reset').foreground(color).write('|'); return fn = function(v, s) { return exports.tableCell.apply(null, [color, disp, v, s]); }; }; exports.targetReviewTable = function(stations) { var beginrow, indexed, isfirst, key, maxessid, maxpsk, perc, s, val, _i, _j, _k, _l, _len, _len1, _len2, _len3, _ref, _ref1, _ref2, _ref3, _ref4, _ref5, _ref6, _ref7, _ref8, _this = this; maxessid = 0; maxpsk = 0; for (key in stations) { val = stations[key]; for (_i = 0, _len = val.length; _i < _len; _i++) { s = val[_i]; if (((_ref = s.essid) != null ? _ref.length : void 0) > maxessid) { maxessid = s.essid.length; } if (((_ref1 = s.key) != null ? _ref1.length : void 0) > maxpsk) { maxpsk = s.key.length; } } } beginrow = function(color, st) { charm.write(' |'); _this.tableCell(color, 'reset', "" + st.tableIndex, 2)("" + st.rssi, 4)("" + st.channel, 2); if (st.locked) { charm.foreground('red').display('bright').write(' Y ').display('reset').foreground(color).write('|'); } else { _this.tableCell(color, 'reset', 'n', 1); } return _this.tableCell(color, 'reset', "" + st.bssid, 17)("" + st.essid, maxessid); }; this.title(false); indexed = []; if (((_ref2 = stations.complete) != null ? _ref2.length : void 0) >= 1) { this.tableFrame('C', maxessid, maxpsk); stations.complete.sort(function(a, b) { if (a.rssi > b.rssi) { return 1; } else { return -1; } }); _ref3 = stations.complete; for (_j = 0, _len1 = _ref3.length; _j < _len1; _j++) { s = _ref3[_j]; s.tableIndex = indexed.length + 1; indexed.push(s); if (indexed.length > 1) { this.tableFrame('C', maxessid, maxpsk, false, true); } beginrow('green', s); this.tableCell('green', 'reset', "" + (Number(s.session.ki1) + Number(s.session.ki2)), 5)("" + s.session.pin, 8)("" + s.key, maxpsk); } this.tableFrame('C', maxessid, maxpsk, true); } if (((_ref4 = stations.inProgress) != null ? _ref4.length : void 0) >= 1) { this.tableFrame('W', maxessid, maxpsk); isfirst = true; stations.inProgress.sort(function(a, b) { if (a.attempts < b.attempts) { return 1; } else { return -1; } }); _ref5 = stations.inProgress; for (_k = 0, _len2 = _ref5.length; _k < _len2; _k++) { s = _ref5[_k]; s.tableIndex = indexed.length + 1; indexed.push(s); if (isfirst) { isfirst = false; } else { this.tableFrame('W', maxessid, maxpsk, false, true); } perc = Math.round(Number(s.attempts / 110)); beginrow('blue', s); this.tableCell('blue', 'reset', "" + s.attempts, 5)("" + ((new Array(Math.round(perc / 10) + 1)).join('█')) + " " + perc + "%", 13)((_ref6 = s.session.pin) != null ? _ref6 : ' ', 4); } this.tableFrame('W', maxessid, maxpsk, true); } if (((_ref7 = stations.noHistory) != null ? _ref7.length : void 0) >= 1) { this.tableFrame('N', maxessid, maxpsk); isfirst = true; stations.noHistory.sort(function(a, b) { if (a.rssi > b.rssi) { return 1; } else { return -1; } }); _ref8 = stations.noHistory; for (_l = 0, _len3 = _ref8.length; _l < _len3; _l++) { s = _ref8[_l]; s.tableIndex = indexed.length + 1; indexed.push(s); if (isfirst) { isfirst = false; } else { this.tableFrame('N', maxessid, maxpsk, false, true); } beginrow(5, s); } this.tableFrame('N', maxessid, maxpsk, true); } return indexed; }; exports.washHit = function(station, status, isdbq) { var c, _ref; if (isdbq == null) { isdbq = false; } c = STATION_COLORS[status]; if (station.locked) { c = 'red'; } this.label(c, ' st', status); if (!isdbq || (station.rssi != null)) { this.label(c, 'rssi', station.rssi); } this.label(c, 'bssid', station.bssid); if (!isdbq) { this.label(c, 'ch', station.channel); } this.label(c, 'essid', station.essid); if (status === 'C') { this.label(c, 'pin', (_ref = station.session) != null ? _ref.pin : void 0); this.label(c, 'key', station.key); this.label(c, 'checked', Number(station.session.ki1) + Number(station.session.ki2)); } else if (status === 'W') { this.label(c, 'progress', "" + (Number(station.attempts / 110).toFixed(2)) + "%"); this.label(c, 'phase', station.session.phase); this.label(c, 'checks', Number(station.session.ki1) + Number(station.session.ki2)); if (station.attempts > 10000 || station.session.phase === 1) { this.label(c, 'pin', "" + station.session.pin); } } if (station.device != null) { this.label(c, 'device', station.device.name); this.label(c, 'manuf.', station.device.manufacturer); this.label(c, 'model', "" + station.device.model + "/" + station.device.number); } if (station.locked) { this.label(c, '!', 'LOCKED'); } charm.write('\n'); return this; }; exports.attackProgress = function(atkq) { var a, r, _ref, _ref1; a = (_ref = atkq.active) != null ? _ref : false; r = (_ref1 = atkq.reaver) != null ? _ref1 : false; if (a && r) { charm.push(); cdwrite('bright', 'blue', "\n //" + a.essid); cdwrite('reset', 250, ' | '); this.label('magenta', 'rxok', r.status.foundBeacon); this.label('blue', 'assoc', r.status.associated); this.label('magenta', 'ch', r.status.channel); if (r.status.locked) { cdwrite('bright', 'red', '¡LOCKED!'); } cdwrite('reset', 250, ' | '); this.label('blue', 'phase', r.status.phase); this.label('magenta', 'pin', r.status.pin); cdwrite('reset', 250, ' | '); this.label('blue', 'msdepth', r.metrics.maxSeqDepth); this.label('magenta', 'checked', r.metrics.totalChecked); this.label('blue', 'failed', r.metrics.totalFailures); this.label('magenta', 'inarow', r.metrics.consecutiveFailures); return charm.pop(); } }; exports.label = function(fg, ltext, rtext) { charm.display('reset').foreground(fg).write("" + ltext + "/"); charm.display('bright').foreground(fg).write("" + rtext + " ").display('reset'); return this; }; exports.labels = function(color, keys, obj) { var key, _i, _len, _results; _results = []; for (_i = 0, _len = keys.length; _i < _len; _i++) { key = keys[_i]; _results.push(this.label(color, key, obj[key])); } return _results; }; exports.cwrite = function() { var args; args = 1 <= arguments.length ? __slice.call(arguments, 0) : []; cwrite.apply(null, args); return this; }; exports.cdwrite = function() { var args; args = 1 <= arguments.length ? __slice.call(arguments, 0) : []; cdwrite.apply(null, args); return this; }; exports.clear = function() { charm.erase('screen'); charm.position(0, 0); return this; }; exports.write = charm.write; exports.erase = charm.erase; exports.foreground = charm.foreground; exports.background = charm.background; exports.display = charm.display; exports._c = charm; }).call(this);