|
|
@@ -2,6 +2,8 @@
|
|
|
|
|
|
class PineAPHelper
|
|
|
{
|
|
|
+ CONST CLI_PINEAPD = "/usr/sbin/pineapd";
|
|
|
+
|
|
|
public function getSetting($settingKey)
|
|
|
{
|
|
|
$configFile = file_get_contents("/tmp/pineap.conf");
|
|
|
@@ -52,7 +54,7 @@ class PineAPHelper
|
|
|
|
|
|
public function enableAssociations()
|
|
|
{
|
|
|
- if (\helper\checkRunning("/usr/sbin/pineapd")) {
|
|
|
+ if (\helper\checkRunning(CLI_PINEAPD)) {
|
|
|
exec("pineap /tmp/pineap.conf karma on");
|
|
|
} else {
|
|
|
$this->setSetting("karma", "on");
|
|
|
@@ -63,7 +65,7 @@ class PineAPHelper
|
|
|
|
|
|
public function disableAssociations()
|
|
|
{
|
|
|
- if (\helper\checkRunning("/usr/sbin/pineapd")) {
|
|
|
+ if (\helper\checkRunning(CLI_PINEAPD)) {
|
|
|
exec("pineap /tmp/pineap.conf karma off");
|
|
|
} else {
|
|
|
$this->setSetting("karma", "off");
|
|
|
@@ -115,7 +117,7 @@ class PineAPHelper
|
|
|
|
|
|
public function disableBeaconer()
|
|
|
{
|
|
|
- if (\helper\checkRunning("/usr/sbin/pineapd")) {
|
|
|
+ if (\helper\checkRunning(CLI_PINEAPD)) {
|
|
|
exec('pineap /tmp/pineap.conf broadcast_pool off');
|
|
|
} else {
|
|
|
$this->setSetting("broadcast_ssid_pool", "off");
|
|
|
@@ -125,7 +127,7 @@ class PineAPHelper
|
|
|
|
|
|
public function enableResponder()
|
|
|
{
|
|
|
- if (\helper\checkRunning("/usr/sbin/pineapd")) {
|
|
|
+ if (\helper\checkRunning(CLI_PINEAPD)) {
|
|
|
exec('pineap /tmp/pineap.conf beacon_responses on');
|
|
|
} else {
|
|
|
$this->setSetting("beacon_responses", "on");
|
|
|
@@ -135,7 +137,7 @@ class PineAPHelper
|
|
|
|
|
|
public function disableResponder()
|
|
|
{
|
|
|
- if (\helper\checkRunning("/usr/sbin/pineapd")) {
|
|
|
+ if (\helper\checkRunning(CLI_PINEAPD)) {
|
|
|
exec('pineap /tmp/pineap.conf beacon_responses off');
|
|
|
} else {
|
|
|
$this->setSetting("beacon_responses", "off");
|
|
|
@@ -145,7 +147,7 @@ class PineAPHelper
|
|
|
|
|
|
public function enableHarvester()
|
|
|
{
|
|
|
- if (\helper\checkRunning("/usr/sbin/pineapd")) {
|
|
|
+ if (\helper\checkRunning(CLI_PINEAPD)) {
|
|
|
exec('pineap /tmp/pineap.conf capture_ssids on');
|
|
|
} else {
|
|
|
$this->setSetting("capture_ssids", "on");
|
|
|
@@ -155,7 +157,7 @@ class PineAPHelper
|
|
|
|
|
|
public function disableHarvester()
|
|
|
{
|
|
|
- if (\helper\checkRunning("/usr/sbin/pineapd")) {
|
|
|
+ if (\helper\checkRunning(CLI_PINEAPD)) {
|
|
|
exec('pineap /tmp/pineap.conf capture_ssids off');
|
|
|
} else {
|
|
|
$this->setSetting("capture_ssids", "off");
|
|
|
@@ -165,7 +167,7 @@ class PineAPHelper
|
|
|
|
|
|
public function enableConnectNotifications()
|
|
|
{
|
|
|
- if (\helper\checkRunning("/usr/sbin/pineapd")) {
|
|
|
+ if (\helper\checkRunning(CLI_PINEAPD)) {
|
|
|
exec('pineap /tmp/pineap.conf connect_notifications on');
|
|
|
} else {
|
|
|
$this->setSetting("connect_notifications", "on");
|
|
|
@@ -175,7 +177,7 @@ class PineAPHelper
|
|
|
|
|
|
public function disableConnectNotifications()
|
|
|
{
|
|
|
- if (\helper\checkRunning("/usr/sbin/pineapd")) {
|
|
|
+ if (\helper\checkRunning(CLI_PINEAPD)) {
|
|
|
exec('pineap /tmp/pineap.conf connect_notifications off');
|
|
|
} else {
|
|
|
$this->setSetting("connect_notifications", "off");
|
|
|
@@ -185,7 +187,7 @@ class PineAPHelper
|
|
|
|
|
|
public function enableDisconnectNotifications()
|
|
|
{
|
|
|
- if (\helper\checkRunning("/usr/sbin/pineapd")) {
|
|
|
+ if (\helper\checkRunning(CLI_PINEAPD)) {
|
|
|
exec('pineap /tmp/pineap.conf disconnect_notifications on');
|
|
|
} else {
|
|
|
$this->setSetting("disconnect_notifications", "on");
|
|
|
@@ -195,7 +197,7 @@ class PineAPHelper
|
|
|
|
|
|
public function disableDisconnectNotifications()
|
|
|
{
|
|
|
- if (\helper\checkRunning("/usr/sbin/pineapd")) {
|
|
|
+ if (\helper\checkRunning(CLI_PINEAPD)) {
|
|
|
exec('pineap /tmp/pineap.conf disconnect_notifications off');
|
|
|
} else {
|
|
|
$this->setSetting("disconnect_notifications", "off");
|
|
|
@@ -215,7 +217,7 @@ class PineAPHelper
|
|
|
|
|
|
public function setBeaconInterval($interval)
|
|
|
{
|
|
|
- if (\helper\checkRunning("/usr/sbin/pineapd")) {
|
|
|
+ if (\helper\checkRunning(CLI_PINEAPD)) {
|
|
|
$interval = escapeshellarg($interval);
|
|
|
exec("pineap /tmp/pineap.conf beacon_interval {$interval}");
|
|
|
} else {
|
|
|
@@ -227,7 +229,7 @@ class PineAPHelper
|
|
|
|
|
|
public function setResponseInterval($interval)
|
|
|
{
|
|
|
- if (\helper\checkRunning("/usr/sbin/pineapd")) {
|
|
|
+ if (\helper\checkRunning(CLI_PINEAPD)) {
|
|
|
$interval = escapeshellarg($interval);
|
|
|
exec("pineap /tmp/pineap.conf beacon_response_interval {$interval}");
|
|
|
} else {
|
|
|
@@ -239,7 +241,7 @@ class PineAPHelper
|
|
|
|
|
|
public function setSource($mac)
|
|
|
{
|
|
|
- if (\helper\checkRunning("/usr/sbin/pineapd")) {
|
|
|
+ if (\helper\checkRunning(CLI_PINEAPD)) {
|
|
|
$mac = escapeshellarg($mac);
|
|
|
exec("pineap /tmp/pineap.conf set_source {$mac}");
|
|
|
} else {
|
|
|
@@ -251,7 +253,7 @@ class PineAPHelper
|
|
|
|
|
|
public function setTarget($mac)
|
|
|
{
|
|
|
- if (\helper\checkRunning("/usr/sbin/pineapd")) {
|
|
|
+ if (\helper\checkRunning(CLI_PINEAPD)) {
|
|
|
$mac = escapeshellarg($mac);
|
|
|
exec("pineap /tmp/pineap.conf set_target {$mac}");
|
|
|
} else {
|
|
|
@@ -274,6 +276,10 @@ class PineAPHelper
|
|
|
|
|
|
public function setPineapInterface($interface)
|
|
|
{
|
|
|
+ if (\helper\checkRunning(CLI_PINEAPD)) {
|
|
|
+ $this->disablePineAP();
|
|
|
+ }
|
|
|
+
|
|
|
$this->setSetting("pineap_interface", "{$interface}");
|
|
|
return true;
|
|
|
}
|