| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507 |
- registerController('PineAPPoolController', ['$api', '$scope', '$timeout', function($api, $scope, $timeout) {
- $scope.ssid = "";
- $scope.ssidPool = "";
- $scope.addedSSID = "";
- $scope.removedSSID = "";
- $scope.clearedSSIDPool = "";
- $scope.clearedSessionCounter = false;
- $scope.lengthError = "";
- $scope.poolLocation = "";
- $scope.downloadPool = (function() {
- $api.request({
- module: 'PineAP',
- action: 'downloadPineAPPool'
- }, function(response) {
- if (response.error === undefined) {
- window.location = '/api/?download=' + response.download;
- }
- });
- });
- $scope.addSSID = (function() {
- $api.request({
- module: 'PineAP',
- action: 'addSSID',
- ssid: $scope.ssid
- }, function(response) {
- if (response.error === undefined) {
- $scope.ssid = "";
- $scope.addedSSID = true;
- } else {
- $scope.lengthError = true;
- }
- $timeout(function(){
- $scope.addedSSID = false;
- $scope.lengthError = false;
- }, 2000);
- $scope.getPool();
- });
- });
- $scope.removeSSID = (function() {
- $api.request({
- module: 'PineAP',
- action: 'removeSSID',
- ssid: $scope.ssid
- }, function(response) {
- if (response.error === undefined) {
- $scope.ssid = "";
- $scope.removedSSID = true;
- } else {
- $scope.lengthError = true;
- }
- $timeout(function(){
- $scope.removedSSID = false;
- $scope.lengthError = false;
- }, 2000);
- $scope.getPool();
- });
- });
- $scope.getPoolLocation = (function() {
- $api.request({
- module: 'PineAP',
- action: 'getPoolLocation'
- }, function(response) {
- if (response.error === undefined) {
- $scope.poolLocation = response.poolLocation;
- }
- });
- });
- $scope.setPoolLocation = (function() {
- $api.request({
- module: 'PineAP',
- action: 'setPoolLocation',
- location: $scope.poolLocation
- }, function(response) {
- if (response.success === true) {
- $scope.getPoolLocation();
- $scope.getPool();
- $scope.updatedPoolLocation = true;
- $timeout(function(){
- $scope.updatedPoolLocation = false;
- }, 2000);
- }
- });
- });
- $scope.getPool = (function() {
- $api.request({
- module: 'PineAP',
- action: 'getPool'
- }, function(response) {
- $scope.ssidPool = response.ssidPool;
- });
- });
- $scope.clearPool = (function() {
- $api.request({
- module: 'PineAP',
- action: 'clearPool'
- }, function(response) {
- if (response.success === true) {
- $scope.ssidPool = "";
- $scope.clearedSSIDPool = true;
- $timeout(function(){
- $scope.clearedSSIDPool = false;
- }, 2000);
- }
- });
- $scope.getPool();
- });
- $scope.clearSessionCounter = (function() {
- $api.request({
- module: 'PineAP',
- action: 'clearSessionCounter'
- }, function(response) {
- if (response.success === true) {
- $scope.clearedSessionCounter = true;
- $timeout(function() {
- $scope.clearedSessionCounter = false;
- }, 2000);
- }
- })
- });
- $scope.getSSIDLineNumber = function() {
- var textarea = $('#ssidPool');
- var lineNumber = textarea.val().substr(0, textarea[0].selectionStart).split("\n").length;
- var ssid = textarea.val().split("\n")[lineNumber-1].trim();
- $("input[name='ssid']").val(ssid).trigger('input');
- };
- $scope.getPool();
- $scope.getPoolLocation();
- }]);
- registerController('PineAPSettingsController', ['$api', '$scope', function($api, $scope) {
- $scope.disableButton = false;
- $scope.saveAlert = false;
- $scope.pineAPenabling = false;
- $scope.settings = {
- allowAssociations: false,
- logEvents: false,
- pineAPDaemon: false,
- autostartPineAP: false,
- beaconResponses: false,
- captureSSIDs: false,
- broadcastSSIDs: false,
- connectNotifications: false,
- disconnectNotifications: false,
- broadcastInterval: 'NORMAL',
- responseInterval: 'NORMAL',
- sourceMAC: '00:00:00:00:00:00',
- targetMAC: 'FF:FF:FF:FF:FF:FF',
- interface: 'wlan1mon'
- };
- $scope.interfaces = [];
- $scope.togglePineAP = (function() {
- $scope.pineAPenabling = true;
- var actionString = $scope.settings.pineAPDaemon ? "disable" : "enable";
- $api.request({
- module: 'PineAP',
- action: actionString
- }, function(response) {
- if (response.error === undefined) {
- $scope.pineAPenabling = false;
- $scope.getSettings();
- }
- });
- });
- $scope.toggleAutoStart = (function() {
- var actionString = $scope.settings.autostartPineAP ? "disableAutoStart" : "enableAutoStart";
- $api.request({
- module: 'PineAP',
- action: actionString
- }, function(response) {
- if (response.error === undefined) {
- $scope.getSettings();
- }
- });
- });
- $scope.getSettings = function() {
- $api.request({
- module: 'PineAP',
- action: 'getPineAPSettings'
- }, function(response) {
- if (response.success === true) {
- $scope.settings = response.settings;
- }
- });
- };
- $scope.updateSettings = function() {
- $scope.disableButton = true;
- $api.request({
- module: 'PineAP',
- action: 'setPineAPSettings',
- settings: $scope.settings
- }, function() {
- $scope.getSettings();
- $scope.disableButton = false;
- });
- };
- $scope.getSettings();
- }]);
- registerController("PineAPEnterpriseController", ['$api', '$scope', '$timeout', '$interval', function($api, $scope, $timeout, $interval) {
- $scope.settings = {
- enabled: false,
- enableAssociations: false,
- ssid: "",
- mac: "",
- encryptionType: "wpa2+ccmp"
- };
- $scope.certificateSettings = {
- state: "California",
- country: "US",
- locality: "San Francisco",
- organization: "YOUR ORG",
- email: "bounce@example.com",
- commonname: "YOUR CERTIFICATE AUTHORITY"
- };
- $scope.loadingView = true;
- $scope.generatingCertificate = false;
- $scope.generateSuccess = false;
- $scope.savingSettings = false;
- $scope.savedSettings = false;
- $scope.certInstalled = false;
- $scope.data = [];
- $scope.error = '';
- $scope.view = '';
- $scope.detectCertificate = function() {
- $api.request({
- module: 'PineAP',
- action: 'detectEnterpriseCertificate'
- }, function(response) {
- if (response.installed === true) {
- $scope.generatingCertificate = false;
- $interval.cancel($scope.certInterval);
- $scope.view = 'normal';
- } else {
- $scope.view = 'certs';
- }
- $scope.loadingView = false;
- });
- };
- $scope.clearCertificate = function() {
- $scope.view = '';
- $scope.loadingView = true;
- $api.request({
- module: 'PineAP',
- action: 'clearEnterpriseCertificate'
- }, function() {
- $scope.view = 'certs';
- $scope.loadingView = false;
- });
- };
- $scope.clearDB = function() {
- $api.request({
- module: 'PineAP',
- action: 'clearEnterpriseDB'
- }, function() {
- $scope.getData();
- });
- };
- $scope.downloadJTR = function() {
- $api.request({
- module: 'PineAP',
- action: 'downloadJTRHashes'
- }, function(response) {
- if (response.error === undefined) {
- window.location = '/api/?download=' + response.download;
- }
- });
- };
- $scope.downloadHashcat = function() {
- $api.request({
- module: 'PineAP',
- action: 'downloadHashcatHashes'
- }, function(response) {
- if (response.error === undefined) {
- window.location = '/api/?download=' + response.download;
- }
- });
- };
- $scope.generateCertificate = function() {
- $scope.error = '';
- $scope.generatingCertificate = true;
- $scope.certInterval = $interval(function() {
- $scope.detectCertificate();
- }, 10000);
- $api.request({
- module: 'PineAP',
- action: 'generateEnterpriseCertificate',
- certSettings: $scope.certificateSettings
- }, function(response) {
- if (response.success) {
- } else {
- $scope.generatingCertificate = false;
- $scope.error = response.error;
- $timeout(function() {
- $scope.error = '';
- }, 5000);
- $interval.cancel($scope.certInterval);
- }
- });
- };
- $scope.getSettings = function() {
- $api.request({
- module: 'PineAP',
- action: 'getEnterpriseSettings'
- }, function(response) {
- if (response.error === undefined) {
- $scope.settings = response.settings;
- } else {
- $scope.error = response.error;
- }
- });
- };
- $scope.saveSettings = function() {
- $scope.error = '';
- $scope.savingSettings = true;
- $api.request({
- module: 'PineAP',
- action: 'setEnterpriseSettings',
- settings: $scope.settings
- }, function(response) {
- if (response.success) {
- $scope.savingSettings = false;
- $scope.savedSettings = true;
- $timeout(function(){
- $scope.savedSettings = false;
- }, 2000);
- } else {
- $scope.savingSettings = false;
- $scope.error = response.error;
- $timeout(function() {
- $scope.error = '';
- }, 5000);
- }
- });
- };
- $scope.dataInterval = $interval(function() {
- if ($scope.view === 'normal') {
- $scope.getData();
- }
- }, 5000);
- $scope.getData = function() {
- $api.request({
- module: 'PineAP',
- action: 'getEnterpriseData'
- }, function(response) {
- $scope.chalrespdata = response.chalrespdata;
- $scope.basicdata = response.basicdata;
- });
- };
- $scope.detectCertificate();
- $scope.getSettings();
- $scope.getData();
- $scope.$on('$destroy', function() {
- $interval.cancel($scope.certInterval);
- $interval.cancel($scope.dataInterval);
- });
- }]);
- registerController("CapturedHandshakesController", ['$api', '$scope', '$timeout', function($api, $scope, $timeout) {
- $scope.handshakes = [];
- $scope.clearedAllHandshakes = false;
- $scope.deletedHandshake = false;
- $scope.getAllHandshakes = function() {
- $api.request({
- module: 'PineAP',
- action: 'getAllHandshakes'
- }, function(response) {
- $scope.handshakes = response.handshakes;
- });
- };
- $scope.downloadAllHandshakes = function() {
- $api.request({
- module: 'PineAP',
- action: 'downloadAllHandshakes'
- }, function(response) {
- if (response.error === undefined) {
- window.location = '/api/?download=' + response.download;
- }
- });
- };
- $scope.clearAllHandshakes = function() {
- $api.request({
- module: 'PineAP',
- action: 'clearAllHandshakes'
- }, function(response) {
- if (response.success) {
- $scope.getAllHandshakes();
- $scope.clearedAllHandshakes = true;
- $timeout(function() {
- $scope.clearedAllHandshakes = false;
- }, 2000);
- }
- });
- };
- $scope.downloadHandshake = function(bssid) {
- $api.request({
- module: 'PineAP',
- action: 'downloadHandshake',
- bssid: bssid,
- type: 'pcap'
- }, function(response) {
- if(response.error === undefined) {
- window.location = '/api/?download=' + response.download;
- }
- });
- };
- $scope.deleteHandshake = function(bssid) {
- $api.request({
- module: 'PineAP',
- action: 'deleteHandshake',
- bssid: bssid
- }, function(response) {
- if (response.success) {
- $scope.getAllHandshakes();
- $scope.deletedHandshake = true;
- $timeout(function() {
- $scope.deletedHandshake = false;
- }, 2000);
- }
- })
- };
- $scope.getAllHandshakes();
- }]);
- registerController("PinejectorController", ['$api', '$scope', function($api, $scope){
- $scope.injecting = false;
- $scope.payload = "";
- $scope.channel = 1;
- $scope.frameCount = 0;
- $scope.delay = 100;
- $scope.channels = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12];
- $scope.interval = null;
- $scope.error = null;
- $scope.command = null;
- $scope.exitCode = null;
- $scope.stdout = null;
- $scope.stderr = null;
- $scope.showDetails = false;
- $scope.toggleDetails = function() {
- $scope.showDetails = !$scope.showDetails;
- };
- $scope.injectFrames = function() {
- $scope.injecting = true;
- $api.request({
- module: 'PineAP',
- action: 'inject',
- payload: $scope.payload,
- channel: $scope.channel,
- frameCount: $scope.frameCount,
- delay: $scope.delay
- }, function(resp) {
- $scope.injecting = false;
- $scope.error = resp.error;
- $scope.command = resp.command;
- $scope.exitCode = resp.exitCode;
- $scope.stdout = resp.stdout;
- $scope.stderr = resp.stderr;
- });
- };
- $scope.fixPayload = function() {
- return $scope.payload.replace(/[\\x\-:\t ]/g, '');
- };
- $scope.checkPayload = function() {
- var hexStream = $scope.fixPayload();
- return hexStream.search(/[^a-fA-F0-9]/) === -1 && (hexStream.length % 2) === 0 && hexStream.length > 0;
- };
- $scope.checkRadiotap = function() {
- return $scope.payload.startsWith('0000');
- };
- }]);
|