Updates to nmap and urlsnarf (#79)

* nmap: Check internal space available to avoid confusion with large depends.

* arpspoof: fix accidental recursion.
pull/83/head
Marc 2019-10-02 18:33:32 +01:00 committed by GitHub
parent e85ef10b35
commit dd7a5d3ab2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 337 additions and 244 deletions

View File

@ -142,7 +142,10 @@ class nmap extends Module
$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);
// 2143000 is the installed size of nmap.
$internalAvailable = (disk_free_space("/") - 64000) > 2143000;
$this->response = array("device" => $device, "internalAvailable" => $internalAvailable, "sdAvailable" => $sdAvailable, "status" => $status, "statusLabel" => $statusLabel, "installed" => $installed, "install" => $install, "installLabel" => $installLabel, "processing" => $processing);
}
private function refreshOutput()

View File

@ -27,6 +27,7 @@ registerController('nmap_ControlsController', ['$api', '$scope', '$rootScope', '
$scope.device = '';
$scope.sdAvailable = false;
$scope.internalAvailable = false;
$rootScope.status = {
installed: false,
@ -45,6 +46,7 @@ registerController('nmap_ControlsController', ['$api', '$scope', '$rootScope', '
$rootScope.status.installed = response.installed;
$scope.device = response.device;
$scope.sdAvailable = response.sdAvailable;
$scope.internalAvailable = response.internalAvailable;
if (response.processing) $scope.processing = true;
$scope.install = response.install;
$scope.installLabel = response.installLabel;

View File

@ -1,4 +1,9 @@
<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="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">
@ -10,49 +15,82 @@
<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>
<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>
<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 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">&times;</span></button>
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
aria-hidden="true">&times;</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.
Please wait, do not leave or refresh this page. Once the install is complete, this page will
refresh automatically.<br/><br/>
<span ng-show="sdAvailable == false && internalAvailable == false">
There is not enough internal storage available to install the nmap dependencies.
Please insert an correctly formatted SD card.
</span>
</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>
<button type="button" class="btn btn-info" ng-hide="internalAvailable == false"
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 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">&times;</span></button>
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
aria-hidden="true">&times;</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.
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>
<button type="button" class="btn btn-info" ng-click="handleDependencies()"
data-dismiss="modal">Confirm
</button>
</div>
</div>
</div>
@ -79,7 +117,8 @@
<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">
<input ng-change="update()" type="text" class="form-control input-sm" ng-model="target"
placeholder="Target">
</div>
</div>
@ -97,7 +136,9 @@
<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>
<option value="-sS -sU -T4 -A -v -PE -PP -PS80,443 -PA3389 -PU40125 -PY -g 53">Slow
comprehensive scan
</option>
</select>
</div>
</div>
@ -156,11 +197,22 @@
<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 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>
@ -173,10 +225,21 @@
<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 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>
@ -189,7 +252,9 @@
<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 class="checkbox"><label><input type="checkbox" ng-change="update()"
ng-model="targetOptions.option1"
ng-true-value="'-F'"> Fast scan</label></div>
</div>
</div>
</div>
@ -202,10 +267,22 @@
<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 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>
@ -220,7 +297,8 @@
<div class="panel-heading">
<h4 class="panel-title pull-left">Output</h4>
<div class="pull-right">
Auto-refresh <div class="btn-group">
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>
@ -228,7 +306,8 @@
<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>
<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>
@ -239,7 +318,8 @@
</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>
<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>
@ -253,9 +333,16 @@
<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>
<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>
@ -270,7 +357,8 @@
<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">&times;</span></button>
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="historyModalLabel">View History - {{historyDate}}</h4>
</div>
<div class="modal-body">

View File

@ -6,5 +6,5 @@
"tetra"
],
"title": "nmap",
"version": "1.8"
"version": "1.9"
}

View File

@ -49,7 +49,7 @@ class urlsnarf extends Module
}
}
protected function checkDependency($dependencyName)
protected function checkDep($dependencyName)
{
return ($this->checkDependency($dependencyName) && ($this->uciGet("urlsnarf.module.installed")));
}
@ -67,7 +67,7 @@ class urlsnarf extends Module
private function handleDependencies()
{
if (!$this->checkDependency("urlsnarf")) {
if (!$this->checkDep("urlsnarf")) {
$this->execBackground("/pineapple/modules/urlsnarf/scripts/dependencies.sh install ".$this->request->destination);
$this->response = array('success' => true);
} else {
@ -119,7 +119,7 @@ class urlsnarf extends Module
private function refreshStatus()
{
if (!file_exists('/tmp/urlsnarf.progress')) {
if (!$this->checkDependency("urlsnarf")) {
if (!$this->checkDep("urlsnarf")) {
$installed = false;
$install = "Not installed";
$installLabel = "danger";
@ -173,7 +173,7 @@ class urlsnarf extends Module
private function refreshOutput()
{
if ($this->checkDependency("urlsnarf")) {
if ($this->checkDep("urlsnarf")) {
if ($this->checkRunning("urlsnarf")) {
$path = "/pineapple/modules/urlsnarf/log";

View File

@ -6,5 +6,5 @@
"tetra"
],
"title": "urlsnarf",
"version": "1.7"
"version": "1.8"
}