Server : Apache/2.4.18 (Ubuntu) System : Linux canvaswebdesign 3.13.0-71-generic #114-Ubuntu SMP Tue Dec 1 02:34:22 UTC 2015 x86_64 User : oppastar ( 1041) PHP Version : 7.0.33-0ubuntu0.16.04.15 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, Directory : /proc/self/root/usr/share/nmap/scripts/ |
Upload File : |
local http = require "http" local shortport = require "shortport" local stdnse = require "stdnse" local string = require "string" description = [[ Displays the contents of the "generator" meta tag of a web page (default: /) if there is one. ]] author = "Michael Kohl" license = "Same as Nmap--See https://nmap.org/book/man-legal.html" categories = {"default", "discovery", "safe"} --- -- @usage -- nmap --script http-generator [--script-args http-generator.path=<path>,http-generator.redirects=<number>,...] <host> -- -- @output -- PORT STATE SERVICE -- 80/tcp open http -- |_http-generator: TYPO3 4.2 CMS -- 443/tcp open https -- |_http-generator: TYPO3 4.2 CMS -- -- @args http-generator.path Specify the path you want to check for a generator meta tag (default to '/'). -- @args http-generator.redirects Specify the maximum number of redirects to follow (defaults to 3). -- Changelog: -- 2011-12-23 Michael Kohl <citizen428@gmail.com>: -- + Initial version -- 2012-01-10 Michael Kohl <citizen428@gmail.com>: -- + update documentation -- + make pattern case insensitive -- + only follow first redirect -- 2012-01-11 Michael Kohl <citizen428@gmail.com>: -- + more generic pattern -- + simplified matching -- 2012-01-13 Michael Kohl <citizen428@gmail.com>: -- + add http-generator.path argument -- + add http-generator.redirects argument -- + restructure redirect handling -- + improve redirect pattern -- + update documentation -- + add changelog -- 2014-07-29 Fabian Affolter <fabian@affolter-engineering.ch>: -- + update generator pattern portrule = shortport.http action = function(host, port) local response, loc, generator local path = stdnse.get_script_args('http-generator.path') or '/' local redirects = tonumber(stdnse.get_script_args('http-generator.redirects')) or 3 -- Worst case: <meta name=Generator content="Microsoft Word 11"> local pattern = '<meta name=[\"\']?generator[\"\']? content=[\"\']([^\"\']*)[\"\'] ?/?>' -- Make pattern case-insensitive pattern = pattern:gsub("%a", function (c) return string.format("[%s%s]", string.lower(c), string.upper(c)) end) response = http.get(host, port, path, {redirect_ok=redirects}) if ( response and response.body ) then return response.body:match(pattern) end end