ajout heimdall
This commit is contained in:
76
heimdall/config/www/SupportedApps/Nessus/Nessus.php
Executable file
76
heimdall/config/www/SupportedApps/Nessus/Nessus.php
Executable file
@@ -0,0 +1,76 @@
|
||||
<?php namespace App\SupportedApps\Nessus;
|
||||
|
||||
class Nessus extends \App\SupportedApps implements \App\EnhancedApps {
|
||||
|
||||
public $config;
|
||||
private $clientVars = [
|
||||
'http_errors' => false,
|
||||
'timeout' => 15,
|
||||
'connect_timeout' => 15,
|
||||
'verify' => false,
|
||||
];
|
||||
|
||||
function __construct() {
|
||||
}
|
||||
|
||||
private function acquireToken()
|
||||
{
|
||||
$username = $this->config->username;
|
||||
$password = $this->config->password;
|
||||
$attrs = [
|
||||
'body' => json_encode(array('username' => $username, 'password' => $password)),
|
||||
'headers' => ['content-type' => 'application/json']
|
||||
];
|
||||
$res = parent::execute($this->url('session'), $attrs, $this->clientVars, 'POST');
|
||||
switch ($res->getStatusCode()) {
|
||||
case 200:
|
||||
$details = json_decode($res->getBody());
|
||||
return $details->token;
|
||||
case 400:
|
||||
throw new \Exception("Invalid username format");
|
||||
case 401:
|
||||
throw new \Exception("Invalid username/password");
|
||||
}
|
||||
|
||||
throw new \Exception("Error connecting to Nessus");
|
||||
}
|
||||
|
||||
public function test()
|
||||
{
|
||||
try {
|
||||
$this->acquireToken();
|
||||
} catch (\Throwable $e) {
|
||||
echo $e->getMessage();
|
||||
return;
|
||||
}
|
||||
echo 'Successfully communicated with the API';
|
||||
}
|
||||
|
||||
public function livestats()
|
||||
{
|
||||
$token = $this->acquireToken();
|
||||
$status = 'inactive';
|
||||
$attrs = [
|
||||
'headers' => ['X-Cookie' => 'token='.$token]
|
||||
];
|
||||
$res = parent::execute($this->url('scans'), $attrs, $this->clientVars);
|
||||
$details = json_decode($res->getBody());
|
||||
$data = [];
|
||||
if ($details && !isset($details->error)) {
|
||||
foreach ($details->scans as $scan) {
|
||||
if ($scan->status == "running") {
|
||||
$data['scanner'] = $scan->name;
|
||||
$status = 'active';
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return parent::getLiveStats($status, $data);
|
||||
|
||||
}
|
||||
public function url($endpoint)
|
||||
{
|
||||
$api_url = parent::normaliseurl($this->config->url).$endpoint;
|
||||
return $api_url;
|
||||
}
|
||||
}
|
||||
10
heimdall/config/www/SupportedApps/Nessus/app.json
Executable file
10
heimdall/config/www/SupportedApps/Nessus/app.json
Executable file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"appid": "c47466c999c3113a3291ab09cab20b0df630d8e8",
|
||||
"name": "Nessus",
|
||||
"website": "https://www.tenable.com/products/nessus",
|
||||
"license": "Commercial",
|
||||
"description": "Nessus is trusted by more than 27,000 organizations worldwide as one of the most widely deployed security technologies on the planet - and the gold standard for vulnerability assessment.",
|
||||
"enhanced": true,
|
||||
"tile_background": "light",
|
||||
"icon": "nessus.png"
|
||||
}
|
||||
19
heimdall/config/www/SupportedApps/Nessus/config.blade.php
Executable file
19
heimdall/config/www/SupportedApps/Nessus/config.blade.php
Executable file
@@ -0,0 +1,19 @@
|
||||
<h2>{{ __('app.apps.config') }} ({{ __('app.optional') }}) @include('items.enable')</h2>
|
||||
<div class="items">
|
||||
<div class="input">
|
||||
<label>{{ strtoupper(__('app.url')) }}</label>
|
||||
{!! Form::text('config[override_url]', (isset($item) && isset($item->getconfig()->override_url) ? $item->getconfig()->override_url : null), array('placeholder' => __('app.apps.override'), 'id' => 'override_url', 'class' => 'form-control')) !!}
|
||||
</div>
|
||||
<div class="input">
|
||||
<label>{{ __('app.apps.username') }}</label>
|
||||
{!! Form::text('config[username]', (isset($item) && isset($item->getconfig()->username) ? $item->getconfig()->username : null), array('placeholder' => __('app.apps.username'), 'data-config' => 'username', 'class' => 'form-control config-item')) !!}
|
||||
</div>
|
||||
<div class="input">
|
||||
<label>{{ __('app.apps.password') }}</label>
|
||||
{!! Form::text('config[password]', (isset($item) && isset($item->getconfig()->password) ? $item->getconfig()->password : null), array('placeholder' => __('app.apps.password'), 'data-config' => 'password', 'class' => 'form-control config-item')) !!}
|
||||
</div>
|
||||
<div class="input">
|
||||
<button style="margin-top: 32px;" class="btn test" id="test_config">Test</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
6
heimdall/config/www/SupportedApps/Nessus/livestats.blade.php
Executable file
6
heimdall/config/www/SupportedApps/Nessus/livestats.blade.php
Executable file
@@ -0,0 +1,6 @@
|
||||
<ul class="livestats">
|
||||
<li>
|
||||
<span class="title">Active scan</span>
|
||||
<span><strong>{!! $scanner !!}</strong></span>
|
||||
</li>
|
||||
</ul>
|
||||
BIN
heimdall/config/www/SupportedApps/Nessus/nessus.png
Executable file
BIN
heimdall/config/www/SupportedApps/Nessus/nessus.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 2.5 KiB |
Reference in New Issue
Block a user