Lucene search
K

http-title NSE Script

🗓️ 20 Nov 2010 04:22:51Reported by Diman TodorovType 
nmap
 nmap
🔗 nmap.org👁 2062 Views

http-title NSE Script for web server default page title

Related
Code
ReporterTitlePublishedViews
Family
GithubExploit
Exploit for Code Injection in Samba
2 Dec 202509:55
githubexploit
GithubExploit
Exploit for Code Injection in Samba
25 May 201713:20
githubexploit
GithubExploit
Exploit for Code Injection in Samba
15 May 202106:52
githubexploit
GithubExploit
Exploit for Code Injection in Samba
30 May 201715:08
githubexploit
GithubExploit
Exploit for Code Injection in Samba
25 May 201713:20
githubexploit
GithubExploit
Exploit for CVE-2017-0143
16 May 201719:34
githubexploit
GithubExploit
Exploit for Code Injection in Samba
9 May 202102:32
githubexploit
GithubExploit
Exploit for Code Injection in Samba
5 Jun 201716:25
githubexploit
GithubExploit
Exploit for Code Injection in Samba
26 May 201700:58
githubexploit
GithubExploit
Exploit for Code Injection in Samba
1 Nov 202223:17
githubexploit
Rows per page
local http = require "http"
local shortport = require "shortport"
local stdnse = require "stdnse"
local string = require "string"

description = [[
Shows the title of the default page of a web server.

The script will follow up to 5 HTTP redirects, using the default rules in the
http library.
]]

---
--@args http-title.url The url to fetch. Default: /
--@output
-- Nmap scan report for scanme.nmap.org (74.207.244.221)
-- PORT   STATE SERVICE
-- 80/tcp open  http
-- |_http-title: Go ahead and ScanMe!
--
-- @xmloutput
-- <elem key="title">Go ahead and ScanMe!</elem>
-- @xmloutput
-- <elem key="title">Wikipedia, the free encyclopedia</elem>
-- <elem key="redirect_url">http://en.wikipedia.org/wiki/Main_Page</elem>

author = "Diman Todorov"

license = "Same as Nmap--See https://nmap.org/book/man-legal.html"

categories = {"default", "discovery", "safe"}


portrule = shortport.http

action = function(host, port)
  local resp, redirect_url, title

  resp = http.get( host, port, stdnse.get_script_args(SCRIPT_NAME..".url") or "/" )

  -- check for a redirect
  if resp.location then
    redirect_url = resp.location[#resp.location]
    if resp.status and tostring( resp.status ):match( "30%d" ) then
      return {redirect_url = redirect_url}, ("Did not follow redirect to %s"):format( redirect_url )
    end
  end

  if ( not(resp.body) ) then
    return
  end

  -- try and match title tags
  title = string.match(resp.body, "<[Tt][Ii][Tt][Ll][Ee][^>]*>([^<]*)</[Tt][Ii][Tt][Ll][Ee]>")

  local display_title = title

  if display_title and display_title ~= "" then
    display_title = string.gsub(display_title , "[\n\r\t]", "")
    if #display_title > 65 then
      display_title = string.sub(display_title, 1, 62) .. "..."
    end
  else
    display_title = "Site doesn't have a title"
    if ( resp.header and resp.header["content-type"] ) then
      display_title = display_title .. (" (%s)."):format( resp.header["content-type"] )
    else
      display_title = display_title .. "."
    end
  end

  local output_tab = stdnse.output_table()
  output_tab.title = title
  output_tab.redirect_url = redirect_url

  local output_str = display_title
  if redirect_url then
    output_str = output_str .. "\n" .. ("Requested resource was %s"):format( redirect_url )
  end

  return output_tab, output_str
end

Data

Build on a solid foundation with Vulners data

We provide the essential building blocks for cybersecurity solutions with comprehensive, structured, and constantly updated vulnerability and exploits data

Api

Power your application with Vulners API

The Vulners REST API offers reliable, high-performance access to vulnerability intelligence, with 99.9% SLA uptime and CDN-backed data delivery for seamless global access

App

Assess and manage vulnerabilities with Vulners tools

Built on top of Vulners' database and SDK, end-user solutions give security professionals and developers lightweight and powerful tools for vulnerability remediation

27 Jun 2019 19:13Current
9.3High risk
Vulners AI Score9.3
EPSS0.94176
2062