script-args
This commit is contained in:
parent
13f42cad36
commit
ad63f0691b
3
.gitignore
vendored
3
.gitignore
vendored
@ -1,3 +1,2 @@
|
||||
scans/
|
||||
datadir/script-args.ini
|
||||
test.php
|
||||
test.php
|
||||
|
102
home.php
102
home.php
@ -1,102 +0,0 @@
|
||||
<?php include_once "config.php"; ?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>lanScan</title>
|
||||
<link rel="icon" href="favicon.ico" />
|
||||
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/fomantic-ui@2.9.3/dist/semantic.min.css" />
|
||||
<link rel="stylesheet" type="text/css" href="style.css" />
|
||||
<style>
|
||||
body > .grid {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.logo {
|
||||
margin-right: 0 !important;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div class="ui middle aligned center aligned grid inverted">
|
||||
<div class="column" style="max-width: 450px;">
|
||||
<h2 class="ui inverted teal fluid image header logo">
|
||||
lan<?php include 'logo.svg'; ?>can
|
||||
</h2>
|
||||
<form id="scanForm" class="ui large form initial inverted" action="." method="get">
|
||||
<div class="ui left aligned stacked segment inverted">
|
||||
<h4 class="ui header">Découvrir ou superviser un réseau</h4>
|
||||
<div class="inverted field">
|
||||
<select id="lanSelect" name="lan" class="search clearable selection dropdown">
|
||||
<option value=""><?= $_SERVER['REMOTE_ADDR']; ?>/24</option>
|
||||
<?php
|
||||
if (file_exists($SCANSDIR)) {
|
||||
foreach (scandir($SCANSDIR) as $filename) {
|
||||
if (substr($filename, -4) === '.xml') {
|
||||
$name = substr($filename, 0, -4);
|
||||
$name = str_replace("!", "/", $name);
|
||||
echo " <option value='$name'>$name</option>\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="ui error message"></div>
|
||||
<button type="submit" class="ui fluid large teal labeled icon submit button">
|
||||
<i class="satellite dish icon"></i>Scanner
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<div class="ui inverted segment">
|
||||
<a href="options.php">Options avancées</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/semantic-ui/dist/semantic.min.js"></script>
|
||||
<script>
|
||||
$('#lanSelect').dropdown({allowAdditions: true, clearable: true})
|
||||
|
||||
$('#scanForm').form({
|
||||
fields: {
|
||||
lan: {
|
||||
identifier: 'lanSelect',
|
||||
rules: [{
|
||||
type: 'regExp',
|
||||
value: /[a-zA-Z0-9._\/ \-]+/,
|
||||
prompt: "Les cibles peuvent être spécifiées par des noms d'hôtes, des adresses IP, des adresses de réseaux, etc.<br/>Exemples : <?= $_SERVER['REMOTE_ADDR']; ?>/24 <?= $_SERVER['SERVER_NAME']; ?> 10.0-255.0-255.1-254"
|
||||
}]
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
scanForm.onsubmit = function(event) {
|
||||
if (this.checkValidity()) {
|
||||
scanForm.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()
|
||||
this.reportValidity()
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
</body>
|
||||
|
||||
</html
|
3
script-args.ini
Normal file
3
script-args.ini
Normal file
@ -0,0 +1,3 @@
|
||||
smbdomain = WORKGROUP
|
||||
smbuser =
|
||||
smbpassword =
|
34
scripts/README.md
Normal file
34
scripts/README.md
Normal file
@ -0,0 +1,34 @@
|
||||
# nmap-scripts
|
||||
|
||||
## http-info.nse
|
||||
|
||||
Return status, title and favicon URL of a webpage
|
||||
|
||||
```lua
|
||||
@args http-get.path Path to get. Default /.
|
||||
@usage nmap -phttp,https --script http-info.nse --script-args http-info.path=/ <host>
|
||||
@output
|
||||
80/tcp open http
|
||||
| http-info:
|
||||
| status-line: HTTP/1.1 200 OK\x0D
|
||||
|
|
||||
| title: Go ahead and ScanMe!
|
||||
| favicon: http://scanme.nmap.org:80/shared/images/tiny-eyeicon.png
|
||||
|_ status: 200
|
||||
```
|
||||
|
||||
## smb-shares-size.nse
|
||||
|
||||
Return free and total size in octets of each SMB shares
|
||||
|
||||
```lua
|
||||
@args See the documentation for the smbauth library.
|
||||
@usage nmap -p137-139,445 --script smb-shares-size.nse --script-args-file smb-shares-size.ini <host>
|
||||
@output
|
||||
Host script results:
|
||||
| smb-shares-size:
|
||||
| data:
|
||||
| FreeSize: 38495883264
|
||||
| TotalSize: 500961574912
|
||||
|_ IPC$: NT_STATUS_ACCESS_DENIED
|
||||
```
|
113
scripts/http-info.nse
Normal file
113
scripts/http-info.nse
Normal file
@ -0,0 +1,113 @@
|
||||
local shortport = require "shortport"
|
||||
|
||||
description = [[
|
||||
Return status, title and favicon URL of a webpage
|
||||
]]
|
||||
|
||||
---
|
||||
-- @args http-get.path Path to get. Default /.
|
||||
--
|
||||
-- @usage nmap -phttp,https --script http-info.nse --script-args http-info.path=/ <host>
|
||||
--
|
||||
-- @output
|
||||
-- 80/tcp open http
|
||||
-- | http-info:
|
||||
-- | status-line: HTTP/1.1 200 OK\x0D
|
||||
-- |
|
||||
-- | title: Go ahead and ScanMe!
|
||||
-- | favicon: http://scanme.nmap.org:80/shared/images/tiny-eyeicon.png
|
||||
-- |_ status: 200
|
||||
---
|
||||
|
||||
categories = {"discovery", "intrusive"}
|
||||
author = "Adrien Malingrey"
|
||||
license = "Same as Nmap--See https://nmap.org/book/man-legal.html"
|
||||
|
||||
portrule = shortport.http
|
||||
|
||||
local http = require "http"
|
||||
local stdnse = require "stdnse"
|
||||
|
||||
action = function(host, port)
|
||||
local scheme = ""
|
||||
local hostaddress = (host.name ~= '' and host.name) or host.ip
|
||||
local path = "/"
|
||||
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
|
||||
|
||||
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", 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
|
||||
output.title = title
|
||||
end
|
||||
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", path)
|
||||
end
|
||||
|
||||
favicon = http.get(hostaddress, port, favicon_relative_uri)
|
||||
|
||||
if (favicon and favicon.status == 200) then
|
||||
stdnse.debug1("[SUCCESS] Load favicon %s", favicon_relative_uri)
|
||||
output.favicon = favicon_relative_uri
|
||||
else
|
||||
stdnse.debug1("[ERROR] Can't load favicon %s", favicon_relative_uri)
|
||||
end
|
||||
|
||||
return output
|
||||
end
|
||||
|
||||
--- function taken from http_favicon.nse by Vlatko Kosturjak
|
||||
|
||||
function parseIcon( body )
|
||||
local _, i, j
|
||||
local rel, href, word
|
||||
|
||||
-- Loop through link elements.
|
||||
i = 0
|
||||
while i do
|
||||
_, i = string.find(body, "<%s*[Ll][Ii][Nn][Kk]%s", i + 1)
|
||||
if not i then
|
||||
return nil
|
||||
end
|
||||
-- Loop through attributes.
|
||||
j = i
|
||||
while true do
|
||||
local name, quote, value
|
||||
_, j, name, quote, value = string.find(body, "^%s*(%w+)%s*=%s*([\"'])(.-)%2", j + 1)
|
||||
if not j then
|
||||
break
|
||||
end
|
||||
if string.lower(name) == "rel" then
|
||||
rel = value
|
||||
elseif string.lower(name) == "href" then
|
||||
href = value
|
||||
end
|
||||
end
|
||||
for word in string.gmatch(rel or "", "%S+") do
|
||||
if string.lower(word) == "icon" then
|
||||
return href
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
206
scripts/smb-shares-size.nse
Normal file
206
scripts/smb-shares-size.nse
Normal file
@ -0,0 +1,206 @@
|
||||
local shortport = require "shortport"
|
||||
|
||||
description = [[
|
||||
Return free and total size in octets of each SMB shares
|
||||
]]
|
||||
|
||||
---
|
||||
-- @args See the documentation for the smbauth library.
|
||||
--
|
||||
-- @usage nmap -p137-139,445 --script smb-shares-size.nse --script-args-file smb-authentication.ini <host>
|
||||
--
|
||||
-- @output
|
||||
-- Host script results:
|
||||
-- | smb-shares-size:
|
||||
-- | data:
|
||||
-- | FreeSize: 38495883264
|
||||
-- | TotalSize: 500961574912
|
||||
-- |_ IPC$: NT_STATUS_ACCESS_DENIED
|
||||
---
|
||||
|
||||
categories = {"discovery", "intrusive"}
|
||||
author = "Adrien Malingrey"
|
||||
license = "Same as Nmap--See https://nmap.org/book/man-legal.html"
|
||||
|
||||
portrule = shortport.service({"microsoft-ds", "netbios-ssn", "smb"})
|
||||
|
||||
local stdnse = require "stdnse"
|
||||
local smb = require "smb"
|
||||
local smb2 = require "smb2"
|
||||
local msrpc = require "msrpc"
|
||||
local bin = require "bin"
|
||||
|
||||
action = function(host)
|
||||
local status, shares, extra
|
||||
local response = stdnse.output_table()
|
||||
|
||||
-- Try and do this the good way, make a MSRPC call to get the shares
|
||||
stdnse.debug1("SMB: Attempting to log into the system to enumerate shares")
|
||||
status, shares = msrpc.enum_shares(host)
|
||||
if(status == false) then
|
||||
return stdnse.format_output(false, string.format("Couldn't enumerate shares: %s", shares))
|
||||
end
|
||||
|
||||
-- Get more information on each share
|
||||
for i = 1, #shares, 1 do
|
||||
local share = shares[i]
|
||||
if (share ~= nil) then
|
||||
local status, result = get_share_info(host, share)
|
||||
if (status) then
|
||||
response[share] = result
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return response
|
||||
end
|
||||
|
||||
TRANS2_QUERY_FS_INFORMATION = 0x0003
|
||||
SMB_QUERY_FS_SIZE_INFO = 0x0103
|
||||
---Attempts to retrieve additional information about a share. Will fail unless we have
|
||||
-- administrative access.
|
||||
--
|
||||
--@param host The host object.
|
||||
--@return Status (true or false).
|
||||
--@return A table of information about the share (if status is true) or an an error string (if
|
||||
-- status is false).
|
||||
function get_share_info(host, share)
|
||||
local status, smbstate, err
|
||||
local hostaddress = (host.name ~= '' and host.name) or host.ip
|
||||
local path = "\\\\" .. hostaddress .. "\\" .. share
|
||||
|
||||
status, smbstate = smb.start(host)
|
||||
status, err = smb.negotiate_protocol(smbstate, {})
|
||||
status, err = smb.start_session(smbstate, {})
|
||||
status, err = smb.tree_connect(smbstate, path, {})
|
||||
|
||||
stdnse.debug1("SMB: Getting information for share: %s", path)
|
||||
|
||||
local status, err = send_transaction2(smbstate, TRANS2_QUERY_FS_INFORMATION, bin.pack("<S", SMB_QUERY_FS_SIZE_INFO))
|
||||
if ( not(status) ) then
|
||||
status, err = smb.stop(smbstate)
|
||||
return false, "Failed to send data to server: send_transaction2"
|
||||
end
|
||||
|
||||
local status, response = receive_transaction2(smbstate)
|
||||
if ( not(status) ) then
|
||||
status, err = smb.stop(smbstate)
|
||||
return false, response
|
||||
end
|
||||
|
||||
local pos, totalAllocationUnits, totalFreeAllocationUnits, sectorsPerAllocationUnit, bytesPerSector = bin.unpack("<LLII", response.data)
|
||||
|
||||
status, err = smb.stop(smbstate)
|
||||
|
||||
return true, {
|
||||
TotalSize = totalAllocationUnits * sectorsPerAllocationUnit * bytesPerSector,
|
||||
FreeSize = totalFreeAllocationUnits * sectorsPerAllocationUnit * bytesPerSector
|
||||
}
|
||||
end
|
||||
|
||||
-- Taken from smb lib
|
||||
|
||||
function send_transaction2(smbstate, sub_command, function_parameters, function_data, overrides)
|
||||
overrides = overrides or {}
|
||||
local header1, header2, header3, header4, command, status, flags, flags2, pid_high, signature, unused, pid, mid
|
||||
local header, parameters, data
|
||||
local parameter_offset = 0
|
||||
local parameter_size = 0
|
||||
local data_offset = 0
|
||||
local data_size = 0
|
||||
local total_word_count, total_data_count, reserved1, parameter_count, parameter_displacement, data_count, data_displacement, setup_count, reserved2
|
||||
local response = {}
|
||||
|
||||
-- Header is 0x20 bytes long (not counting NetBIOS header).
|
||||
header = smb.smb_encode_header(smbstate, smb.command_codes['SMB_COM_TRANSACTION2'], overrides) -- 0x32 = SMB_COM_TRANSACTION2
|
||||
|
||||
if(function_parameters) then
|
||||
parameter_offset = 0x44
|
||||
parameter_size = #function_parameters
|
||||
data_offset = #function_parameters + 33 + 32
|
||||
end
|
||||
|
||||
-- Parameters are 0x20 bytes long.
|
||||
parameters = bin.pack("<SSSSCCSISSSSSCCS",
|
||||
parameter_size, -- Total parameter count.
|
||||
data_size, -- Total data count.
|
||||
0x000a, -- Max parameter count.
|
||||
0x3984, -- Max data count.
|
||||
0x00, -- Max setup count.
|
||||
0x00, -- Reserved.
|
||||
0x0000, -- Flags (0x0000 = 2-way transaction, don't disconnect TIDs).
|
||||
0x00001388, -- Timeout (0x00000000 = return immediately).
|
||||
0x0000, -- Reserved.
|
||||
parameter_size, -- Parameter bytes.
|
||||
parameter_offset, -- Parameter offset.
|
||||
data_size, -- Data bytes.
|
||||
data_offset, -- Data offset.
|
||||
0x01, -- Setup Count
|
||||
0x00, -- Reserved
|
||||
sub_command -- Sub command
|
||||
)
|
||||
|
||||
local data = "\0\0\0" .. (function_parameters or '')
|
||||
.. (function_data or '')
|
||||
|
||||
-- Send the transaction request
|
||||
stdnse.debug2("SMB: Sending SMB_COM_TRANSACTION2")
|
||||
local result, err = smb.smb_send(smbstate, header, parameters, data, overrides)
|
||||
if(result == false) then
|
||||
stdnse.debug1("SMB: Try SMBv2 connexion")
|
||||
local result, err = smb2.smb2_send(smbstate, header, parameters, data, overrides)
|
||||
if(result == false) then
|
||||
return false, err
|
||||
end
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
function receive_transaction2(smbstate)
|
||||
|
||||
-- Read the result
|
||||
local status, header, parameters, data = smb.smb_read(smbstate)
|
||||
if(status ~= true) then
|
||||
stdnse.debug1("SMB: Try SMBv2 connexion")
|
||||
local status, header, parameters, data = smb2.smb2_read(smbstate)
|
||||
if(status ~= true) then
|
||||
return false, header
|
||||
end
|
||||
end
|
||||
|
||||
-- Check if it worked
|
||||
local pos, header1, header2, header3, header4, command, status, flags, flags2, pid_high, signature, unused, tid, pid, uid, mid = bin.unpack("<CCCCCICSSlSSSSS", header)
|
||||
if(header1 == nil or mid == nil) then
|
||||
return false, "SMB: ERROR: Server returned less data than it was supposed to (one or more fields are missing); aborting [29]"
|
||||
end
|
||||
if(status ~= 0) then
|
||||
if(smb.status_names[status] == nil) then
|
||||
return false, string.format("Unknown SMB error: 0x%08x\n", status)
|
||||
else
|
||||
return false, smb.status_names[status]
|
||||
end
|
||||
end
|
||||
|
||||
-- Parse the parameters
|
||||
local pos, total_word_count, total_data_count, reserved1, parameter_count, parameter_offset, parameter_displacement, data_count, data_offset, data_displacement, setup_count, reserved2 = bin.unpack("<SSSSSSSSSCC", parameters)
|
||||
if(total_word_count == nil or reserved2 == nil) then
|
||||
return false, "SMB: ERROR: Server returned less data than it was supposed to (one or more fields are missing); aborting [30]"
|
||||
end
|
||||
|
||||
-- Convert the parameter/data offsets into something more useful (the offset into the data section)
|
||||
-- - 0x20 for the header, - 0x01 for the length.
|
||||
parameter_offset = parameter_offset - 0x20 - 0x01 - #parameters - 0x02;
|
||||
-- - 0x20 for the header, - 0x01 for parameter length, the parameter length, and - 0x02 for the data length.
|
||||
data_offset = data_offset - 0x20 - 0x01 - #parameters - 0x02;
|
||||
|
||||
-- I'm not sure I entirely understand why the '+1' is here, but I think it has to do with the string starting at '1' and not '0'.
|
||||
local function_parameters = string.sub(data, parameter_offset + 1, parameter_offset + parameter_count)
|
||||
local function_data = string.sub(data, data_offset + 1, data_offset + data_count)
|
||||
|
||||
local response = {}
|
||||
response['parameters'] = function_parameters
|
||||
response['data'] = function_data
|
||||
|
||||
return true, response
|
||||
end
|
@ -11,15 +11,19 @@
|
||||
<xsl:output indent="yes" />
|
||||
<xsl:strip-space elements='*' />
|
||||
|
||||
<xsl:variable name="stylesheetURL" select="substring-before(substring-after(processing-instruction('xml-stylesheet'),'href="'), '"')" />
|
||||
<xsl:variable name="stylesheetURL"
|
||||
select="substring-before(substring-after(processing-instruction('xml-stylesheet'),'href="'), '"')" />
|
||||
<xsl:variable name="base" select="concat($stylesheetURL, '/../../')" />
|
||||
|
||||
<xsl:template match="nmaprun">
|
||||
<xsl:variable name="targets" select="substring-after(@args, '.xsl ')" />
|
||||
<xsl:variable name="current" select="." />
|
||||
<xsl:variable name="init" select="document(concat($base, 'scans/', translate($targets,'/', '!'), '.xml'))/nmaprun" />
|
||||
<xsl:variable
|
||||
name="current" select="." />
|
||||
<xsl:variable name="init"
|
||||
select="document(concat($base, 'scans/', translate($targets,'/', '!'), '.xml'))/nmaprun" />
|
||||
|
||||
<html lang="fr">
|
||||
<html
|
||||
lang="fr">
|
||||
<xsl:apply-templates select="." mode="head">
|
||||
<xsl:with-param name="base" select="$base" />
|
||||
<xsl:with-param name="targets" select="$targets" />
|
||||
@ -30,7 +34,8 @@
|
||||
</xsl:apply-templates>
|
||||
|
||||
<main class="ui main container inverted segment">
|
||||
<xsl:apply-templates select="$current/host | $init/host[not(address/@addr=$current/host/address/@addr)][not(status/@state='down')]">
|
||||
<xsl:apply-templates
|
||||
select="$current/host | $init/host[not(address/@addr=$current/host/address/@addr)][not(status/@state='down')]">
|
||||
<xsl:with-param name="init" select="$init" />
|
||||
<xsl:with-param name="current" select="$current" />
|
||||
</xsl:apply-templates>
|
||||
@ -52,9 +57,12 @@ $('.ui.dropdown').dropdown()
|
||||
<xsl:template match="host">
|
||||
<xsl:param name="init" />
|
||||
<xsl:param name="current" />
|
||||
<xsl:variable name="addr" select="address/@addr" />
|
||||
<xsl:variable name="initHost" select="$init/host[address/@addr=$addr]" />
|
||||
<xsl:variable name="currentHost" select="$current/host[address/@addr=$addr]" />
|
||||
<xsl:variable name="addr"
|
||||
select="address/@addr" />
|
||||
<xsl:variable name="initHost"
|
||||
select="$init/host[address/@addr=$addr]" />
|
||||
<xsl:variable name="currentHost"
|
||||
select="$current/host[address/@addr=$addr]" />
|
||||
<xsl:variable name="hostAddress">
|
||||
<xsl:choose>
|
||||
<xsl:when test="hostnames/hostname/@name">
|
||||
@ -67,13 +75,13 @@ $('.ui.dropdown').dropdown()
|
||||
</xsl:variable>
|
||||
|
||||
<h1>
|
||||
<xsl:attribute name="class">
|
||||
<xsl:text>ui inverted header </xsl:text>
|
||||
<xsl:attribute name="class">
|
||||
<xsl:text>ui inverted header </xsl:text>
|
||||
<xsl:choose>
|
||||
<xsl:when test="$currentHost/status/@state='up'">green</xsl:when>
|
||||
<xsl:otherwise>red</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:attribute>
|
||||
<xsl:when test="$currentHost/status/@state='up'">green</xsl:when>
|
||||
<xsl:otherwise>red</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:attribute>
|
||||
<xsl:choose>
|
||||
<xsl:when test="hostnames/hostname/@name">
|
||||
<xsl:value-of select="hostnames/hostname/@name" />
|
||||
@ -84,7 +92,8 @@ $('.ui.dropdown').dropdown()
|
||||
</xsl:choose>
|
||||
</h1>
|
||||
|
||||
<table class="ui inverted table" style="width: max-content">
|
||||
<table
|
||||
class="ui inverted table" style="width: max-content">
|
||||
<thead>
|
||||
<tr>
|
||||
<xsl:if test="address[@addrtype='ipv4']/@addr">
|
||||
@ -144,20 +153,23 @@ $('.ui.dropdown').dropdown()
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<div class="ui inverted tree accordion">
|
||||
<div class="title">
|
||||
<i class="dropdown icon"></i>
|
||||
Informations supplémentaires
|
||||
<xsl:if
|
||||
test="hostscript/script">
|
||||
<div class="ui inverted tree accordion">
|
||||
<div class="title">
|
||||
<i class="dropdown icon"></i> Informations supplémentaires </div>
|
||||
<div class="content">
|
||||
<xsl:apply-templates select="hostscript/script" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="content">
|
||||
<xsl:apply-templates select="hostscript/script" />
|
||||
</div>
|
||||
</div>
|
||||
</xsl:if>
|
||||
|
||||
<h2 class="ui header">Services</h2>
|
||||
<h2
|
||||
class="ui header">Services</h2>
|
||||
|
||||
<div class="ui cards">
|
||||
<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')]">
|
||||
<xsl:with-param name="initHost" select="$initHost" />
|
||||
<xsl:with-param name="currentHost" select="$currentHost" />
|
||||
<xsl:with-param name="hostAddress" select="$hostAddress" />
|
||||
@ -170,9 +182,12 @@ $('.ui.dropdown').dropdown()
|
||||
<xsl:param name="hostAddress" />
|
||||
<xsl:param name="initHost" />
|
||||
<xsl:param name="currentHost" />
|
||||
<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]" />
|
||||
<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]" />
|
||||
<xsl:variable name="color">
|
||||
<xsl:choose>
|
||||
<xsl:when test="$currentPort/script[@id='http-info']/elem[@key='status']>=500">red</xsl:when>
|
||||
@ -184,7 +199,8 @@ $('.ui.dropdown').dropdown()
|
||||
</xsl:choose>
|
||||
</xsl:variable>
|
||||
|
||||
<div class="ui inverted card {$color}">
|
||||
<div
|
||||
class="ui inverted card {$color}">
|
||||
<div class="content">
|
||||
<div class="header">
|
||||
<div class="ui {$color} ribbon label" style="text-transform: uppercase">
|
||||
@ -222,9 +238,7 @@ $('.ui.dropdown').dropdown()
|
||||
<xsl:if test="script">
|
||||
<div class="ui inverted tree accordion">
|
||||
<div class="title">
|
||||
<i class="dropdown icon"></i>
|
||||
Détails
|
||||
</div>
|
||||
<i class="dropdown icon"></i> Détails </div>
|
||||
<div class="content">
|
||||
<xsl:apply-templates select="script" />
|
||||
</div>
|
||||
@ -233,7 +247,8 @@ $('.ui.dropdown').dropdown()
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<xsl:if test="service/@name='ftp' or service/@name='ssh' or service/@name='http' or service/@name='https' or service/@name='ms-wbt-server'">
|
||||
<xsl:if
|
||||
test="service/@name='ftp' or service/@name='ssh' or service/@name='http' or service/@name='https' or service/@name='ms-wbt-server'">
|
||||
<a class="ui {$color} button">
|
||||
<xsl:attribute name="href" target="_blank">
|
||||
<xsl:choose>
|
||||
@ -241,7 +256,8 @@ $('.ui.dropdown').dropdown()
|
||||
<xsl:text>rdp.php?v=</xsl:text>
|
||||
<xsl:value-of select="$hostAddress" />
|
||||
<xsl:text>&p=</xsl:text>
|
||||
<xsl:value-of select="@portid" />
|
||||
<xsl:value-of
|
||||
select="@portid" />
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:choose>
|
||||
@ -253,15 +269,15 @@ $('.ui.dropdown').dropdown()
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
<xsl:text>://</xsl:text>
|
||||
<xsl:value-of select="$hostAddress" />
|
||||
<xsl:value-of
|
||||
select="$hostAddress" />
|
||||
<xsl:text>:</xsl:text>
|
||||
<xsl:value-of select="@portid" />
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:attribute>
|
||||
<i class="external alternate icon"></i>
|
||||
Ouvrir
|
||||
</a>
|
||||
<i
|
||||
class="external alternate icon"></i> Ouvrir </a>
|
||||
</xsl:if>
|
||||
</div>
|
||||
|
||||
@ -277,13 +293,14 @@ $('.ui.dropdown').dropdown()
|
||||
<xsl:choose>
|
||||
<xsl:when test="elem or table">
|
||||
<xsl:if test="elem">
|
||||
<table class="ui small inverted fixed definition table">
|
||||
<table class="ui small compact inverted fixed definition table">
|
||||
<tbody>
|
||||
<xsl:apply-templates select="elem" />
|
||||
</tbody>
|
||||
</table>
|
||||
</xsl:if>
|
||||
<xsl:apply-templates select="table" />
|
||||
<xsl:apply-templates
|
||||
select="table" />
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="@output" />
|
||||
@ -303,7 +320,7 @@ $('.ui.dropdown').dropdown()
|
||||
</div>
|
||||
<div class="content">
|
||||
<xsl:if test="elem">
|
||||
<table class="ui small inverted fixed definition table">
|
||||
<table class="ui small compact inverted fixed definition table">
|
||||
<tbody>
|
||||
<xsl:apply-templates select="elem" />
|
||||
</tbody>
|
||||
@ -314,7 +331,7 @@ $('.ui.dropdown').dropdown()
|
||||
</div>
|
||||
</xsl:when>
|
||||
<xsl:when test="elem">
|
||||
<table class="ui small inverted fixed definition table">
|
||||
<table class="ui small compact inverted fixed definition table">
|
||||
<tbody>
|
||||
<xsl:apply-templates select="elem" />
|
||||
</tbody>
|
||||
@ -325,7 +342,7 @@ $('.ui.dropdown').dropdown()
|
||||
|
||||
<xsl:template match="elem">
|
||||
<tr>
|
||||
<td>
|
||||
<td style="width: min-content">
|
||||
<xsl:value-of select="@key" />
|
||||
</td>
|
||||
<td>
|
||||
|
@ -41,7 +41,7 @@
|
||||
</h1>
|
||||
|
||||
<table id="scanResultsTable" style="width:100%" role="grid"
|
||||
class="ui sortable small stuck striped table">
|
||||
class="ui sortable small compact stuck striped table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width: min-width">Etat</th>
|
||||
@ -54,7 +54,7 @@
|
||||
</thead>
|
||||
<tbody>
|
||||
<xsl:apply-templates
|
||||
select="$current/host | $init/host[not(address/@addr=$current/host/address/@addr)][not(status/@state='down')]">
|
||||
select="host | $init/host[not(address/@addr=$current/host/address/@addr)][not(status/@state='down')]">
|
||||
<xsl:with-param name="init" select="$init" />
|
||||
<xsl:with-param name="current" select="$current" />
|
||||
</xsl:apply-templates>
|
||||
@ -127,7 +127,7 @@ $('.ui.dropdown').dropdown()
|
||||
<xsl:value-of select="$currentHost/status/@state" />
|
||||
</div>
|
||||
</xsl:when>
|
||||
<xsl:otherwise><div class="ui red circular label">down</div></xsl:otherwise>
|
||||
<xsl:otherwise><div class="ui mini circular label red">down</div></xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</td>
|
||||
<td>
|
||||
@ -146,7 +146,7 @@ $('.ui.dropdown').dropdown()
|
||||
</td>
|
||||
<td>
|
||||
<xsl:apply-templates
|
||||
select="$initHost/ports/port[not(@portid=$currentHost/ports/port/@portid)][not(state/@state='closed')] | $currentHost/ports/port"
|
||||
select="ports/port | $initHost/ports/port[not(state/@state='closed')][not(@portid=$currentHost/ports/port/@portid)]"
|
||||
mode="service">
|
||||
<xsl:with-param name="initHost" select="$initHost" />
|
||||
<xsl:with-param name="currentHost" select="$currentHost" />
|
||||
@ -156,7 +156,7 @@ $('.ui.dropdown').dropdown()
|
||||
</xsl:apply-templates>
|
||||
</td>
|
||||
<td>
|
||||
<a class="ui mini icon teal icon button" target="_blank">
|
||||
<a class="ui mini icon teal icon button" target="_blank" title="Scan intensif">
|
||||
<xsl:attribute name="href">scan.php?host=<xsl:value-of select="$hostAddress" /></xsl:attribute>
|
||||
<i class="search plus icon"></i>
|
||||
</a>
|
||||
|
@ -1,15 +1,16 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<xsl:stylesheet
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:xs="http://www.w3.org/2001/XMLSchema"
|
||||
version="1.1">
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:xs="http://www.w3.org/2001/XMLSchema"
|
||||
version="1.1">
|
||||
|
||||
<xsl:template match="nmaprun" mode="nav">
|
||||
<nav class="ui inverted secondary menu">
|
||||
<h3>
|
||||
<a href="." class="button item logo">lan<svg class="logo" version="1.1" id="Layer_1" x="0px" y="0px" viewBox="0 0 24 24" xml:space="preserve" width="40" height="40"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:svg="http://www.w3.org/2000/svg">
|
||||
<xsl:template match="nmaprun" mode="nav">
|
||||
<nav class="ui inverted secondary menu">
|
||||
<a href="." class="ui header button item logo">lan<svg class="logo" version="1.1" id="Layer_1"
|
||||
x="0px"
|
||||
y="0px" viewBox="0 0 24 24" xml:space="preserve" width="40" height="40"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:svg="http://www.w3.org/2000/svg">
|
||||
<defs id="defs206"></defs>
|
||||
<g id="g998" transform="matrix(0,0.04687491,-0.04687491,0,24,2.2682373e-5)">
|
||||
<g id="g147">
|
||||
@ -55,7 +56,38 @@
|
||||
</g>
|
||||
</svg>
|
||||
can</a>
|
||||
</h3>
|
||||
</nav>
|
||||
</xsl:template>
|
||||
</xsl:stylesheet>
|
||||
<div class="right menu">
|
||||
<form class="ui right aligned category search item" id="scanForm" action="scan.php"
|
||||
method="get">
|
||||
<div class="ui inverted icon input" id="targetsInputDiv">
|
||||
<input name="lan" class="prompt" type="text" placeholder="Scanner un réseau"
|
||||
pattern="[a-zA-Z0-9._\/ \-]+"
|
||||
title="Les cibles peuvent être spécifiées par des noms d'hôtes, des adresses IP, des adresses de réseaux, etc.
|
||||
Exemples: 192.168.1.0/24 scanme.nmap.org 10.0-255.0-255.1-254" />
|
||||
<i class="satellite dish icon"></i>
|
||||
</div>
|
||||
<a class="button item" href="options.php" title="Actualiser">
|
||||
<i class="settings icon"></i>
|
||||
</a>
|
||||
</form>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<script>
|
||||
scanForm.onsubmit = function(event) {
|
||||
if (scanForm.checkValidity()) {
|
||||
targetsInputDiv.classList.add('loading')
|
||||
$.toast({
|
||||
title : 'Scan en cours...',
|
||||
message : 'Merci de patienter',
|
||||
class : 'info',
|
||||
showIcon : 'satellite dish',
|
||||
displayTime: 0,
|
||||
closeIcon : true,
|
||||
position : 'bottom right',
|
||||
})
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</xsl:template>
|
||||
</xsl:stylesheet>
|
Loading…
x
Reference in New Issue
Block a user