Sha256: 20954f4621775350d84362f993c0f53dd4aecc319f75a2a4af9d58b4ed40c642

Contents?: true

Size: 1.59 KB

Versions: 6

Compression:

Stored size: 1.59 KB

Contents

# frozen_string_literal: true

##
# This file is part of WhatWeb and may be subject to
# redistribution and commercial restrictions. Please see the WhatWeb
# web site for more information on licensing and terms of use.
# http://www.morningstarsecurity.com/research/whatweb
##
# Version 0.2 # 2016-04-20 # Andrew Horton
# Moved patterns from passive function to matches[]
##
WhatWeb::Plugin.define "HP-ProCurve-Switch" do
  @author = "Brendan Coles <bcoles@gmail.com>" # 2011-03-12
  @version = "0.2"
  @description = "HP ProCurve Switch"
  @website = "http://www.hp.com/rnd/"

  # ShodanHQ results as at 2011-03-12 #
  # 10,344 for eHTTP
  #  6,686 for eHTTP -Authenticate
  #  3,370 for eHTTP Authenticate -ProCurve
  #    288 for eHTTP Authenticate ProCurve

  @matches = [
    # HTTP Server Header
    { regexp: /^eHTTP/, search: "headers[server]" },

    # Version Detection
    { version: /^eHTTP v([\d\.]{1,3})$/, search: "headers[server]" },

  ]

  # Passive #
  def passive(target)
    m = []

    # HTTP Server Header
    if /^eHTTP/.match?(target.headers["server"])

      # Model Detection # WWW-Authenticate
      m << { model: target.headers["www-authenticate"].scan(/Basic realm="(HP|ProCurve) ([^"]{6})"/)[0][1] } if target.headers["www-authenticate"] =~ /Basic realm="(HP|ProCurve) ([^"]{6})"/

      # Model Detection # Title
      m << { model: target.body.scan(/<title>[^\(]+ProCurve[^\(]+Switch[^\(]+\((ProCurve )?([^\(]+)\)[^\(]+<\/title>/m)[0][1] } if target.body =~ /<title>[^\(]+ProCurve[^\(]+Switch[^\(]+\((ProCurve )?([^\(]+)\)[^\(]+<\/title>/

    end

    # Return passive matches
    m
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
simple_whatweb-0.4.1 lib/whatweb/plugins/hp-procurve-switch.rb
simple_whatweb-0.4.0 lib/whatweb/plugins/hp-procurve-switch.rb
simple_whatweb-0.3.0 lib/whatweb/plugins/hp-procurve-switch.rb
simple_whatweb-0.2.1 lib/whatweb/plugins/hp-procurve-switch.rb
simple_whatweb-0.2.0 lib/whatweb/plugins/hp-procurve-switch.rb
simple_whatweb-0.1.0 lib/whatweb/plugins/hp-procurve-switch.rb