Maintenance for a few modules (#42)

This commit is contained in:
WM
2018-08-27 02:32:32 +02:00
committed by Sebastian Kinne
parent 13b3c40d76
commit a5d7d19cd5
161 changed files with 16954 additions and 10056 deletions

View File

@@ -7,13 +7,13 @@ class OnlineHashCrack extends Module
public function route()
{
switch ($this->request->action) {
case 'refreshInfo':
$this->refreshInfo();
break;
case 'refreshOutput':
case 'refreshInfo':
$this->refreshInfo();
break;
case 'refreshOutput':
$this->refreshOutput();
break;
case 'clearOutput':
case 'clearOutput':
$this->clearOutput();
break;
case 'refreshStatus':
@@ -25,45 +25,45 @@ class OnlineHashCrack extends Module
case 'handleDependenciesStatus':
$this->handleDependenciesStatus();
break;
case 'submitWPAOnline':
$this->submitWPAOnline();
break;
case 'submitWPAOnlineStatus':
$this->submitWPAOnlineStatus();
break;
case 'submitHashOnline':
$this->submitHashOnline();
break;
case 'submitHashOnlineStatus':
$this->submitHashOnlineStatus();
break;
case 'getSettings':
$this->getSettings();
break;
case 'setSettings':
$this->setSettings();
break;
case 'getCapFiles':
$this->getCapFiles();
break;
case 'submitWPAOnline':
$this->submitWPAOnline();
break;
case 'submitWPAOnlineStatus':
$this->submitWPAOnlineStatus();
break;
case 'submitHashOnline':
$this->submitHashOnline();
break;
case 'submitHashOnlineStatus':
$this->submitHashOnlineStatus();
break;
case 'getSettings':
$this->getSettings();
break;
case 'setSettings':
$this->setSettings();
break;
case 'getCapFiles':
$this->getCapFiles();
break;
}
}
protected function checkDependency($dependencyName)
{
return ((exec("which {$dependencyName}") == '' ? false : true) && ($this->uciGet("onlinehashcrack.module.installed")));
}
protected function checkDependency($dependencyName)
{
return ((exec("which {$dependencyName}") == '' ? false : true) && ($this->uciGet("onlinehashcrack.module.installed")));
}
protected function getDevice()
{
return trim(exec("cat /proc/cpuinfo | grep machine | awk -F: '{print $2}'"));
}
protected function getDevice()
{
return trim(exec("cat /proc/cpuinfo | grep machine | awk -F: '{print $2}'"));
}
protected function refreshInfo()
{
$moduleInfo = @json_decode(file_get_contents("/pineapple/modules/OnlineHashCrack/module.info"));
$this->response = array('title' => $moduleInfo->title, 'version' => $moduleInfo->version);
}
protected function refreshInfo()
{
$moduleInfo = @json_decode(file_get_contents("/pineapple/modules/OnlineHashCrack/module.info"));
$this->response = array('title' => $moduleInfo->title, 'version' => $moduleInfo->version);
}
private function handleDependencies()
{
@@ -94,51 +94,51 @@ class OnlineHashCrack extends Module
private function refreshStatus()
{
if (!file_exists('/tmp/OnlineHashCrack.progress'))
{
if(!$this->checkDependency("curl"))
{
$installed = false;
$install = "Not installed";
$installLabel = "danger";
$processing = false;
}
else
{
$installed = true;
$install = "Installed";
$installLabel = "success";
$processing = false;
}
}
else
{
if(!$this->checkDependency("curl"))
{
$installed = false;
$install = "Installing...";
$installLabel = "warning";
$processing = true;
$install = "Not installed";
$installLabel = "danger";
$processing = false;
}
else
{
$installed = true;
$install = "Installed";
$installLabel = "success";
$processing = false;
}
}
else
{
$installed = false;
$install = "Installing...";
$installLabel = "warning";
$processing = true;
}
$device = $this->getDevice();
$sdAvailable = $this->isSDAvailable();
$device = $this->getDevice();
$sdAvailable = $this->isSDAvailable();
$this->response = array("device" => $device, "sdAvailable" => $sdAvailable, "installed" => $installed, "install" => $install, "installLabel" => $installLabel, "processing" => $processing);
$this->response = array("device" => $device, "sdAvailable" => $sdAvailable, "installed" => $installed, "install" => $install, "installLabel" => $installLabel, "processing" => $processing);
}
private function refreshOutput()
{
if (file_exists("/tmp/onlinehashcrack.log"))
{
$output = file_get_contents("/tmp/onlinehashcrack.log");
if(!empty($output))
$this->response = $output;
else
$this->response = " ";
}
if (file_exists("/tmp/onlinehashcrack.log"))
{
$output = file_get_contents("/tmp/onlinehashcrack.log");
if(!empty($output))
$this->response = $output;
else
{
$this->response = " ";
}
$this->response = " ";
}
else
{
$this->response = " ";
}
}
private function clearOutput()
{
@@ -147,14 +147,14 @@ class OnlineHashCrack extends Module
private function submitWPAOnlineStatus()
{
if (!file_exists('/tmp/OnlineHashCrack.progress'))
{
$this->response = array('success' => true);
}
else
{
$this->response = array('success' => false);
}
if (!file_exists('/tmp/OnlineHashCrack.progress'))
{
$this->response = array('success' => true);
}
else
{
$this->response = array('success' => false);
}
}
private function submitWPAOnline()
@@ -165,14 +165,14 @@ class OnlineHashCrack extends Module
private function submitHashOnlineStatus()
{
if (!file_exists('/tmp/OnlineHashCrack.progress'))
{
$this->response = array('success' => true);
}
else
{
$this->response = array('success' => false);
}
if (!file_exists('/tmp/OnlineHashCrack.progress'))
{
$this->response = array('success' => true);
}
else
{
$this->response = array('success' => false);
}
}
private function submitHashOnline()
@@ -191,14 +191,13 @@ class OnlineHashCrack extends Module
private function setSettings()
{
$settings = $this->request->settings;
$this->uciSet("onlinehashcrack.settings.email", $settings->email);
$settings = $this->request->settings;
$this->uciSet("onlinehashcrack.settings.email", $settings->email);
}
private function getCapFiles()
{
exec("find -L /pineapple/modules/ -type f -name \"*.**cap\" 2>&1", $filesArray);
$this->response = array("files" => $filesArray);
exec("find -L /pineapple/modules/ -type f -name \"*.**cap\" 2>&1", $filesArray);
$this->response = array("files" => $filesArray);
}
}
}