From 7c833b933e771923e660077cf33bbc9d3b3b233d Mon Sep 17 00:00:00 2001 From: vinamra Date: Fri, 18 Aug 2017 17:20:13 +0000 Subject: [PATCH] Adds Jenkins Server detection. Closes #969 --- CHANGELOG | 3 ++ .../data/http-devframework-fingerprints.lua | 39 +++++++++++++++++++ 2 files changed, 42 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index 1fde6d985..160a78e46 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,8 @@ # Nmap Changelog ($Id$); -*-text-*- +o [NSE] http-devframework-fingerprints.lua supports Jenkins server detection + and returns extra information when Jenkins is detected [Vinamra Bhatia] + o [GH#926] The rarity level of MS SQL's service detection probe was decreased. Now we can find MS SQL in odd ports without increasing version intensity. [Paulino Calderon] diff --git a/nselib/data/http-devframework-fingerprints.lua b/nselib/data/http-devframework-fingerprints.lua index 39ce30ed2..8af0822fb 100644 --- a/nselib/data/http-devframework-fingerprints.lua +++ b/nselib/data/http-devframework-fingerprints.lua @@ -1,5 +1,7 @@ local http = require "http" +local io = require "io" local string = require "string" +local table = require "table" --- -- http-devframework-fingerprints.lua @@ -399,4 +401,41 @@ tools = { Django = { rapidDetect = function(host, port) end }, + Jenkins = { rapidDetect = function(host, port) + + local response = http.get(host, port, "/") + local jenkins = {} + + if response and ( response.status == 200 or response.status == 403 ) then + local header_x_jenkins = response.header['x-jenkins'] + -- Check for 'X-Jenkins' Header + if header_x_jenkins ~= nil then + table.insert(jenkins, "Jenkins detected. Found Jenkins version " .. header_x_jenkins) + if response.header['x-hudson'] ~= nil then + table.insert(jenkins, "X-Hudson : " .. response.header['x-hudson']) + end + if response.header['x-hudson-cli-port'] ~= nil then + table.insert(jenkins, "X-Hudson-CLI-Port : " .. response.header['x-hudson-cli-port']) + end + if response.header['x-jenkins-cli-port'] ~= nil then + table.insert(jenkins, "X-Jenkins-CLI-Port : " .. response.header['x-jenkins-cli-port']) + end + if response.header['x-jenkins-cli2-port'] ~= nil then + table.insert(jenkins, "X-Jenkins-CLI2-Port : " .. response.header['x-jenkins-cli2-port']) + end + if response.header['x-jenkins-session'] ~= nil then + table.insert(jenkins, "X-Jenkins-Session : " .. response.header['x-jenkins-session']) + end + return jenkins + end + end + end, + + consumingDetect = function(page, path) + return + end + }, + } + +