http-info
This commit is contained in:
parent
d9d996e081
commit
fbd0f19ced
@ -27,9 +27,10 @@ local stdnse = require "stdnse"
|
||||
action = function(host, port)
|
||||
local scheme = ""
|
||||
local hostaddress = (host.name ~= '' and host.name) or host.ip
|
||||
local path = ""
|
||||
local path = "/"
|
||||
local uri
|
||||
local answer
|
||||
local favicon_relative_uri = "favicon.ico"
|
||||
local favicon_relative_uri = "/favicon.ico"
|
||||
local favicon
|
||||
|
||||
if (port.service == "ssl") then
|
||||
@ -39,21 +40,28 @@ action = function(host, port)
|
||||
end
|
||||
|
||||
if(stdnse.get_script_args('http-get.path')) then
|
||||
path = "/" .. stdnse.get_script_args('http-info.path')
|
||||
path = stdnse.get_script_args('http-info.path')
|
||||
end
|
||||
|
||||
answer = http.get_url(scheme.."://"..hostaddress..":"..port.number.."/"..path)
|
||||
uri = scheme.."://"..hostaddress..":"..port.number..path
|
||||
answer = http.get_url(uri)
|
||||
|
||||
if (answer and answer.status == 200) then
|
||||
stdnse.debug1("[SUCCESS] Load page %s", uri)
|
||||
favicon_relative_uri = parseIcon(answer.body) or "favicon.ico"
|
||||
stdnse.debug1("[INFO] Try favicon %s", favicon_relative_uri)
|
||||
else
|
||||
stdnse.debug1("[ERROR] Can't load page %s", uri)
|
||||
end
|
||||
|
||||
favicon_absolute_uri = scheme.."://"..hostaddress..":"..port.number.."/"..favicon_relative_uri
|
||||
favicon_absolute_uri = scheme.."://"..hostaddress..":"..port.number..favicon_relative_uri
|
||||
favicon = http.get_url(favicon_absolute_uri)
|
||||
|
||||
if (favicon and favicon.status == 200) then
|
||||
stdnse.debug1("[SUCCESS] Load favicon %s", favicon_absolute_uri)
|
||||
return {status=answer.status, ["status-line"]=answer["status-line"], favicon=favicon_absolute_uri}
|
||||
else
|
||||
stdnse.debug1("[ERROR] Can't load favicon %s", favicon_absolute_uri)
|
||||
return {status=answer.status, ["status-line"]=answer["status-line"]}
|
||||
end
|
||||
end
|
||||
|
16
results.xsl
16
results.xsl
@ -44,9 +44,11 @@
|
||||
<div class="ui main container">
|
||||
<xsl:choose>
|
||||
<xsl:when test="$scan/runstats/finished/@errormsg">
|
||||
<div class="ui negative message">
|
||||
<div class="ui negative icon message">
|
||||
<i class="exclamation triangle icon"></i>
|
||||
<div class="header">Erreur</div>
|
||||
<p><xsl:value-of select="$scan/runstats/finished/@errormsg"/></p></div>
|
||||
<p><xsl:value-of select="$scan/runstats/finished/@errormsg"/></p>
|
||||
</div>
|
||||
</xsl:when>
|
||||
<xsl:when test="$scan/runstats/finished/@summary">
|
||||
<div class="ui message">
|
||||
@ -95,8 +97,8 @@
|
||||
</xsl:variable>
|
||||
<div class="ui fluid mini left icon action input {$status}">
|
||||
<xsl:choose>
|
||||
<xsl:when test="$scannedHost/ports/port/script[@id='http-get']/elem[@key='favicon']">
|
||||
<i class="icon"><img class="ui image" src="{$scannedHost/ports/port/script[@id='http-get']/elem[@key='favicon']}" alt=""/></i>
|
||||
<xsl:when test="$scannedHost/ports/port/script[@id='http-info']/elem[@key='favicon']">
|
||||
<i class="icon"><img class="ui image" src="{$scannedHost/ports/port/script[@id='http-info']/elem[@key='favicon']}" alt=""/></i>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<i class="server icon"></i>
|
||||
@ -136,7 +138,7 @@
|
||||
<xsl:variable name="scannedPort" select="$scannedHost/ports/port[service/@name=$serviceName or @portid=$serviceName][1]"/>
|
||||
<xsl:variable name="state">
|
||||
<xsl:choose>
|
||||
<xsl:when test="$scannedPort/script[@id='http-get']/elem[@key='status']>=400">red</xsl:when>
|
||||
<xsl:when test="$scannedPort/script[@id='http-info']/elem[@key='status']>=400">red</xsl:when>
|
||||
<xsl:when test="$scannedPort/state/@state='filtered'">yellow</xsl:when>
|
||||
<xsl:when test="$scannedPort/state/@state='open'">primary</xsl:when>
|
||||
<xsl:otherwise>red</xsl:otherwise>
|
||||
@ -150,9 +152,9 @@
|
||||
<xsl:value-of select="$scannedPort/state/@state"/>
|
||||
<xsl:text> </xsl:text>
|
||||
<xsl:value-of select="$scannedPort/service/@name"/>
|
||||
<xsl:if test="$scannedPort/script[@id='http-get']/elem[@key='status-line']">
|
||||
<xsl:if test="$scannedPort/script[@id='http-info']/elem[@key='status-line']">
|
||||
<xsl:text> </xsl:text>
|
||||
<xsl:value-of select="$scannedPort/script[@id='http-get']/elem[@key='status-line']"/>
|
||||
<xsl:value-of select="$scannedPort/script[@id='http-info']/elem[@key='status-line']"/>
|
||||
</xsl:if>
|
||||
</xsl:variable>
|
||||
<xsl:choose>
|
||||
|
Reference in New Issue
Block a user