https
This commit is contained in:
parent
f8c4ea0903
commit
0439aecb98
@ -32,16 +32,19 @@ local http = require "http"
|
|||||||
local stdnse = require "stdnse"
|
local stdnse = require "stdnse"
|
||||||
|
|
||||||
action = function(host, port)
|
action = function(host, port)
|
||||||
local path = ""
|
|
||||||
local scheme = ""
|
local scheme = ""
|
||||||
|
local hostaddress = (host.name ~= '' and host.name) or host.ip
|
||||||
|
local path = ""
|
||||||
|
|
||||||
|
if (port.service == "ssl") then
|
||||||
|
scheme = "https"
|
||||||
|
else
|
||||||
|
scheme = port.service
|
||||||
|
end
|
||||||
|
|
||||||
if(stdnse.get_script_args('http-get.path')) then
|
if(stdnse.get_script_args('http-get.path')) then
|
||||||
path = "/" .. stdnse.get_script_args('http-get.path')
|
path = "/" .. stdnse.get_script_args('http-get.path')
|
||||||
end
|
end
|
||||||
|
|
||||||
if (port.service == "ssl") then scheme = "https"
|
return http.get_url(scheme.."://"..hostaddress..":"..port.number.."/"..path)
|
||||||
else scheme = port.service
|
|
||||||
end
|
|
||||||
|
|
||||||
return http.get_url( scheme.."://"..(host.name or host.ip)..":"..port.number.."/"..path, {redirect_ok=true} )
|
|
||||||
end
|
end
|
||||||
|
64
results.xsl
64
results.xsl
@ -3,7 +3,7 @@
|
|||||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||||
xmlns:xs="http://www.w3.org/2001/XMLSchema"
|
xmlns:xs="http://www.w3.org/2001/XMLSchema"
|
||||||
version="1.1">
|
version="1.1">
|
||||||
<xsl:output method="html" encoding="UTF-8" indent="yes" />
|
<xsl:output method="html" encoding="UTF-8" indent="yes"/>
|
||||||
|
|
||||||
<xsl:variable name="scan" select="document(string(lanScanConf/@scanpath))/nmaprun"/>
|
<xsl:variable name="scan" select="document(string(lanScanConf/@scanpath))/nmaprun"/>
|
||||||
|
|
||||||
@ -12,7 +12,7 @@
|
|||||||
<head>
|
<head>
|
||||||
<title>lanScan - <xsl:value-of select="@site"/></title>
|
<title>lanScan - <xsl:value-of select="@site"/></title>
|
||||||
<script src="https://cdn.jsdelivr.net/npm/jquery@3.6.3/dist/jquery.min.js"></script>
|
<script src="https://cdn.jsdelivr.net/npm/jquery@3.6.3/dist/jquery.min.js"></script>
|
||||||
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/fomantic-ui@2.9.2/dist/semantic.min.css" />
|
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/fomantic-ui@2.9.2/dist/semantic.min.css"/>
|
||||||
<script src="https://cdn.jsdelivr.net/npm/fomantic-ui@2.9.2/dist/semantic.min.js"></script>
|
<script src="https://cdn.jsdelivr.net/npm/fomantic-ui@2.9.2/dist/semantic.min.js"></script>
|
||||||
<style>
|
<style>
|
||||||
#logo {
|
#logo {
|
||||||
@ -36,7 +36,7 @@
|
|||||||
margin: auto;
|
margin: auto;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<meta http-equiv="refresh" content="300" />
|
<meta http-equiv="refresh" content="300"/>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<header class="ui fixed blue inverted menu">
|
<header class="ui fixed blue inverted menu">
|
||||||
@ -67,13 +67,13 @@
|
|||||||
<xsl:variable name="scannedHostAddress">
|
<xsl:variable name="scannedHostAddress">
|
||||||
<xsl:choose>
|
<xsl:choose>
|
||||||
<xsl:when test="$scannedHost/hostnames/hostname/@name">
|
<xsl:when test="$scannedHost/hostnames/hostname/@name">
|
||||||
<xsl:value-of select="$scannedHost/hostnames/hostname/@name" />
|
<xsl:value-of select="$scannedHost/hostnames/hostname/@name"/>
|
||||||
</xsl:when>
|
</xsl:when>
|
||||||
<xsl:when test="$scannedHost/address/@addr">
|
<xsl:when test="$scannedHost/address/@addr">
|
||||||
<xsl:value-of select="$scannedHost/address/@addr" />
|
<xsl:value-of select="$scannedHost/address/@addr"/>
|
||||||
</xsl:when>
|
</xsl:when>
|
||||||
<xsl:otherwise>
|
<xsl:otherwise>
|
||||||
<xsl:value-of select="$scannedHost/address/@addr" />
|
<xsl:value-of select="$scannedHost/address/@addr"/>
|
||||||
</xsl:otherwise>
|
</xsl:otherwise>
|
||||||
</xsl:choose>
|
</xsl:choose>
|
||||||
</xsl:variable>
|
</xsl:variable>
|
||||||
@ -87,7 +87,7 @@
|
|||||||
</xsl:attribute>
|
</xsl:attribute>
|
||||||
<xsl:choose>
|
<xsl:choose>
|
||||||
<xsl:when test="$scannedHost/ports/port/script[@id='http-favicon-url']/@output">
|
<xsl:when test="$scannedHost/ports/port/script[@id='http-favicon-url']/@output">
|
||||||
<i class="icon"><img class="ui image" src="{$scannedHost/ports/port/script[@id='http-favicon-url']/@output}" alt="" /></i>
|
<i class="icon"><img class="ui image" src="{$scannedHost/ports/port/script[@id='http-favicon-url']/@output}" alt=""/></i>
|
||||||
</xsl:when>
|
</xsl:when>
|
||||||
<xsl:otherwise>
|
<xsl:otherwise>
|
||||||
<i class="server icon"></i>
|
<i class="server icon"></i>
|
||||||
@ -96,33 +96,33 @@
|
|||||||
<input type="text" readonly="">
|
<input type="text" readonly="">
|
||||||
<xsl:attribute name="value">
|
<xsl:attribute name="value">
|
||||||
<xsl:choose>
|
<xsl:choose>
|
||||||
<xsl:when test="substring-before($scannedHost/hostnames/hostname/@name, '.')"><xsl:value-of select="substring-before($scannedHost/hostnames/hostname/@name, '.')" /></xsl:when>
|
<xsl:when test="substring-before($scannedHost/hostnames/hostname/@name, '.')"><xsl:value-of select="substring-before($scannedHost/hostnames/hostname/@name, '.')"/></xsl:when>
|
||||||
<xsl:when test="$scannedHost/hostnames/hostname/@name"><xsl:value-of select="$scannedHost/hostnames/hostname/@name" /></xsl:when>
|
<xsl:when test="$scannedHost/hostnames/hostname/@name"><xsl:value-of select="$scannedHost/hostnames/hostname/@name"/></xsl:when>
|
||||||
<xsl:when test="$scannedHost/address/@addr"><xsl:value-of select="$scannedHost/address/@addr" /></xsl:when>
|
<xsl:when test="$scannedHost/address/@addr"><xsl:value-of select="$scannedHost/address/@addr"/></xsl:when>
|
||||||
<xsl:when test="contains('0123456789', substring(@address,1,1))"><xsl:value-of select="@address" /></xsl:when>
|
<xsl:when test="contains('0123456789', substring(@address,1,1))"><xsl:value-of select="@address"/></xsl:when>
|
||||||
<xsl:when test="substring-before(@address, '.')"><xsl:value-of select="substring-before(@address, '.')" /></xsl:when>
|
<xsl:when test="substring-before(@address, '.')"><xsl:value-of select="substring-before(@address, '.')"/></xsl:when>
|
||||||
<xsl:otherwise><xsl:value-of select="@address" /></xsl:otherwise>
|
<xsl:otherwise><xsl:value-of select="@address"/></xsl:otherwise>
|
||||||
</xsl:choose>
|
</xsl:choose>
|
||||||
</xsl:attribute>
|
</xsl:attribute>
|
||||||
<xsl:attribute name="title">
|
<xsl:attribute name="title">
|
||||||
<xsl:choose>
|
<xsl:choose>
|
||||||
<xsl:when test="$scannedHost/hostnames/hostname/@name"><xsl:value-of select="$scannedHost/hostnames/hostname/@name" /> (<xsl:value-of select="$scannedHost/address/@addr" />)</xsl:when>
|
<xsl:when test="$scannedHost/hostnames/hostname/@name"><xsl:value-of select="$scannedHost/hostnames/hostname/@name"/> (<xsl:value-of select="$scannedHost/address/@addr"/>)</xsl:when>
|
||||||
<xsl:when test="$scannedHost/address/@addr"><xsl:value-of select="$scannedHost/address/@addr" /></xsl:when>
|
<xsl:when test="$scannedHost/address/@addr"><xsl:value-of select="$scannedHost/address/@addr"/></xsl:when>
|
||||||
<xsl:otherwise><xsl:value-of select="@address" /></xsl:otherwise>
|
<xsl:otherwise><xsl:value-of select="@address"/></xsl:otherwise>
|
||||||
</xsl:choose>
|
</xsl:choose>
|
||||||
</xsl:attribute>
|
</xsl:attribute>
|
||||||
</input>
|
</input>
|
||||||
<xsl:apply-templates select="service">
|
<xsl:apply-templates select="service">
|
||||||
<xsl:with-param name="scannedHost" select="$scannedHost" />
|
<xsl:with-param name="scannedHost" select="$scannedHost"/>
|
||||||
<xsl:with-param name="scannedHostAddress" select="$scannedHostAddress" />
|
<xsl:with-param name="scannedHostAddress" select="$scannedHostAddress"/>
|
||||||
</xsl:apply-templates>
|
</xsl:apply-templates>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:template match="service">
|
<xsl:template match="service">
|
||||||
<xsl:param name="scannedHost" />
|
<xsl:param name="scannedHost"/>
|
||||||
<xsl:param name="scannedHostAddress" />
|
<xsl:param name="scannedHostAddress"/>
|
||||||
<xsl:variable name="serviceName" select="@name"/>
|
<xsl:variable name="serviceName" select="@name"/>
|
||||||
<xsl:variable name="scannedPort" select="$scannedHost/ports/port[service/@name=$serviceName or @portid=$serviceName]"/>
|
<xsl:variable name="scannedPort" select="$scannedHost/ports/port[service/@name=$serviceName or @portid=$serviceName]"/>
|
||||||
<xsl:variable name="state">
|
<xsl:variable name="state">
|
||||||
@ -141,6 +141,10 @@
|
|||||||
<xsl:value-of select="$scannedPort/service/@name"/>
|
<xsl:value-of select="$scannedPort/service/@name"/>
|
||||||
<xsl:text> </xsl:text>
|
<xsl:text> </xsl:text>
|
||||||
<xsl:value-of select="$scannedPort/state/@state"/>
|
<xsl:value-of select="$scannedPort/state/@state"/>
|
||||||
|
<xsl:if test="$scannedPort/script[@id='http-get']/elem[@key='status-line']">
|
||||||
|
<xsl:text> HTTP Statut </xsl:text>
|
||||||
|
<xsl:value-of select="$scannedPort/script[@id='http-get']/elem[@key='status-line']"/>
|
||||||
|
</xsl:if>
|
||||||
</xsl:variable>
|
</xsl:variable>
|
||||||
<xsl:choose>
|
<xsl:choose>
|
||||||
<xsl:when test="($scannedPort/service/@name='microsoft-ds' or $scannedPort/service/@name='netbios-ssn' or $scannedPort/service/@name='smb') and $scannedHost/hostscript/script[@id='smb-enum-shares']/table[not(contains(@key, '$'))]">
|
<xsl:when test="($scannedPort/service/@name='microsoft-ds' or $scannedPort/service/@name='netbios-ssn' or $scannedPort/service/@name='smb') and $scannedHost/hostscript/script[@id='smb-enum-shares']/table[not(contains(@key, '$'))]">
|
||||||
@ -149,7 +153,7 @@
|
|||||||
<i class="dropdown icon"></i>
|
<i class="dropdown icon"></i>
|
||||||
<div class="menu">
|
<div class="menu">
|
||||||
<xsl:apply-templates select="$scannedHost/hostscript/script[@id='smb-enum-shares']/table[not(contains(@key, '$'))]">
|
<xsl:apply-templates select="$scannedHost/hostscript/script[@id='smb-enum-shares']/table[not(contains(@key, '$'))]">
|
||||||
<xsl:with-param name="scannedHostAddress" select="$scannedHostAddress" />
|
<xsl:with-param name="scannedHost" select="$scannedHost"/>
|
||||||
</xsl:apply-templates>
|
</xsl:apply-templates>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -174,9 +178,21 @@
|
|||||||
|
|
||||||
|
|
||||||
<xsl:template match="table">
|
<xsl:template match="table">
|
||||||
<xsl:param name="scannedHostAddress" />
|
<xsl:param name="scannedHost"/>
|
||||||
<a class="item" href="file:///{@key}" target="_blank" rel="noopener noreferrer">
|
<xsl:variable name="path">
|
||||||
<xsl:value-of select="@key" />
|
<xsl:choose>
|
||||||
|
<xsl:when test="$scannedHost/hostnames/hostname/@name and contains(@key, $scannedHost/address/@addr)">
|
||||||
|
<xsl:text>\\</xsl:text>
|
||||||
|
<xsl:value-of select="$scannedHost/hostnames/hostname/@name"/>
|
||||||
|
<xsl:value-of select="substring-after(@key, $scannedHost/address/@addr)"/>
|
||||||
|
</xsl:when>
|
||||||
|
<xsl:otherwise>
|
||||||
|
<xsl:value-of select="@key"/>
|
||||||
|
</xsl:otherwise>
|
||||||
|
</xsl:choose>
|
||||||
|
</xsl:variable>
|
||||||
|
<a class="item" href="file:///{$path}" target="_blank" rel="noopener noreferrer">
|
||||||
|
<xsl:value-of select="elem[@key='Comment']"/>
|
||||||
</a>
|
</a>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
|
16
scan_all.php
16
scan_all.php
@ -6,13 +6,15 @@ if (! function_exists('str_ends_with')) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!file_exists(__DIR__."/scans")) mkdir(__DIR__."/scans");
|
$__DIR__ = __DIR__;
|
||||||
if (!file_exists(__DIR__."/site")) mkdir(__DIR__."/site");
|
|
||||||
|
|
||||||
foreach (scandir(__DIR__."/confs") as $file) {
|
if (!file_exists("$__DIR__/scans")) mkdir("$__DIR__/scans");
|
||||||
|
if (!file_exists("$__DIR__/site")) mkdir("$__DIR__/site");
|
||||||
|
|
||||||
|
foreach (scandir("$__DIR__/confs") as $file) {
|
||||||
if (str_ends_with($file, ".yaml")) {
|
if (str_ends_with($file, ".yaml")) {
|
||||||
$site = str_replace(".yaml", "", $file);
|
$site = str_replace(".yaml", "", $file);
|
||||||
$yaml = yaml_parse_file(__DIR__."/confs/$file");
|
$yaml = yaml_parse_file("$__DIR__/confs/$file");
|
||||||
|
|
||||||
$targets = [];
|
$targets = [];
|
||||||
$services = [];
|
$services = [];
|
||||||
@ -47,10 +49,10 @@ XML
|
|||||||
$targets = join(array_keys($targets), " ");
|
$targets = join(array_keys($targets), " ");
|
||||||
$services = join(array_keys($services), ",");
|
$services = join(array_keys($services), ",");
|
||||||
|
|
||||||
exec("nmap -v -Pn -p $services --script smb-enum-shares,".__DIR__."/nmap -oX '".__DIR__."/scans/tmp.xml' $targets\n");
|
exec("nmap -v -Pn -p $services --script smb-enum-shares,'$__DIR__/nmap' -oX '$__DIR__/scans/tmp.xml' $targets");
|
||||||
rename(__DIR__."/scans/tmp.xml", __DIR__."/scans/$site.xml");
|
rename("$__DIR__/scans/tmp.xml", "$__DIR__/scans/$site.xml");
|
||||||
|
|
||||||
$xml->asXML(__DIR__."/site/$site.xml");
|
$xml->asXML("$__DIR__/site/$site.xml");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user