-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwordpress-version-check.nse
54 lines (42 loc) · 1.43 KB
/
wordpress-version-check.nse
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
local nmap = require "nmap"
local shortport = require "shortport"
local http = require "http"
local stdnse = require "stdnse"
local string = require "string"
local table = require "table"
description = [[
Uses provide credentials and logs into a Wordpress site.
Future: Check Wordpress version and check if out of date
]]
---
-- @usage
-- nmap <target> --script=wordpress-version-check
--
-- @output
-- 80/tcp open http
-- | wordpress-version-check:
-- | Current Version: <Version Number>
-- |_ Installed Version: <Installed Version Number>
--
---
author = "Jason Wood"
license = "Same as Nmap--See https://nmap.org/book/man-legal.html"
categories = { "safe" }
portrule = shortport.http
action = function(host,port)
local path = nmap.registry.args.path
if(path == nil) then
path = '/'
end
-- Get the latest version number of wordpress from wordpress.org
local wpresponse = http.get('wordpress.org', 443, '/download')
local wpversion = string.match(wpresponse.body,"Download WordPress (%d+.%d+.?%d*)")
-- Get our installed version of Wordpress
local response = http.get(host, port, path)
local installedversion = string.match(response.body,"WordPress (%d+.%d+.?%d*)")
-- If installedversion is empty, then set it to 'Unknown'
if(installedversion == nil) then
installedversion = 'Unknown'
end
return stdnse.format_output(true, "CurrentVersion: " .. wpversion .. "\nInstalled version: " .. installedversion)
end