# 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 # # Updated regex ## WhatWeb::Plugin.define "Microsoft-Office-XML" do @author = "Brendan Coles " # 2010-10-14 @version = "0.2" @description = "This module detects instances of Microsoft Office documents saved as HTML and attempts to extract the user name, company name and office version." @website = "http://en.wikipedia.org/wiki/Microsoft_Office_XML_formats" # About 123,000 results for @ 2010-10-14 # Extract version, usernames and company def passive(target) m = [] # Excel if target.body =~ // || target.body =~ // # Get version if /([^<]+)<\/Version>/.match?(target.body) version = target.body.scan(/([^<]+)<\/Version>/) m << { version: "Excel " + version } end # Get company if /([^<]+)<\/Company>/.match?(target.body) accounts = target.body.scan(/([^<]+)<\/Company>/)[0][0] m << { account: "Company:" + accounts } end # Get usernames if /([^<]+)<\/Author>/.match?(target.body) accounts = target.body.scan(/([^<]+)<\/Author>/)[0][0] m << { account: accounts } end if /([^<]+)<\/LastAuthor>/.match?(target.body) accounts = target.body.scan(/([^<]+)<\/LastAuthor>/)[0][0] m << { account: accounts } end end # Word if target.body =~ // || target.body =~ // # Get version if /([^<]+)<\/o:Version>/.match?(target.body) version = target.body.scan(/([^<]+)<\/o:Version>/)[0][0] m << { version: "Word " + version } end # Get company if /([^<]+)<\/o:Company>/.match?(target.body) accounts = target.body.scan(/([^<]+)<\/o:Company>/)[0][0] m << { account: "Company:" + accounts } end # Get usernames if /([^<]+)<\/o:Author>/.match?(target.body) accounts = target.body.scan(/([^<]+)<\/o:Author>/)[0][0] m << { account: accounts } end if /([^<]+)<\/o:LastAuthor>/.match?(target.body) accounts = target.body.scan(/([^<]+)<\/o:LastAuthor>/)[0][0] m << { account: accounts } end end # Core document properties if /([^<]+)<\/creator>/.match?(target.body) accounts = target.body.scan(/([^<]+)<\/creator>/)[0][0] m << { account: accounts } end if /([^<]+)<\/creator>/.match?(target.body) accounts = target.body.scan(/([^<]+)<\/creator>/)[0][0] m << { account: accounts } end # Get company if /([^<]+)<\/Company>/.match?(target.body) accounts = target.body.scan(/([^<]+)<\/Company>/)[0][0] m << { account: "Company:" + accounts } end # Get version if /([^<]+)<\/AppVersion>/.match?(target.body) version = target.body.scan(/([^<]+)<\/AppVersion>/)[0][0] m << { version: version } end end m end end