Compare commits
9 Commits
365aba434c
...
main
Author | SHA1 | Date | |
---|---|---|---|
bddaa541bf | |||
180ecf99b5 | |||
6bbe7e270a | |||
2191a53956 | |||
10395a01e6 | |||
5995afaf18 | |||
1c12e66a04 | |||
523712a4c2 | |||
7c849a0088 |
2
.gitignore
vendored
2
.gitignore
vendored
@ -1 +1 @@
|
||||
smb-shares-size.ini
|
||||
smb-authentication.ini
|
||||
|
@ -20,62 +20,61 @@ Return status, title and favicon URL of a webpage
|
||||
---
|
||||
|
||||
categories = {"discovery", "intrusive"}
|
||||
author = "Adrien Malingrey"
|
||||
license = "Same as Nmap--See https://nmap.org/book/man-legal.html"
|
||||
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 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 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 info = {status=answer.status, ["status-line"]=answer["status-line"]}
|
||||
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
|
||||
info.title = title
|
||||
output.title = title
|
||||
end
|
||||
stdnse.debug1("[INFO] Try favicon %s", favicon_relative_uri)
|
||||
favicon_relative_uri = parseIcon(answer.body) or "favicon.ico"
|
||||
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)
|
||||
info.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 info
|
||||
return output
|
||||
end
|
||||
|
||||
--- function taken from http_favicon.nse by Vlatko Kosturjak
|
||||
|
@ -1,2 +1,3 @@
|
||||
smbdomain =
|
||||
smbuser =
|
||||
smbpassword =
|
||||
|
@ -1,8 +1,3 @@
|
||||
local stdnse = require "stdnse"
|
||||
local smb = require "smb"
|
||||
local smb2 = require "smb2"
|
||||
local msrpc = require "msrpc"
|
||||
local bin = require "bin"
|
||||
local shortport = require "shortport"
|
||||
|
||||
description = [[
|
||||
@ -24,11 +19,16 @@ Return free and total size in octets of each SMB shares
|
||||
---
|
||||
|
||||
categories = {"discovery", "intrusive"}
|
||||
author = "Adrien Malingrey"
|
||||
license = "Same as Nmap--See https://nmap.org/book/man-legal.html"
|
||||
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
|
||||
|
Reference in New Issue
Block a user