nmap http status script
This commit is contained in:
parent
72a9c62d4a
commit
a552a3cc06
@ -6,8 +6,6 @@ local stdnse = require "stdnse"
|
|||||||
local string = require "string"
|
local string = require "string"
|
||||||
local url = require "url"
|
local url = require "url"
|
||||||
|
|
||||||
local openssl = stdnse.silent_require "openssl"
|
|
||||||
|
|
||||||
description = [[
|
description = [[
|
||||||
Gets the favicon url ("favorites icon").
|
Gets the favicon url ("favorites icon").
|
||||||
|
|
||||||
@ -43,22 +41,15 @@ categories = {"default", "discovery", "safe"}
|
|||||||
portrule = shortport.http
|
portrule = shortport.http
|
||||||
|
|
||||||
action = function(host, port)
|
action = function(host, port)
|
||||||
local md5sum,answer
|
local answer
|
||||||
local match
|
local match
|
||||||
local status, favicondb
|
local status
|
||||||
local result
|
local result
|
||||||
local favicondbfile="nselib/data/favicon-db"
|
|
||||||
local index, icon
|
local index, icon
|
||||||
local root = ""
|
local root = ""
|
||||||
local url
|
local url
|
||||||
local hostname = host.targetname or (host.name ~= "" and host.name) or host.ip
|
local hostname = host.targetname or (host.name ~= "" and host.name) or host.ip
|
||||||
|
|
||||||
status, favicondb = datafiles.parse_file( favicondbfile, {["^%s*([^%s#:]+)[%s:]+"] = "^%s*[^%s#:]+[%s:]+(.*)"})
|
|
||||||
if not status then
|
|
||||||
stdnse.debug1("Could not open file: %s", favicondbfile )
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
if(stdnse.get_script_args('favicon.root')) then
|
if(stdnse.get_script_args('favicon.root')) then
|
||||||
root = stdnse.get_script_args('favicon.root')
|
root = stdnse.get_script_args('favicon.root')
|
||||||
end
|
end
|
||||||
|
25
http-status.nse
Normal file
25
http-status.nse
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
local shortport = require "shortport"
|
||||||
|
|
||||||
|
description = [[
|
||||||
|
Get root page and return status code
|
||||||
|
]]
|
||||||
|
|
||||||
|
---
|
||||||
|
-- @usage nmap -p80 --script http-status.nse <target>
|
||||||
|
--
|
||||||
|
-- @output
|
||||||
|
-- 404
|
||||||
|
---
|
||||||
|
|
||||||
|
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"
|
||||||
|
|
||||||
|
action = function(host, port)
|
||||||
|
return http.get( host, port, "/" ).status
|
||||||
|
end
|
@ -132,6 +132,12 @@
|
|||||||
</xsl:when>
|
</xsl:when>
|
||||||
<xsl:when test="$scannedPort/service/@name='ftp' or $scannedPort/service/@name='ssh' or $scannedPort/service/@name='http' or $scannedPort/service/@name='https'">
|
<xsl:when test="$scannedPort/service/@name='ftp' or $scannedPort/service/@name='ssh' or $scannedPort/service/@name='http' or $scannedPort/service/@name='https'">
|
||||||
<a class="ui primary mini button" href="{$scannedPort/service/@name}://{$scannedHostAddress}:{$scannedPort/@portid}">
|
<a class="ui primary mini button" href="{$scannedPort/service/@name}://{$scannedHostAddress}:{$scannedPort/@portid}">
|
||||||
|
<xsl:attribute name="class">
|
||||||
|
<xsl:choose>
|
||||||
|
<xsl:when test="$scannedPort/script[@id='http-status']>=400">ui red mini button</xsl:when>
|
||||||
|
<xsl:otherwise>ui primary mini button</xsl:otherwise>
|
||||||
|
</xsl:choose>
|
||||||
|
</xsl:attribute>
|
||||||
<xsl:value-of select="@name"/>
|
<xsl:value-of select="@name"/>
|
||||||
</a>
|
</a>
|
||||||
</xsl:when>
|
</xsl:when>
|
||||||
|
@ -46,7 +46,7 @@ foreach (scandir("./site/") as $file) {
|
|||||||
$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.nse,http-errors,./http-favicon-url.nse --script-args=httpspider.maxpagecount=1 -oX 'scans/$site.xml' $targets\n");
|
exec("nmap -v -Pn -p $services --script smb-enum-shares.nse,./http-status.nse,./http-favicon-url.nse --script-args=httpspider.maxpagecount=1 -oX 'scans/$site.xml' $targets\n");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user