Compare commits

...

20 Commits

Author SHA1 Message Date
b445d08ce1 outch 2025-01-27 18:47:38 +01:00
e2c1c6604e WIP 2025-01-24 17:38:33 +01:00
a593148c38 add --defeat-rst-ratelimit 2024-12-04 16:26:58 +01:00
d45b05941f putain de point virgule 2024-11-26 15:18:01 +01:00
e423273752 save if name only 2024-11-26 15:15:12 +01:00
0c72ceb620 system 2024-11-25 18:02:54 +01:00
dc8fa57c0f fix ' in message 2024-11-25 15:17:12 +01:00
53679e2098 fixed navbar 2024-11-25 11:25:40 +01:00
8cd0ba066f rrr 2024-10-23 19:39:19 +02:00
602c1fc7f3 rename script-arg-file 2024-10-23 19:39:00 +02:00
06eb33187b ignore script-args-file.ini 2024-10-23 19:19:28 +02:00
43d2df7850 script-args-file.ini 2024-10-23 19:18:59 +02:00
9d7f526080 use shortport.http 2024-10-23 19:10:56 +02:00
80dc329353 https 2024-10-23 19:02:13 +02:00
81652e25c9 ignore password 2024-10-23 15:48:28 +02:00
4e14da1860 script-arg-file.ini 2024-10-23 15:46:59 +02:00
8e5f010da0 rename saveAs to name 2024-10-23 15:17:03 +02:00
df4648e12a f*cking css 2024-10-23 14:02:05 +02:00
154d731e55 use service template 2024-10-22 23:24:08 +02:00
2ef0421078 unfixed menu 2024-10-22 17:57:11 +02:00
20 changed files with 215 additions and 235 deletions

5
.gitignore vendored
View File

@ -1,4 +1,3 @@
scans/
datadir/smb-authentication.ini
test.php
server.php
datadir/script-args.ini
test.php

View File

@ -1,29 +1,31 @@
<?php
$port = (($_SERVER['REQUEST_SCHEME'] == "http" && $_SERVER['SERVER_PORT'] == 80) || ($_SERVER['REQUEST_SCHEME'] == "https" && $_SERVER['SERVER_PORT'] == 443)) ? "" : ":{$_SERVER['SERVER_PORT']}";
$BASEDIR = "{$_SERVER['REQUEST_SCHEME']}://{$_SERVER['SERVER_NAME']}$port" . dirname($_SERVER['SCRIPT_NAME']);
$SCANSDIR = 'scans';
$NMAPDIR = dirname(`which nmap`) . "/../share/nmap";
$DATADIR = "datadir";
$port = (($_SERVER['REQUEST_SCHEME'] == "http" && $_SERVER['SERVER_PORT'] == 80) || ($_SERVER['REQUEST_SCHEME'] == "https" && $_SERVER['SERVER_PORT'] == 443)) ? "" : ":{$_SERVER['SERVER_PORT']}";
$BASEDIR = "{$_SERVER['REQUEST_SCHEME']}://{$_SERVER['SERVER_NAME']}$port" . dirname($_SERVER['SCRIPT_NAME']);
$SCANSDIR = 'scans';
$TEMPLATESDIR = "templates";
$NMAP = 'sudo nmap'; # nmap command, E.g. 'nmap', 'sudo nmap' for root privileges or '/usr/bin/nmap' if not in PATH
$NMAPDIR = dirname(`which nmap`) . "/../share/nmap";
$DATADIR = ".";
$SCRIPTARGS = "script-args.ini";
$presets = [
"default" => [
'-PS' => 'microsoft-ds',
'-F' => true,
'-T' => 5,
'--stylesheet' => "$BASEDIR/templates/lanScan.xsl",
'--stylesheet' => "lanScan",
'refreshPeriod' => 60,
'sudo' => false,
#'sudo' => false,
],
"host" => [
'-Pn' => true,
'-F' => true,
'-sV' => true,
'-T' => 5,
'--script' => "http-info,smb-shares-size",
'--script-args-file' => "smb-authentication.ini",
'--stylesheet' => "$BASEDIR/templates/hostScan.xsl",
'refreshPeriod' => 60,
'sudo' => true,
'-Pn' => true,
'-F' => true,
'-sV' => true,
'-T' => 5,
'--script' => "http-info,smb-shares-size",
'--stylesheet' => "hostScan",
'refreshPeriod' => 60,
#'sudo' => true,
],
];

View File

@ -1,3 +0,0 @@
smbdomain = auth.ad.e2.rie.gouv.fr
smbuser = application.drieat
smbpassword = d+iFiWn4!cAzdr3KopiM>EA

View File

@ -10,7 +10,7 @@ $tempoRegex = '/^\d+[smh]?$/';
$fileNameRegex = '/^[^<>:\/|?]+$/';
$targets = filter_input(INPUT_GET, 'targets', FILTER_VALIDATE_REGEXP, ['options' => ['regexp' => $targetsListRegex], "flags" => FILTER_NULL_ON_FAILURE]);
$preset = filter_input(INPUT_GET, "preset");
$preset = filter_input(INPUT_GET, "preset", FILTER_SANITIZE_STRING);
if ($preset && isset($presets[$preset])) {
$options = $presets[$preset];
@ -107,9 +107,9 @@ if ($preset && isset($presets[$preset])) {
'-V' => FILTER_VALIDATE_BOOLEAN,
'--unprivileged' => FILTER_VALIDATE_BOOLEAN,
'-h' => FILTER_VALIDATE_BOOLEAN,
'--stylesheet' => FILTER_VALIDATE_URL,
'--stylesheet' => ['filter' => FILTER_VALIDATE_REGEXP, 'options' => ['regexp' => $fileNameRegex]],
// lanScan
'saveAs' => ['filter' => FILTER_VALIDATE_REGEXP, 'options' => ['regexp' => $fileNameRegex]],
'name' => ['filter' => FILTER_VALIDATE_REGEXP, 'options' => ['regexp' => $fileNameRegex]],
'originalURL' => FILTER_VALIDATE_URL,
'refreshPeriod' => ['filter' => FILTER_VALIDATE_INT, 'options' => ['min_range' => 0]],
'sudo' => FILTER_VALIDATE_BOOLEAN,
@ -117,6 +117,7 @@ if ($preset && isset($presets[$preset])) {
}
$options["--datadir"] = $DATADIR;
$options["--script-args-file"] = $SCRIPTARGS;
/*echo "<!--";
var_dump($options);

View File

@ -170,10 +170,7 @@ Exemples: <?= $_SERVER['REMOTE_ADDR']; ?>/24 <?= $_SERVER['SERVER_NAME']; ?> 10.
</div>
</div>
<div class="title">
<i class="icon dropdown"></i>
Techniques de scan de ports
</div>
<div class="title"><i class="icon dropdown"></i>Techniques de scan de ports</div>
<div class="content">
<div class="field">
<div class="fields">
@ -269,10 +266,7 @@ Exemples: <?= $_SERVER['REMOTE_ADDR']; ?>/24 <?= $_SERVER['SERVER_NAME']; ?> 10.
</div>
</div>
<div class="title">
<i class="icon dropdown"></i>
Spécifications des ports et ordre du scan
</div>
<div class="title"><i class="icon dropdown"></i>Spécifications des ports et ordre du scan</div>
<div class="content">
<div class="inline field">
<div class="ui toggle checkbox" title="-sP">
@ -569,6 +563,12 @@ Exemples: <?= $_SERVER['REMOTE_ADDR']; ?>/24 <?= $_SERVER['SERVER_NAME']; ?> 10.
value="<?= $options["--max-scan-delay"] ?? "" ?>">
</div>
</div>
<div class="inline field">
<div class="ui toggle checkbox">
<input id="defeatRSTRateLimitCheckbox" type="checkbox" name="--defeat-rst-ratelimit" <?= $options['--defeat-rst-ratelimit'] ?? false ? 'checked' : ''; ?> />
<label for="defeatRSTRateLimitCheckbox" title="--defeat-rst-ratelimit">Ignorer les limitations de paquets RST</label>
</div>
</div>
</div>
<div class="title"><i class="icon dropdown"></i>Divers</div>
@ -577,14 +577,14 @@ Exemples: <?= $_SERVER['REMOTE_ADDR']; ?>/24 <?= $_SERVER['SERVER_NAME']; ?> 10.
<label for="stylesheetSelect" title="--stylesheet">Feuille de style</label>
<select id="stylesheetSelect" class="ui dropdown" name="--stylesheet" value="<?= $options["--stylesheet"] ?? ""?>">
<?php
foreach (scandir('templates') as $filename) {
foreach (scandir($TEMPLATESDIR) as $filename) {
if (substr($filename, -4) === '.xsl') {
$name = substr($filename, 0, -4);
$URL = "$BASEDIR/templates/".rawurlencode($filename);
if (isset($options["--stylesheet"]) && $URL == $options["--stylesheet"]) {
echo " <option value='$URL' selected>$name</option>\n";
#$URL = rawurlencode($filename);
if (isset($options["--stylesheet"]) && $name == $options["--stylesheet"]) {
echo " <option value='$name' selected>$name</option>\n";
} else {
echo " <option value='$URL'>$name</option>\n";
echo " <option value='$name'>$name</option>\n";
}
}
}
@ -593,19 +593,19 @@ foreach (scandir('templates') as $filename) {
</div>
<div class="field">
<label for="originalURLSelect">Comparer avec un précédent scan</label>
<select id="originalURLSelect" class="ui clearable dropdown" name="originalURL" value="<?= $options["originalURL"] ?? "" ?>">
<label for="originalSelect">Comparer avec un précédent scan</label>
<select id="originalSelect" class="ui clearable dropdown" name="original" value="<?= $options["original"] ?? "" ?>">
<option value="">Précédent scan</option>
<?php
if (!file_exists($SCANSDIR)) mkdir($SCANSDIR);
foreach (scandir($SCANSDIR) as $filename) {
if (substr($filename, -4) === '.xml') {
$name = substr($filename, 0, -4);
$URL = "$BASEDIR/$SCANSDIR/".rawurlencode($filename);
if (isset($options["originalURL"]) && $URL == $options["originalURL"]) {
echo " <option value='$URL' selected>$name</option>\n";
#$URL = "$BASEDIR/$SCANSDIR/".rawurlencode($filename);
if (isset($options["original"]) && $name == $options["original"]) {
echo " <option value='$name' selected>$name</option>\n";
} else {
echo " <option value='$URL'>$name</option>\n";
echo " <option value='$name'>$name</option>\n";
}
}
}
@ -621,43 +621,39 @@ foreach (scandir($SCANSDIR) as $filename) {
<div class="ui label">secondes</div>
</div>
</div>
<!--
<div class="inline field">
<div class="ui toggle checkbox">
<input id="sudoCheckbox" type="checkbox" name="sudo" <?= $options["sudo"] ?? false ? 'checked' : ''; ?>/>
<label for="sudoCheckbox" title="sudo">Exécuter en tant qu'administrateur</label>
</div>
</div>
-->
</div>
</div>
<div class="field">
<label for="saveAsInput">Enregistrer sous le nom</label>
<input id="saveAsInput" type="text" name="saveAs" placeholder="Réseau local" pattern='[^&lt;&gt;:&quot;\\\/\|@?]+'
<label for="nameInput">Enregistrer sous le nom</label>
<input id="nameInput" type="text" name="name" placeholder="Réseau local" pattern='[^&lt;&gt;:&quot;\\\/\|@?]+'
title="Caractères interdits : &lt;&gt;:&quot;\/|@?"
value="<?= $options["saveAs"] ?? ""; ?>">
value="<?= $options["name"] ?? ""; ?>">
</div>
<button type="submit" class="ui teal submit button">Démarrer</button>
</form>
<h2 class="ui header">Scans enregistrés</h1>
<div class="ui large relaxed card">
<div class="content">
<div class="ui divided link list">
<?php
if (!file_exists($SCANSDIR)) {
mkdir($SCANSDIR);
}
foreach (scandir($SCANSDIR) as $filename) {
if (substr($filename, -4) == '.xml') {
$name = str_replace('!', '/', substr_replace($filename, '', -4));
echo "<a class='item' href='$SCANSDIR/".rawurlencode($filename)."'>$name</a>\n";
<h2 class="ui header">Scans enregistrés</h2>
<div class="ui link list">
<?php
if (file_exists($SCANSDIR)) {
foreach (scandir($SCANSDIR) as $filename) {
if (substr($filename, -4) == '.xml') {
$name = str_replace('!', '/', substr_replace($filename, '', -4));
echo "<a class='item' href='$SCANSDIR/".rawurlencode($filename)."'>$name</a>\n";
}
}
}
?>
</div>
</div>
</div>
</main>
@ -767,6 +763,15 @@ foreach ([$DATADIR, $NMAPDIR] as $dir) {
newScanForm.onsubmit = function(event) {
if (this.checkValidity()) {
newScanForm.classList.add("loading")
$.toast({
title : 'Scan en cours...',
message : 'Merci de patienter',
class : 'info',
showIcon : 'satellite dish',
displayTime: 0,
closeIcon : true,
position : 'bottom right',
})
return true
} else {
event.preventDefault()

View File

@ -16,7 +16,7 @@
</head>
<body>
<nav class="ui inverted teal fixed menu">
<nav class="ui inverted teal menu">
<a class="ui teal button item" href=".">
lan<?php include 'logo.svg'; ?>can
</a>

View File

@ -3,9 +3,18 @@
include_once 'config.php';
include_once 'filter_inputs.php';
if (!file_exists($SCANSDIR)) mkdir($SCANSDIR);
$options["--stylesheet"] = "$BASEDIR/$TEMPLATESDIR/${options["--stylesheet"]}.xsl#";
if (isset($options["name"])) {
$options["--stylesheet"] .= "name=" . rawurlencode($options["name"]) . "&";
}
if (isset($options["original"])) {
$options["--stylesheet"] .= "original=" . rawurlencode($options["original"]) . "&";
}
if (isset($options["refreshPeriod"])) {
$options["--stylesheet"] .= "refreshPeriod={$options["refreshPeriod"]}&";
}
$command = ($options["sudo"]?? false ? "sudo " : "") . "nmap";
$args = "";
foreach ($options as $option => $value) {
if (substr($option, 0, 1) == '-') {
if (is_null($value)) {
@ -15,47 +24,25 @@ foreach ($options as $option => $value) {
die();
} else if ($value) {
if ($value === true) {
$command .= " $option";
$args .= " $option";
} else {
if (substr($option, 0, 2) == '--') $command .= " $option " . escapeshellarg($value);
else $command .= " $option" . escapeshellarg($value);
if (substr($option, 0, 2) == '--') $args .= " $option " . escapeshellarg($value);
else $args .= " $option" . escapeshellarg($value);
}
}
}
}
$tempPath = tempnam(sys_get_temp_dir(), 'scan_').".xml";
$command .= " -oX '$tempPath' $targets 2>&1";
$command = "$NMAP $args -oX - $targets";
exec($command, $stderr, $retcode);
if ($retcode) {
http_response_code(500);
$errorMessage = implode("<br/>\n", $stderr);
include_once ".";
die();
if (isset($options["name"])) {
if (!file_exists($SCANSDIR)) mkdir($SCANSDIR);
$path = "$SCANSDIR/{$options["name"]}.xml";
$command .= " | tee '$path'";
}
$xml = new DOMDocument();
$xml->load($tempPath);
`rm "$tempPath"`;
header('Content-type: text/xml');
system($command, $retcode);
$thisURL = $options["saveAs"]?? false ? "$BASEDIR/$SCANSDIR/".rawurlencode($options["saveAs"]).".xml" : "";
$xml->insertBefore($xml->createProcessingInstruction('xslt-param', "name='thisURL' value='".htmlentities($thisURL, ENT_QUOTES)."'"), $xml->documentElement);
foreach ($options as $option => $value) {
if (substr($option, 0, 1) != '-') {
$xml->insertBefore($xml->createProcessingInstruction('xslt-param', "name='$option' value='".htmlentities($value, ENT_QUOTES)."'"), $xml->documentElement);
}
}
if ($options["saveAs"] ?? false) {
$path = "$SCANSDIR/{$options["saveAs"]}.xml";
$xml->save($path);
header("Location: $path");
exit();
} else {
header('Content-type: text/xml');
exit($xml->saveXML());
}
exit();

0
script-args.ini Normal file
View File

View File

@ -23,7 +23,7 @@ categories = {"discovery", "intrusive"}
author = "Adrien Malingrey"
license = "Same as Nmap--See https://nmap.org/book/man-legal.html"
portrule = shortport.service({"http", "https", "ssl"})
portrule = shortport.http
local http = require "http"
local stdnse = require "stdnse"
@ -32,28 +32,28 @@ action = function(host, port)
local scheme = ""
local hostaddress = (host.name ~= '' and host.name) or host.ip
local path = "/"
local uri
local favicon_relative_uri = "/favicon.ico"
local favicon
stdnse.debug1("port", port.service)
if (port.service == "ssl") then
scheme = "https"
else
scheme = port.service
end
stdnse.debug1("scheme", scheme)
if(stdnse.get_script_args('http-get.path')) then
path = stdnse.get_script_args('http-info.path')
end
uri = scheme.."://"..hostaddress..":"..port.number..path
stdnse.debug1("Try to download %s", uri)
local answer = http.get_url(uri, {})
stdnse.debug1("Try to download %s", path)
local answer = http.get(hostaddress, port, path)
local output = {status=answer.status, ["status-line"]=answer["status-line"]}
if (answer and answer.status == 200) then
stdnse.debug1("[SUCCESS] Load page %s", uri)
stdnse.debug1("[SUCCESS] Load page %s", path)
-- Taken from http-title.nse by Diman Todorov
local title = string.match(answer.body, "<[Tt][Ii][Tt][Ll][Ee][^>]*>([^<]*)</[Tt][Ii][Tt][Ll][Ee]>")
if (title) then
@ -62,17 +62,16 @@ action = function(host, port)
stdnse.debug1("[INFO] Try favicon %s", favicon_relative_uri)
favicon_relative_uri = parseIcon(answer.body) or favicon_relative_uri
else
stdnse.debug1("[ERROR] Can't load page %s", uri)
stdnse.debug1("[ERROR] Can't load page %s", path)
end
favicon_absolute_uri = scheme.."://"..hostaddress..":"..port.number..favicon_relative_uri
favicon = http.get_url(favicon_absolute_uri, {})
favicon = http.get(hostaddress, port, favicon_relative_uri)
if (favicon and favicon.status == 200) then
stdnse.debug1("[SUCCESS] Load favicon %s", favicon_absolute_uri)
output.favicon = favicon_absolute_uri
stdnse.debug1("[SUCCESS] Load favicon %s", favicon_relative_uri)
output.favicon = favicon_relative_uri
else
stdnse.debug1("[ERROR] Can't load favicon %s", favicon_absolute_uri)
stdnse.debug1("[ERROR] Can't load favicon %s", favicon_relative_uri)
end
return output

3
server.php Normal file
View File

@ -0,0 +1,3 @@
<?php
print_r($_SERVER);

View File

@ -1,75 +1,106 @@
svg {
margin: -.3em -.5em -.5em -.4em;
fill: currentColor;
:root{
--nav-height: 3.6rem;
--footer-height: 3.6rem;
}
nav {
height: var(--nav-height);
}
main {
padding-top: 7em;
min-height: calc(100vh - 4.4285em - 2px);
padding-top: var(--nav-height);
min-height: calc(100vh - var(--footer-height) - 1rem)
}
h1:first-child, h2:first-child, h3:first-child, h4:first-child, h5:first-child, .ui.header:first-child {
margin-top: 1rem;
}
svg {
margin: -0.3em -0.5em -0.5em -0.4em;
fill: currentColor;
}
.ui.footer.segment {
margin-bottom: 0;
margin-bottom: 0;
}
.tagify {
width: 100%;
border-radius: .28571429rem;
--tags-focus-border-color: #85b7d9;
--placeholder-color: rgba(191,191,191,.87);
--placeholder-color-focus: rgba(115,115,115,.87);
width: 100%;
border-radius: 0.28571429rem;
--tags-focus-border-color: #85b7d9;
--placeholder-color: rgba(191, 191, 191, 0.87);
--placeholder-color-focus: rgba(115, 115, 115, 0.87);
}
.ui.table {
caption-side: bottom;
caption-side: bottom;
}
.ui.label {
margin: .14285714em;
margin: 0.14285714em;
}
.ui.label > .detail {
margin-left: .3em;
text-transform: capitalize;
margin-left: 0.3em;
text-transform: capitalize;
}
.ui.form .fields > .field {
width: 100%;
width: 100%;
}
.ui.ui.form .field .fields .field:not(:only-child) .ui.checkbox {
margin-top: 0;
margin-top: 0;
}
.ui.dropdown.label {
min-width: auto;
min-width: auto;
}
.ui.dropdown.label> .remove.icon {
.ui.dropdown.label > .remove.icon {
right: 2.3em;
}
.toast-container .ui.header {
text-transform: capitalize;
text-transform: capitalize;
}
.share-size {
--free-ratio: calc(var(--free) / var(--total));
--used-percent: calc(100% - 100%*var(--free-ratio));
--color: hsl(calc(120*var(--free-ratio)) 100% 50%);
background-image: linear-gradient(to right, var(--color) var(--used-percent), transparent var(--used-percent), transparent) !important;
text-align: center !important;
}
.compact .ui.icon.buttons .mini.button {
padding: 0.5em;
--free-ratio: calc(var(--free) / var(--total));
--used-percent: calc(100% - 100% * var(--free-ratio));
--color: hsl(calc(120 * var(--free-ratio)) 100% 50%);
background-image: linear-gradient(
to right,
var(--color) var(--used-percent),
transparent var(--used-percent),
transparent
) !important;
text-align: center !important;
}
.compact {
overflow-x: scroll;
position: static !important;
overflow-x: auto;
}
.compact > input{
min-width: 10em;
padding-right: .1em;
.compact > input {
min-width: 10em;
padding-right: 0.1em;
}
.compact .ui.buttons .mini.button {
padding: 0.5em;
position: static;
}
.compact .ui.dropdown.button:not(.pointing):not(.floating).active {
border-radius: 0;
}
.compact .ui.dropdown .menu {
left: 0;
right: 0;
margin: -.7em .7em;
min-width: auto;
}

View File

@ -6,7 +6,7 @@
<xsl:import href="lib/head.xsl"/>
<xsl:import href="lib/nav.xsl"/>
<xsl:import href="lib/serviceLabel.xsl"/>
<xsl:import href="lib/service.xsl"/>
<xsl:import href="lib/toast.xsl"/>
<xsl:output method="html" encoding="UTF-8"/>
@ -19,7 +19,7 @@
<xsl:param name="sudo" select="false"/>
<xsl:variable name="current" select="./nmaprun"/>
<xsl:variable name="stylesheetURL" select="substring-before(substring-after(processing-instruction('xml-stylesheet'),'href=&quot;'),'&quot;')"/>
<xsl:variable name="stylesheetURL" select="substring-before(substring-after(processing-instruction('xml-stylesheet'),'href=&quot;'), '?')"/>
<xsl:variable name="basedir" select="concat($stylesheetURL, '/../..')"/>
<xsl:variable name="init" select="document($originalURL)/nmaprun"/>
<xsl:variable name="nextComparison">
@ -152,10 +152,11 @@ function hostScanning(link) {
</xsl:if>
</div>
<div class="description">
<xsl:apply-templates select="$currentHost/ports/port | $initHost/ports/port[not(@portid=$currentHost/ports/port/@portid)][not(state/@state='closed')]">
<xsl:apply-templates select="$currentHost/ports/port | $initHost/ports/port[not(@portid=$currentHost/ports/port/@portid)][not(state/@state='closed')]" mode="service">
<xsl:with-param name="initHost" select="$initHost"/>
<xsl:with-param name="currentHost" select="$currentHost"/>
<xsl:with-param name="hostAddress" select="$hostAddress"/>
<xsl:with-param name="class" select="'ui label'"/>
<xsl:sort select="number(@portid)" order="ascending"/>
</xsl:apply-templates>
</div>

View File

@ -6,6 +6,7 @@
<xsl:import href="lib/head.xsl"/>
<xsl:import href="lib/nav.xsl"/>
<xsl:import href="lib/service.xsl"/>
<xsl:import href="lib/toast.xsl"/>
<xsl:output method="html" encoding="UTF-8"/>
@ -18,7 +19,7 @@
<xsl:param name="sudo" select="false"/>
<xsl:variable name="current" select="./nmaprun"/>
<xsl:variable name="stylesheetURL" select="substring-before(substring-after(processing-instruction('xml-stylesheet'),'href=&quot;'),'&quot;')"/>
<xsl:variable name="stylesheetURL" select="substring-before(substring-after(processing-instruction('xml-stylesheet'),'href=&quot;'), '?')"/>
<xsl:variable name="basedir" select="concat($stylesheetURL, '/../..')"/>
<xsl:variable name="init" select="document($originalURL)/nmaprun"/>
<xsl:variable name="nextComparison">
@ -50,11 +51,13 @@
<xsl:with-param name="sudo" select="$sudo"/>
</xsl:apply-templates>
<main class="ui container">
<main class="ui wide container">
<h1 class="ui header"><xsl:value-of select="$targets"/></h1>
<div class="ui doubling stackable four column compact grid">
<xsl:apply-templates select="host | $init/host[not(address/@addr=$current/host/address/@addr)][not(status/@state='down')]"/>
<div class="form">
<div class="ui doubling stackable four column compact grid">
<xsl:apply-templates select="host | $init/host[not(address/@addr=$current/host/address/@addr)][not(status/@state='down')]"/>
</div>
</div>
</main>
@ -90,7 +93,7 @@ $('.ui.dropdown').dropdown()
<div class="column">
<div>
<xsl:attribute name="class">
<xsl:text>ui fluid mini left icon compact input </xsl:text>
<xsl:text>ui fluid mini compact input </xsl:text>
<xsl:if test="$currentHost/ports/port | $initHost/ports/port[not(@portid=$currentHost/ports/port/@portid)][not(state/@state='closed')]">
<xsl:text>action buttons </xsl:text>
</xsl:if>
@ -99,15 +102,15 @@ $('.ui.dropdown').dropdown()
<xsl:otherwise>error</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
<i class="server icon"></i>
<input type="text" readonly="" value="{substring-before(hostnames/hostname/@name, '.')}" placeholder="{address/@addr}"
title="{$currentHost/hostnames/hostname/@name} ({address/@addr})"
onfocus="this.value='{hostnames/hostname/@name}'; this.select()" onblur="this.value='{substring-before(hostnames/hostname/@name, '.')}'"
/>
<xsl:apply-templates select="$currentHost/ports/port | $initHost/ports/port[not(@portid=$currentHost/ports/port/@portid)][not(state/@state='closed')]">
<xsl:apply-templates select="$initHost/ports/port[not(@portid=$currentHost/ports/port/@portid)][not(state/@state='closed')] | $currentHost/ports/port" mode="service">
<xsl:with-param name="initHost" select="$initHost"/>
<xsl:with-param name="currentHost" select="$currentHost"/>
<xsl:with-param name="hostAddress" select="$hostAddress"/>
<xsl:with-param name="class" select="'ui mini button'"/>
<xsl:sort select="number(@portid)" order="ascending"/>
</xsl:apply-templates>
</div>

View File

@ -6,6 +6,7 @@
<xsl:import href="lib/head.xsl"/>
<xsl:import href="lib/nav.xsl"/>
<xsl:import href="lib/service.xsl"/>
<xsl:import href="lib/toast.xsl"/>
<xsl:output method="html" encoding="UTF-8"/>
@ -18,12 +19,12 @@
<xsl:param name="sudo" select="false"/>
<xsl:variable name="current" select="./nmaprun"/>
<xsl:variable name="stylesheetURL" select="substring-before(substring-after(processing-instruction('xml-stylesheet'),'href=&quot;'),'&quot;')"/>
<xsl:variable name="stylesheetURL" select="substring-before(substring-after(processing-instruction('xml-stylesheet'),'href=&quot;'), '?')"/>
<xsl:variable name="basedir" select="concat($stylesheetURL, '/../..')"/>
<xsl:variable name="init" select="document($originalURL)/nmaprun"/>
<xsl:variable name="nextComparison">
<xsl:choose>
<xsl:when test="$thisURL"><xsl:value-of select="$saveAs"/></xsl:when>
<xsl:when test="$thisURL"><xsl:value-of select="$thisURL"/></xsl:when>
<xsl:when test="$originalURL"><xsl:value-of select="$originalURL"/></xsl:when>
<xsl:otherwise></xsl:otherwise>
</xsl:choose>
@ -74,7 +75,7 @@ table.order([1, 'asc']).draw()
$('.ui.dropdown').dropdown()
</script>
<xsl:apply-templates select="runstats">
<xsl:with-param name="init" select="$init"/>
</xsl:apply-templates>
@ -172,71 +173,12 @@ $('.ui.dropdown').dropdown()
<xsl:value-of select="@portid"/>
</td>
<td>
<a>
<xsl:attribute name="class">
<xsl:text>ui mini fluid button </xsl:text>
<xsl:choose>
<xsl:when test="$currentPort/script[@id='http-info']/elem[@key='status']>=500">red</xsl:when>
<xsl:when test="$currentPort/script[@id='http-info']/elem[@key='status']>=400">orange</xsl:when>
<xsl:when test="$currentPort/script[@id='http-info']/elem[@key='status']>=200">green</xsl:when>
<xsl:when test="$currentPort/state/@state='open'">green</xsl:when>
<xsl:when test="$currentPort/state/@state='filtered'">orange</xsl:when>
<xsl:otherwise>red</xsl:otherwise>
</xsl:choose>
<xsl:if test="$currentPort/script[@id='smb-shares-size']/table"> dropdown share-size</xsl:if>
</xsl:attribute>
<xsl:if test="$currentPort/script[@id='smb-shares-size']/table">
<xsl:attribute name="style">
<xsl:for-each select="$currentPort/script[@id='smb-shares-size']/table">
<xsl:sort select="elem[@key='FreeSize'] div elem[@key='TotalSize']" order="ascending"/>
<xsl:if test="position()=1">
<xsl:text>--free: </xsl:text>
<xsl:value-of select="elem[@key='FreeSize']"/>
<xsl:text>; --total: </xsl:text>
<xsl:value-of select="elem[@key='TotalSize']"/>
</xsl:if>
</xsl:for-each>
</xsl:attribute>
</xsl:if>
<xsl:if test="service/@name='ftp' or service/@name='ssh' or service/@name='http' or service/@name='https'">
<xsl:attribute name="href">
<xsl:choose>
<xsl:when test="service/@name='http' and service/@tunnel='ssl'">
<xsl:text>https</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="service/@name"/>
</xsl:otherwise>
</xsl:choose>
<xsl:text>://</xsl:text>
<xsl:value-of select="$hostAddress"/>
<xsl:text>:</xsl:text>
<xsl:value-of select="@portid"/>
</xsl:attribute>
</xsl:if>
<xsl:if test="service/@name='ms-wbt-server'">
<xsl:attribute name="href">
<xsl:text>rdp.php?v=</xsl:text>
<xsl:value-of select="$hostAddress"/>
<xsl:text>&amp;p=</xsl:text>
<xsl:value-of select="@portid"/>
</xsl:attribute>
</xsl:if>
<xsl:if test="script[@id='http-info']/elem[@key='title']">
<xsl:attribute name="title">
<xsl:value-of select="script[@id='http-info']/elem[@key='title']"/>
</xsl:attribute>
</xsl:if>
<xsl:value-of select="service/@name"/>
<xsl:if test="$currentPort/script[@id='smb-shares-size']/table">
<i class="dropdown icon"></i>
<div class="menu">
<xsl:apply-templates select="$currentPort/script[@id='smb-shares-size']/table">
<xsl:with-param name="hostAddress" select="$hostAddress"/>
</xsl:apply-templates>
</div>
</xsl:if>
</a>
<xsl:apply-templates select="." mode="service">
<xsl:with-param name="initHost" select="$initHost"/>
<xsl:with-param name="currentHost" select="$currentHost"/>
<xsl:with-param name="hostAddress" select="$hostAddress"/>
<xsl:with-param name="class" select="'ui mini fluid button'"/>
</xsl:apply-templates>
</td>
<td>
<xsl:value-of select="service/@product"/>

View File

@ -6,7 +6,7 @@
<xsl:import href="lib/head.xsl"/>
<xsl:import href="lib/nav.xsl"/>
<xsl:import href="lib/serviceLabel.xsl"/>
<xsl:import href="lib/service.xsl"/>
<xsl:import href="lib/toast.xsl"/>
<xsl:output method="html" encoding="UTF-8"/>
@ -16,10 +16,10 @@
<xsl:param name="thisURL" select=""/>
<xsl:param name="originalURL" select=""/>
<xsl:param name="refreshPeriod" select="0"/>
<xsl:param name="sudo" select="false"/>
<xsl:param name="sudo" select="false()"/>
<xsl:variable name="current" select="./nmaprun"/>
<xsl:variable name="stylesheetURL" select="substring-before(substring-after(processing-instruction('xml-stylesheet'),'href=&quot;'),'&quot;')"/>
<xsl:variable name="stylesheetURL" select="substring-before(substring-after(processing-instruction('xml-stylesheet'),'href=&quot;'), '?')"/>
<xsl:variable name="basedir" select="concat($stylesheetURL, '/../..')"/>
<xsl:variable name="init" select="document($originalURL)/nmaprun"/>
<xsl:variable name="nextComparison">
@ -31,7 +31,7 @@
</xsl:variable>
<xsl:template match="nmaprun">
<xsl:variable name="targets" select="substring-after(@args, '.xml ')"/>
<xsl:variable name="targets" select="substring-after(@args, '-oX - ')"/>
<html lang="fr">
<xsl:apply-templates select="." mode="head">
@ -61,7 +61,7 @@
<th>Adresse IP</th>
<th>Nom</th>
<th>Fabricant</th>
<th class="eight wide">Services</th>
<th class="six wide">Services</th>
<th>Scanner les services</th>
</tr>
</thead>
@ -163,10 +163,11 @@ function hostScanning(link) {
<xsl:value-of select="address[@addrtype='mac']/@vendor"/>
</td>
<td>
<xsl:apply-templates select="$initHost/ports/port[not(@portid=$currentHost/ports/port/@portid)][not(state/@state='closed')] | $currentHost/ports/port">
<xsl:apply-templates select="$initHost/ports/port[not(@portid=$currentHost/ports/port/@portid)][not(state/@state='closed')] | $currentHost/ports/port" mode="service">
<xsl:with-param name="initHost" select="$initHost"/>
<xsl:with-param name="currentHost" select="$currentHost"/>
<xsl:with-param name="hostAddress" select="$hostAddress"/>
<xsl:with-param name="class" select="'ui label'"/>
<xsl:sort select="number(@portid)" order="ascending"/>
</xsl:apply-templates>
</td>
@ -176,7 +177,7 @@ function hostScanning(link) {
<xsl:attribute name="href">
<xsl:value-of select="$basedir"/>
<xsl:text>/scan.php?preset=host&amp;targets=</xsl:text>
<xsl:value-of select="$hostAddress"/>
<xsl:value-of select="address/@addr"/>
</xsl:attribute>
<i class="satellite dish icon"></i>
<xsl:text> Services</xsl:text>
@ -185,7 +186,7 @@ function hostScanning(link) {
<xsl:attribute name="href">
<xsl:value-of select="$basedir"/>
<xsl:text>/?preset=host&amp;targets=</xsl:text>
<xsl:value-of select="$hostAddress"/>
<xsl:value-of select="address/@addr"/>
</xsl:attribute>
<i class="settings icon"></i>
</a>

View File

@ -77,4 +77,4 @@ refreshButton.onclick = function(event) {
}
</script>
</xsl:template>
</xsl:stylesheet>
</xsl:stylesheet>

View File

@ -4,17 +4,19 @@
xmlns:xs="http://www.w3.org/2001/XMLSchema"
version="1.1">
<xsl:template match="port">
<xsl:template match="port" mode="service">
<xsl:param name="hostAddress"/>
<xsl:param name="initHost"/>
<xsl:param name="currentHost"/>
<xsl:param name="class"/>
<xsl:variable name="portid" select="@portid"/>
<xsl:variable name="initPort" select="$initHost/ports/port[@portid=$portid]"/>
<xsl:variable name="currentPort" select="$currentHost/ports/port[@portid=$portid]"/>
<a target="_blank">
<xsl:attribute name="class">
<xsl:text>ui label </xsl:text>
<xsl:value-of select="$class"/>
<xsl:text> </xsl:text>
<xsl:choose>
<xsl:when test="$currentPort/script[@id='http-info']/elem[@key='status']>=500">red</xsl:when>
<xsl:when test="$currentPort/script[@id='http-info']/elem[@key='status']>=400">orange</xsl:when>
@ -43,7 +45,14 @@
</xsl:if>
<xsl:if test="service/@name='ftp' or service/@name='ssh' or service/@name='http' or service/@name='https'">
<xsl:attribute name="href">
<xsl:value-of select="service/@name"/>
<xsl:choose>
<xsl:when test="service/@name='http' and service/@tunnel='ssl'">
<xsl:text>https</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="service/@name"/>
</xsl:otherwise>
</xsl:choose>
<xsl:text>://</xsl:text>
<xsl:value-of select="$hostAddress"/>
<xsl:text>:</xsl:text>

View File

@ -10,7 +10,7 @@
<xsl:if test="finished/@summary">
$.toast({
title : '<xsl:value-of select="finished/@exit"/>',
message : '<xsl:value-of select="finished/@summary"/>',
message : `<xsl:value-of select="finished/@summary"/>`,
showIcon : 'satellite dish',
displayTime: 0,
closeIcon : true,
@ -20,7 +20,7 @@ $.toast({
<xsl:if test="finished/@errormsg">
$.toast({
title : '<xsl:value-of select="finished/@exit"/>',
message : '<xsl:value-of select="finished/@errormsg"/>',
message : `<xsl:value-of select="finished/@errormsg"/>`,
showIcon : 'exclamation triangle',
class : 'error',
displayTime: 0,