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:
229
nmap/api/module.php
Normal file
229
nmap/api/module.php
Normal file
@@ -0,0 +1,229 @@
|
||||
<?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 nmap 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 'togglenmap':
|
||||
$this->togglenmap();
|
||||
break;
|
||||
case 'scanStatus':
|
||||
$this->scanStatus();
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
protected function checkDependency($dependencyName)
|
||||
{
|
||||
return ((exec("which {$dependencyName}") == '' ? false : true) && ($this->uciGet("nmap.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/nmap/module.info"));
|
||||
$this->response = array('title' => $moduleInfo->title, 'version' => $moduleInfo->version);
|
||||
}
|
||||
|
||||
private function handleDependencies()
|
||||
{
|
||||
if(!$this->checkDependency("nmap"))
|
||||
{
|
||||
$this->execBackground("/pineapple/modules/nmap/scripts/dependencies.sh install ".$this->request->destination);
|
||||
$this->response = array('success' => true);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->execBackground("/pineapple/modules/nmap/scripts/dependencies.sh remove");
|
||||
$this->response = array('success' => true);
|
||||
}
|
||||
}
|
||||
|
||||
private function handleDependenciesStatus()
|
||||
{
|
||||
if (!file_exists('/tmp/nmap.progress'))
|
||||
{
|
||||
$this->response = array('success' => true);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->response = array('success' => false);
|
||||
}
|
||||
}
|
||||
|
||||
private function scanStatus()
|
||||
{
|
||||
if (!$this->checkRunning("nmap"))
|
||||
{
|
||||
$this->response = array('success' => true);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->response = array('success' => false);
|
||||
}
|
||||
}
|
||||
|
||||
private function togglenmap()
|
||||
{
|
||||
if(!$this->checkRunning("nmap"))
|
||||
{
|
||||
$full_cmd = $this->request->command . " -oN /tmp/nmap.scan 2>&1";
|
||||
shell_exec("echo -e \"{$full_cmd}\" > /tmp/nmap.run");
|
||||
|
||||
$this->execBackground("/pineapple/modules/nmap/scripts/nmap.sh start");
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->execBackground("/pineapple/modules/nmap/scripts/nmap.sh stop");
|
||||
}
|
||||
}
|
||||
|
||||
private function refreshStatus()
|
||||
{
|
||||
if (!file_exists('/tmp/nmap.progress'))
|
||||
{
|
||||
if (!$this->checkDependency("nmap"))
|
||||
{
|
||||
$installed = false;
|
||||
$install = "Not installed";
|
||||
$installLabel = "danger";
|
||||
$processing = false;
|
||||
|
||||
$status = "Start";
|
||||
$statusLabel = "success";
|
||||
}
|
||||
else
|
||||
{
|
||||
$installed = true;
|
||||
$install = "Installed";
|
||||
$installLabel = "success";
|
||||
$processing = false;
|
||||
|
||||
if ($this->checkRunning("nmap"))
|
||||
{
|
||||
$status = "Stop";
|
||||
$statusLabel = "danger";
|
||||
}
|
||||
else
|
||||
{
|
||||
$status = "Start";
|
||||
$statusLabel = "success";
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$installed = false;
|
||||
$install = "Installing...";
|
||||
$installLabel = "warning";
|
||||
$processing = true;
|
||||
|
||||
$status = "Start";
|
||||
$statusLabel = "success";
|
||||
}
|
||||
|
||||
$device = $this->getDevice();
|
||||
$sdAvailable = $this->isSDAvailable();
|
||||
|
||||
$this->response = array("device" => $device, "sdAvailable" => $sdAvailable, "status" => $status, "statusLabel" => $statusLabel, "installed" => $installed, "install" => $install, "installLabel" => $installLabel, "processing" => $processing);
|
||||
}
|
||||
|
||||
private function refreshOutput()
|
||||
{
|
||||
if ($this->checkDependency("nmap"))
|
||||
{
|
||||
if ($this->checkRunning("nmap") && file_exists("/tmp/nmap.scan"))
|
||||
{
|
||||
$output = file_get_contents("/tmp/nmap.scan");
|
||||
if(!empty($output))
|
||||
$this->response = $output;
|
||||
else
|
||||
$this->response = "Empty log...";
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->response = "nmap is not running...";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->response = "nmap is not installed...";
|
||||
}
|
||||
}
|
||||
|
||||
private function refreshHistory()
|
||||
{
|
||||
$this->streamFunction = function () {
|
||||
$log_list = array_reverse(glob("/pineapple/modules/nmap/scan/*"));
|
||||
|
||||
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/nmap/scan/".$this->request->file));
|
||||
exec ("cat /pineapple/modules/nmap/scan/".$this->request->file, $output);
|
||||
|
||||
if(!empty($output))
|
||||
$this->response = array("output" => implode("\n", $output), "date" => $log_date);
|
||||
else
|
||||
$this->response = array("output" => "Empty scan...", "date" => $log_date);
|
||||
}
|
||||
|
||||
private function deleteHistory()
|
||||
{
|
||||
exec("rm -rf /pineapple/modules/nmap/scan/".$this->request->file);
|
||||
}
|
||||
|
||||
private function downloadHistory()
|
||||
{
|
||||
$this->response = array("download" => $this->downloadFile("/pineapple/modules/nmap/scan/".$this->request->file));
|
||||
}
|
||||
|
||||
}
|
||||
344
nmap/js/module.js
Normal file
344
nmap/js/module.js
Normal file
@@ -0,0 +1,344 @@
|
||||
registerController('nmap_Controller', ['$api', '$scope', '$rootScope', '$interval', '$timeout', function($api, $scope, $rootScope, $interval, $timeout) {
|
||||
$scope.title = "Loading...";
|
||||
$scope.version = "Loading...";
|
||||
|
||||
$scope.refreshInfo = (function() {
|
||||
$api.request({
|
||||
module: 'nmap',
|
||||
action: "refreshInfo"
|
||||
}, function(response) {
|
||||
$scope.title = response.title;
|
||||
$scope.version = "v"+response.version;
|
||||
})
|
||||
});
|
||||
|
||||
$scope.refreshInfo();
|
||||
|
||||
}]);
|
||||
|
||||
registerController('nmap_ControlsController', ['$api', '$scope', '$rootScope', '$interval', '$timeout', function($api, $scope, $rootScope, $interval, $timeout) {
|
||||
$scope.status = "Loading...";
|
||||
$scope.statusLabel = "default";
|
||||
$scope.starting = false;
|
||||
|
||||
$scope.install = "Loading...";
|
||||
$scope.installLabel = "default";
|
||||
$scope.processing = false;
|
||||
|
||||
$scope.device = '';
|
||||
$scope.sdAvailable = false;
|
||||
|
||||
$rootScope.status = {
|
||||
installed : false,
|
||||
refreshOutput : false,
|
||||
refreshHistory : false
|
||||
};
|
||||
|
||||
$scope.refreshStatus = (function() {
|
||||
$api.request({
|
||||
module: "nmap",
|
||||
action: "refreshStatus"
|
||||
}, function(response) {
|
||||
$scope.status = response.status;
|
||||
$scope.statusLabel = response.statusLabel;
|
||||
|
||||
$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;
|
||||
})
|
||||
});
|
||||
|
||||
$scope.togglenmap = (function() {
|
||||
if($scope.status != "Stop")
|
||||
$scope.status = "Starting...";
|
||||
else
|
||||
$scope.status = "Stopping...";
|
||||
|
||||
$scope.statusLabel = "warning";
|
||||
$scope.starting = true;
|
||||
|
||||
$api.request({
|
||||
module: 'nmap',
|
||||
action: 'togglenmap',
|
||||
command: $rootScope.command
|
||||
}, function(response) {
|
||||
$timeout(function(){
|
||||
$rootScope.status.refreshOutput = true;
|
||||
$rootScope.status.refreshHistory = false;
|
||||
|
||||
$scope.starting = false;
|
||||
$scope.refreshStatus();
|
||||
|
||||
$scope.scanInterval = $interval(function(){
|
||||
$api.request({
|
||||
module: 'nmap',
|
||||
action: 'scanStatus'
|
||||
}, function(response) {
|
||||
if (response.success === true){
|
||||
$interval.cancel($scope.scanInterval);
|
||||
$rootScope.status.refreshOutput = false;
|
||||
$rootScope.status.refreshHistory = true;
|
||||
}
|
||||
$scope.refreshStatus();
|
||||
});
|
||||
}, 5000);
|
||||
|
||||
}, 2000);
|
||||
})
|
||||
});
|
||||
|
||||
$scope.handleDependencies = (function(param) {
|
||||
if(!$rootScope.status.installed)
|
||||
$scope.install = "Installing...";
|
||||
else
|
||||
$scope.install = "Removing...";
|
||||
|
||||
$api.request({
|
||||
module: 'nmap',
|
||||
action: 'handleDependencies',
|
||||
destination: param
|
||||
}, function(response){
|
||||
if (response.success === true) {
|
||||
$scope.installLabel = "warning";
|
||||
$scope.processing = true;
|
||||
|
||||
$scope.handleDependenciesInterval = $interval(function(){
|
||||
$api.request({
|
||||
module: 'nmap',
|
||||
action: 'handleDependenciesStatus'
|
||||
}, function(response) {
|
||||
if (response.success === true){
|
||||
$scope.processing = false;
|
||||
$interval.cancel($scope.handleDependenciesInterval);
|
||||
$scope.refreshStatus();
|
||||
}
|
||||
});
|
||||
}, 5000);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$scope.refreshStatus();
|
||||
}]);
|
||||
|
||||
registerController('nmap_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: "nmap",
|
||||
action: "refreshOutput"
|
||||
}, function(response) {
|
||||
$scope.output = response;
|
||||
})
|
||||
});
|
||||
|
||||
$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('nmap_HistoryController', ['$api', '$scope', '$rootScope', function($api, $scope, $rootScope) {
|
||||
$scope.history = [];
|
||||
$scope.historyOutput = 'Loading...';
|
||||
$scope.historyDate = 'Loading...';
|
||||
|
||||
$scope.refreshHistory = (function() {
|
||||
$api.request({
|
||||
module: "nmap",
|
||||
action: "refreshHistory"
|
||||
}, function(response) {
|
||||
$scope.history = response;
|
||||
})
|
||||
});
|
||||
|
||||
$scope.viewHistory = (function(param) {
|
||||
$api.request({
|
||||
module: "nmap",
|
||||
action: "viewHistory",
|
||||
file: param
|
||||
}, function(response) {
|
||||
$scope.historyOutput = response.output;
|
||||
$scope.historyDate = response.date;
|
||||
})
|
||||
});
|
||||
|
||||
$scope.deleteHistory = (function(param) {
|
||||
$api.request({
|
||||
module: "nmap",
|
||||
action: "deleteHistory",
|
||||
file: param
|
||||
}, function(response) {
|
||||
$scope.refreshHistory();
|
||||
})
|
||||
});
|
||||
|
||||
$scope.downloadHistory = (function(param) {
|
||||
$api.request({
|
||||
module: 'nmap',
|
||||
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('nmap_OptionsController', ['$api', '$scope', '$rootScope', function($api, $scope, $rootScope) {
|
||||
$scope.command = "nmap ";
|
||||
$scope.target = "";
|
||||
|
||||
$scope.profile = "--";
|
||||
$scope.timing = "--";
|
||||
$scope.tcp = "--";
|
||||
$scope.nontcp = "--";
|
||||
|
||||
$scope.scanOptions = {
|
||||
option1 : false,
|
||||
option2 : false,
|
||||
option3 : false,
|
||||
option4 : false,
|
||||
option5 : false
|
||||
};
|
||||
|
||||
$scope.pingOptions = {
|
||||
option1 : false,
|
||||
option2 : false,
|
||||
option3 : false,
|
||||
option4 : false
|
||||
};
|
||||
|
||||
$scope.targetOptions = {
|
||||
option1 : false
|
||||
};
|
||||
|
||||
$scope.otherOptions = {
|
||||
option1 : false,
|
||||
option2 : false,
|
||||
option3 : false,
|
||||
option4 : false
|
||||
};
|
||||
|
||||
$rootScope.command = $scope.command;
|
||||
|
||||
$scope.update = (function(param) {
|
||||
if(updateProfile() != "")
|
||||
$scope.command = "nmap " + updateProfile() + updateTarget();
|
||||
else
|
||||
$scope.command = "nmap " + updateTiming() + updateTcp() + updateNontcp() + updateOptions() + updateTarget();
|
||||
|
||||
$rootScope.command = $scope.command;
|
||||
});
|
||||
|
||||
function updateOptions() {
|
||||
var return_value = "";
|
||||
|
||||
angular.forEach($scope.scanOptions, function(value, key) {
|
||||
if(value != false)
|
||||
return_value += value + " ";
|
||||
});
|
||||
|
||||
angular.forEach($scope.pingOptions, function(value, key) {
|
||||
if(value != false)
|
||||
return_value += value + " ";
|
||||
});
|
||||
|
||||
angular.forEach($scope.targetOptions, function(value, key) {
|
||||
if(value != false)
|
||||
return_value += value + " ";
|
||||
});
|
||||
|
||||
angular.forEach($scope.otherOptions, function(value, key) {
|
||||
if(value != false)
|
||||
return_value += value + " ";
|
||||
});
|
||||
|
||||
return return_value;
|
||||
}
|
||||
|
||||
function updateTarget() {
|
||||
var return_value = "";
|
||||
|
||||
return_value = $scope.target;
|
||||
|
||||
return return_value;
|
||||
}
|
||||
|
||||
function updateProfile() {
|
||||
var return_value = "";
|
||||
|
||||
if($scope.profile != "--")
|
||||
return_value = $scope.profile + " ";
|
||||
|
||||
return return_value;
|
||||
}
|
||||
|
||||
function updateTiming() {
|
||||
var return_value = "";
|
||||
|
||||
if($scope.timing != "--")
|
||||
return_value = $scope.timing + " ";
|
||||
|
||||
return return_value;
|
||||
}
|
||||
|
||||
function updateTcp() {
|
||||
var return_value = "";
|
||||
|
||||
if($scope.tcp != "--")
|
||||
return_value = $scope.tcp + " ";
|
||||
|
||||
return return_value;
|
||||
}
|
||||
|
||||
function updateNontcp() {
|
||||
var return_value = "";
|
||||
|
||||
if($scope.nontcp != "--")
|
||||
return_value = $scope.nontcp + " ";
|
||||
|
||||
return return_value;
|
||||
}
|
||||
}]);
|
||||
286
nmap/module.html
Normal file
286
nmap/module.html
Normal file
@@ -0,0 +1,286 @@
|
||||
<div class="panel panel-default" ng-controller="nmap_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="nmap_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">nmap</td>
|
||||
<td style="text-align:right;padding-bottom: .5em;"><button type="button" style="width: 90px;" class="btn btn-{{statusLabel}} btn-xs" ng-disabled="starting || $root.command == 'nmap '" ng-click="togglenmap()">{{status}}</button></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 class="panel panel-default" ng-show="$root.status.installed" ng-controller="nmap_OptionsController">
|
||||
<div class="panel-heading pointer" data-toggle="collapse" data-target="#Options">
|
||||
<h4 class="panel-title">Options</h4>
|
||||
</div>
|
||||
<div id="Options" class="panel-collapse collapse">
|
||||
<div class="panel-body">
|
||||
|
||||
<div class="form-group">
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon input-sm">Command</span>
|
||||
<input type="text" class="form-control input-sm" ng-model="command" placeholder="nmap command">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon input-sm">Target</span>
|
||||
<input ng-change="update()" type="text" class="form-control input-sm" ng-model="target" placeholder="Target">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon input-sm">Profile</span>
|
||||
<select ng-change="update()" ng-model="profile" class="form-control input-sm">
|
||||
<option>--</option>
|
||||
<option value="">Regular scan</option>
|
||||
<option value="-T4 -A -v">Intense scan</option>
|
||||
<option value="-sS -sU -T4 -A -v">Intense scan plus UDP</option>
|
||||
<option value="-p 1-65535 -T4 -A -v">Intense scan, all TCP ports</option>
|
||||
<option value="-T4 -A -v -Pn">Intense scan, no ping</option>
|
||||
<option value="-sn">Ping scan</option>
|
||||
<option value="-T4 -F">Quick scan</option>
|
||||
<option value="-sV -T4 -O -F --version-light">Quick scan plus</option>
|
||||
<option value="-sn --traceroute">Quick traceroute</option>
|
||||
<option value="-sS -sU -T4 -A -v -PE -PP -PS80,443 -PA3389 -PU40125 -PY -g 53">Slow comprehensive scan</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div ng-show="profile=='--'" class="panel panel-default">
|
||||
<div class="panel-heading pointer" data-toggle="collapse" data-target="#Scan">Scan</div>
|
||||
<div id="Scan" class="panel-collapse collapse">
|
||||
<div class="panel-body">
|
||||
|
||||
<div class="form-group">
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon input-sm">Timing</span>
|
||||
<select ng-change="update()" ng-model="timing" class="form-control input-sm">
|
||||
<option>--</option>
|
||||
<option value="-T0">Paranoid</option>
|
||||
<option value="-T1">Sneaky</option>
|
||||
<option value="-T2">Polite</option>
|
||||
<option value="-T3">Normal</option>
|
||||
<option value="-T4">Aggresive</option>
|
||||
<option value="-T5">Insane</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon input-sm">TCP scan</span>
|
||||
<select ng-change="update()" ng-model="tcp" class="form-control input-sm">
|
||||
<option>--</option>
|
||||
<option value="-sA">ACK scan</option>
|
||||
<option value="-sF">FIN scan</option>
|
||||
<option value="-sM">Maimon scan</option>
|
||||
<option value="-sN">Null scan</option>
|
||||
<option value="-sS">TCP SYN scan</option>
|
||||
<option value="-sT">TCP connect scan</option>
|
||||
<option value="-sW">Window scan</option>
|
||||
<option value="-sX">Xmas Tree scan</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon input-sm">Non-TCP scan</span>
|
||||
<select ng-change="update()" ng-model="nontcp" class="form-control input-sm">
|
||||
<option>--</option>
|
||||
<option value="-sU">UDP scan</option>
|
||||
<option value="-sO">IP protocol scan</option>
|
||||
<option value="-sL">List scan</option>
|
||||
<option value="-sn">No port scan</option>
|
||||
<option value="-sY">SCTP INIT port scan</option>
|
||||
<option value="-sZ">SCTP cookie-echo port scan</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<div class="input-group">
|
||||
<div class="checkbox"><label><input type="checkbox" ng-change="update()" ng-model="scanOptions.option1" ng-true-value="'-A'"> Enable all advanced/aggressive options</label></div>
|
||||
<div class="checkbox"><label><input type="checkbox" ng-change="update()" ng-model="scanOptions.option2" ng-true-value="'-O'"> OS detection</label></div>
|
||||
<div class="checkbox"><label><input type="checkbox" ng-change="update()" ng-model="scanOptions.option3" ng-true-value="'-sV'"> Version detection</label></div>
|
||||
<div class="checkbox"><label><input type="checkbox" ng-change="update()" ng-model="scanOptions.option4" ng-true-value="'-n'"> Disable reverse DNS resolution</label></div>
|
||||
<div class="checkbox"><label><input type="checkbox" ng-change="update()" ng-model="scanOptions.option5" ng-true-value="'-6'"> IPv6 support</label></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div ng-show="profile=='--'" class="panel panel-default">
|
||||
<div class="panel-heading pointer" data-toggle="collapse" data-target="#Ping">Ping</div>
|
||||
<div id="Ping" class="panel-collapse collapse">
|
||||
<div class="panel-body">
|
||||
<div class="form-group">
|
||||
<div class="input-group">
|
||||
<div class="checkbox"><label><input type="checkbox" ng-change="update()" ng-model="pingOptions.option1" ng-true-value="'-Pn'"> No ping before scanning</label></div>
|
||||
<div class="checkbox"><label><input type="checkbox" ng-change="update()" ng-model="pingOptions.option2" ng-true-value="'-PE'"> ICMP ping</label></div>
|
||||
<div class="checkbox"><label><input type="checkbox" ng-change="update()" ng-model="pingOptions.option3" ng-true-value="'-PP'"> ICMP timestamp request</label></div>
|
||||
<div class="checkbox"><label><input type="checkbox" ng-change="update()" ng-model="pingOptions.option4" ng-true-value="'-PM'"> ICMP netmask request</label></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div ng-show="profile=='--'" class="panel panel-default">
|
||||
<div class="panel-heading pointer" data-toggle="collapse" data-target="#Target">Target</div>
|
||||
<div id="Target" class="panel-collapse collapse">
|
||||
<div class="panel-body">
|
||||
<div class="form-group">
|
||||
<div class="input-group">
|
||||
<div class="checkbox"><label><input type="checkbox" ng-change="update()" ng-model="targetOptions.option1" ng-true-value="'-F'"> Fast scan</label></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div ng-show="profile=='--'" class="panel panel-default">
|
||||
<div class="panel-heading pointer" data-toggle="collapse" data-target="#Other">Other</div>
|
||||
<div id="Other" class="panel-collapse collapse">
|
||||
<div class="panel-body">
|
||||
<div class="form-group">
|
||||
<div class="input-group">
|
||||
<div class="checkbox"><label><input type="checkbox" ng-change="update()" ng-model="otherOptions.option1" ng-true-value="'-f'"> Fragment IP packets</label></div>
|
||||
<div class="checkbox"><label><input type="checkbox" ng-change="update()" ng-model="otherOptions.option2" ng-true-value="'--packet-trace'"> Packet trace</label></div>
|
||||
<div class="checkbox"><label><input type="checkbox" ng-change="update()" ng-model="otherOptions.option3" ng-true-value="'-r'"> Disable randomizing scanned ports</label></div>
|
||||
<div class="checkbox"><label><input type="checkbox" ng-change="update()" ng-model="otherOptions.option4" ng-true-value="'--traceroute'"> Trace routes to targets</label></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="panel panel-default" ng-show="$root.status.installed" ng-controller="nmap_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">
|
||||
<button class="btn btn-primary btn-sm pull-right" ng-click="refreshOutput()">Refresh Scan</button><div class="clearfix"></div>
|
||||
<pre class="scrollable-pre log-pre">{{output}}</pre>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="panel panel-default" ng-show="$root.status.installed" ng-controller="nmap_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
nmap/module.info
Normal file
10
nmap/module.info
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"author": "Whistle Master",
|
||||
"description": "GUI for security scanner nmap",
|
||||
"devices": [
|
||||
"nano",
|
||||
"tetra"
|
||||
],
|
||||
"title": "nmap",
|
||||
"version": "1.4"
|
||||
}
|
||||
33
nmap/scripts/dependencies.sh
Executable file
33
nmap/scripts/dependencies.sh
Executable file
@@ -0,0 +1,33 @@
|
||||
#!/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/nmap.progress ]] && {
|
||||
exit 0
|
||||
}
|
||||
|
||||
touch /tmp/nmap.progress
|
||||
|
||||
if [ "$1" = "install" ]; then
|
||||
if [ "$2" = "internal" ]; then
|
||||
opkg update
|
||||
opkg install nmap
|
||||
elif [ "$2" = "sd" ]; then
|
||||
opkg update
|
||||
opkg install nmap --dest sd
|
||||
fi
|
||||
|
||||
touch /etc/config/nmap
|
||||
echo "config nmap 'module'" > /etc/config/nmap
|
||||
|
||||
uci set nmap.module.installed=1
|
||||
uci commit nmap.module.installed
|
||||
|
||||
elif [ "$1" = "remove" ]; then
|
||||
opkg remove nmap
|
||||
rm -rf /etc/config/nmap
|
||||
fi
|
||||
|
||||
rm /tmp/nmap.progress
|
||||
18
nmap/scripts/nmap.sh
Executable file
18
nmap/scripts/nmap.sh
Executable file
@@ -0,0 +1,18 @@
|
||||
#!/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`
|
||||
MYCMD=`cat /tmp/nmap.run`
|
||||
|
||||
if [ "$1" = "start" ]; then
|
||||
eval ${MYCMD}
|
||||
mv /tmp/nmap.scan /pineapple/modules/nmap/scan/scan_${MYTIME}
|
||||
rm -rf /tmp/nmap.run
|
||||
elif [ "$1" = "stop" ]; then
|
||||
killall nmap
|
||||
rm -rf /tmp/nmap.run
|
||||
rm -rf /tmp/nmap.scan
|
||||
fi
|
||||
Reference in New Issue
Block a user