Add modules to repository

This commit is contained in:
Sebastian Kinne
2017-11-16 16:42:22 +11:00
commit d0aa1e38ef
707 changed files with 96750 additions and 0 deletions

View File

@@ -0,0 +1,77 @@
<?php namespace pineapple;
class ConnectedClients extends Module
{
public function route()
{
switch ($this->request->action) {
case 'getVersionInfo':
$this->getVersionInfo();
break;
case 'getDHCPLeases':
$this->getDHCPLeases();
break;
case 'getBlacklist':
$this->getBlacklist();
break;
case 'getConnectedClients':
$this->getConnectedClients();
break;
case 'removeMacAddress':
$this->removeMacAddress();
break;
case 'addMacAddress':
$this->addMacAddress();
break;
case 'disassociateMac':
$this->disassociateMac();
break;
case 'deauthenticateMac':
$this->deauthenticateMac();
break;
}
}
protected function getVersionInfo() {
$moduleInfo = @json_decode(file_get_contents("/pineapple/modules/ConnectedClients/module.info"));
$this->response = array('title' => $moduleInfo->title, 'version' => $moduleInfo->version);
}
private function getDHCPLeases() {
exec("cat /tmp/dhcp.leases", $dhcpleases);
$this->response = array('dhcpleases' => $dhcpleases);
}
private function getBlacklist() {
exec("pineapple karma list_macs", $mac_list);
$this->response = array('blacklist' => $mac_list);
}
private function getConnectedClients() {
exec("iw dev wlan0 station dump | grep Station | awk '{print $2}'", $wlan0clients);
exec("iw dev wlan0-1 station dump | grep Station | awk '{print $2}'", $wlan01clients);
exec("iw dev wlan1 station dump | grep Station | awk '{print $2}'", $wlan1clients);
$this->response = array('wlan0clients' => $wlan0clients, 'wlan01clients' => $wlan01clients, 'wlan1clients' => $wlan1clients);
}
private function removeMacAddress() {
exec('pineapple karma del_mac "'.$this->request->macAddress.'"', $removeMacResponse);
$this->response = array('removeMacResponse' => $removeMacResponse);
}
private function addMacAddress() {
exec('pineapple karma add_mac "'.$this->request->macAddress.'"', $addMacResponse);
$this->response = array('addMacResponse' => $addMacResponse);
}
private function disassociateMac() {
exec('hostapd_cli disassociate "'.$this->request->macAddress.'"', $disassociateResponse);
$this->response = array('disassociateResponse' => $disassociateResponse);
}
private function deauthenticateMac() {
exec('hostapd_cli deauthenticate "'.$this->request->macAddress.'"', $deauthenticateResponse);
$this->response = array('deauthSuccess' => 'Successful', 'deauthenticateResponse' => $deauthenticateResponse);
}
}

View File

@@ -0,0 +1,112 @@
registerController('ConnectedClientsController', ['$api', '$scope', function($api, $scope) {
$scope.title = "Loading...";
$scope.version = "Loading...";
$scope.clientslength = 0;
$scope.wlan0clients = [];
$scope.wlan01clients = [];
$scope.wlan1clients = [];
$scope.dhcplength = 0;
$scope.dhcpleases = [];
$scope.blacklistlength = 0;
$scope.blacklist = [];
// this function gets info from the module.info file
$scope.getVersionInfo = (function() {
$api.request({
module: 'ConnectedClients',
action: 'getVersionInfo'
}, function(response) {
$scope.title = response.title;
$scope.version = response.version;
});
});
// this function gets the connected clients information and fills in the panel
$scope.getConnectedClients = (function() {
$api.request({
module: 'ConnectedClients',
action: 'getConnectedClients'
}, function(response) {
$scope.clientslength = response.wlan0clients.length + response.wlan01clients.length + response.wlan1clients.length;
$scope.wlan0clients = response.wlan0clients;
$scope.wlan01clients = response.wlan01clients;
$scope.wlan1clients = response.wlan1clients;
});
});
// this function adds a mac address to the blacklist
$scope.addMacAddress = (function(macAddress) {
$api.request({
module: 'ConnectedClients',
action: 'addMacAddress',
macAddress: macAddress
}, function(response) {
$scope.getBlacklist();
});
});
// this function gets the DHCP leases from the file system and fills in the panel
$scope.getDHCPLeases = (function() {
$api.request({
module: 'ConnectedClients',
action: 'getDHCPLeases'
}, function(response) {
$scope.dhcplength = response.dhcpleases.length;
$dhcp = response.dhcpleases;
for (var i = $scope.dhcplength - 1; i >= 0; i--) {
$dhcp[i] = $dhcp[i].split(' ');
}
$scope.dhcpleases = $dhcp;
});
});
// this function removes a MAC address from the blacklist
$scope.removeMacAddress = (function(macAddress) {
$api.request({
module: 'ConnectedClients',
action: 'removeMacAddress',
macAddress: macAddress
}, function(response) {
$scope.getBlacklist();
});
});
// this function retrieves the blacklist and fills it in on the panel
$scope.getBlacklist = (function() {
$api.request({
module: 'ConnectedClients',
action: 'getBlacklist'
}, function(response) {
$scope.blacklistlength = response.blacklist.length;
$scope.blacklist = response.blacklist;
});
});
// this function disassociates a MAC address
$scope.disassociateMac = (function(macAddress) {
$api.request({
module: 'ConnectedClients',
action: 'disassociateMac',
macAddress: macAddress
}, function(response) {
$scope.getConnectedClients();
});
});
// this function deauthenticates a MAC address
$scope.deauthenticateMac = (function(macAddress) {
$api.request({
module: 'ConnectedClients',
action: 'deauthenticateMac',
macAddress: macAddress
}, function(response) {
$scope.getConnectedClients();
});
});
// initialize the panels
$scope.getVersionInfo();
$scope.getBlacklist();
$scope.getConnectedClients();
$scope.getDHCPLeases();
}]);

View File

@@ -0,0 +1,59 @@
<div ng-controller="ConnectedClientsController">
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title pull-left">{{title}}</h4>
<span class="pull-right">v{{version}}</span>
<div class="clearfix"></div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading pointer" data-toggle="collapse" data-target="#ClientsContainer">
<h4 class="panel-title pull-left">Connected Clients</h4>
<span class="pull-right">Count: {{ clientslength }}</span>
<div class="clearfix"></div>
</div>
<div id="ClientsContainer" class="panel-collapse collapse in">
<h3 class="text-center">wlan0</h3>
<table class="table table-striped table-bordered text-center">
<tr><th class="text-center">Mac Address</th><th class="text-center">Disassociate</th><th class="text-center">Deauthenticate</th><th class="text-center">Blacklist</th></tr>
<tr ng-repeat="wlan0 in wlan0clients"><td>{{ wlan0 }}</td><td><button type="button" class="btn btn-danger" ng-click="disassociateMac(wlan0)">Disassociate</button></td><td><button type="button" class="btn btn-danger" ng-click="deauthenticateMac(wlan0)">Deauthenticate</button></td><td><button type="button" class="btn btn-danger" ng-click="addMacAddress(wlan0)">Blacklist</button></td></tr>
</table>
<h3 class="text-center">wlan0-1</h3>
<table class="table table-striped table-bordered text-center">
<tr><th class="text-center">Mac Address</th><th class="text-center">Disassociate</th><th class="text-center">Deauthenticate</th><th class="text-center">Blacklist</th></tr>
<tr ng-repeat="wlan01 in wlan01clients"><td>{{ wlan01 }}</td><td><button type="button" class="btn btn-danger" ng-click="disassociateMac(wlan01)">Disassociate</button></td><td><button type="button" class="btn btn-danger" ng-click="deauthenticateMac(wlan01)">Deauthenticate</button></td><td><button type="button" class="btn btn-danger" ng-click="addMacAddress(wlan01)">Blacklist</button></td></tr>
</table>
<h3 class="text-center">wlan1</h3>
<table class="table table-striped table-bordered text-center">
<tr><th class="text-center">Mac Address</th><th class="text-center">Disassociate</th><th class="text-center">Deauthenticate</th><th class="text-center">Blacklist</th></tr>
<tr ng-repeat="wlan1 in wlan1clients"><td>{{ wlan1 }}</td><td><button type="button" class="btn btn-danger" ng-click="disassociateMac(wlan1)">Disassociate</button></td><td><button type="button" class="btn btn-danger" ng-click="deauthenticateMac(wlan1)">Deauthenticate</button></td><td><button type="button" class="btn btn-danger" ng-click="addMacAddress(wlan1)">Blacklist</button></td></tr>
</table>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading pointer" data-toggle="collapse" data-target="#DHCPContainer">
<h4 class="panel-title pull-left">DHCP Leases</h4>
<span class="pull-right">Count: {{ dhcplength }}</span>
<div class="clearfix"></div>
</div>
<div id="DHCPContainer" class="panel-collapse collapse in">
<table class="table table-striped table-bordered text-center">
<tr><th class="text-center">Hostname</th><th class="text-center">IP Address</th><th class="text-center">MAC Address</th><th class="text-center">Blacklist</th></tr>
<tr ng-repeat="dhcplease in dhcpleases"><td>{{ dhcplease[3] }}</td><td>{{ dhcplease[2] }}</td><td>{{ dhcplease[1] }}</td><td><button type="button" class="btn btn-danger" ng-click="addMacAddress(dhcplease[1])">Blacklist</button></td></tr>
</table>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading pointer" data-toggle="collapse" data-target="#BlacklistContainer">
<h4 class="panel-title pull-left">Blacklist</h4>
<span class="pull-right">Count: {{ blacklistlength }}</span>
<div class="clearfix"></div>
</div>
<div id="BlacklistContainer" class="panel-collapse collapse in">
<table class="table table-striped table-bordered text-center">
<tr><th class="text-center">MAC Address</th><th class="text-center">Remove</th></tr>
<tr ng-repeat="mac in blacklist track by $index"><td>{{ mac }}</td><td><button type="button" class="btn btn-danger" ng-click="removeMacAddress(mac)">Remove</button></td></tr>
</table>
</div>
</div>
</div>

View File

@@ -0,0 +1,10 @@
{
"author": "r3dfish",
"description": "Connected Clients is an infusion for the Wifi Pineapple that gives information about connected clients",
"devices": [
"nano",
"tetra"
],
"title": "ConnectedClients",
"version": "1.4"
}