BullGuard Internet Security Version Detection (Windows)

2015-02-23T00:00:00
ID OPENVAS:1361412562310805286
Type openvas
Reporter Copyright (C) 2015 Greenbone Networks GmbH
Modified 2017-05-04T00:00:00

Description

Detection of installed version of BullGuard Internet Security.

The script logs in via smb, searches for

                                        
                                            ###############################################################################
# OpenVAS Vulnerability Test
# $Id: gb_bullguard_internet_security_detect.nasl 6065 2017-05-04 09:03:08Z teissa $
#
# BullGuard Internet Security Version Detection (Windows)
#
# Authors:
# Shakeel <bshakeel@secpod.com>
#
# Copyright:
# Copyright (C) 2015 Greenbone Networks GmbH, http://www.greenbone.net
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2
# (or any later version), as published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
###############################################################################

if(description)
{
  script_oid("1.3.6.1.4.1.25623.1.0.805286");
  script_version("$Revision: 6065 $");
  script_tag(name:"cvss_base", value:"0.0");
  script_tag(name:"cvss_base_vector", value:"AV:N/AC:L/Au:N/C:N/I:N/A:N");
  script_tag(name:"last_modification", value:"$Date: 2017-05-04 11:03:08 +0200 (Thu, 04 May 2017) $");
  script_tag(name:"creation_date", value:"2015-02-23 13:54:02 +0530 (Mon, 23 Feb 2015)");
  script_name("BullGuard Internet Security Version Detection (Windows)");

  script_tag(name: "summary" , value: "Detection of installed version of
  BullGuard Internet Security.

  The script logs in via smb, searches for 'BullGuard Internet Security' in the
  registry, gets installation path from the registry and then reads version
  information from 'version.txt' text file.");

  script_tag(name:"qod_type", value:"registry");

  script_category(ACT_GATHER_INFO);
  script_copyright("Copyright (C) 2015 Greenbone Networks GmbH");
  script_family("Product detection");
  script_dependencies("secpod_reg_enum.nasl", "smb_reg_service_pack.nasl");
  script_mandatory_keys("SMB/WindowsVersion", "SMB/Windows/Arch");
  script_require_ports(139, 445);
  exit(0);
}


include("smb_nt.inc");
include("secpod_smb_func.inc");
include("cpe.inc");
include("host_details.inc");
include("version_func.inc");

## variable Initialization
os_arch = "";
bgPath = "";
bgName = "";
bgVer = "";
key = "";

## Get OS Architecture
os_arch = get_kb_item("SMB/Windows/Arch");
if(!os_arch){
  exit(-1);
}

##Confirm Application
if(!registry_key_exists(key:"SOFTWARE\BullGuard Ltd.")){
  exit(0);
}

## Key is same for 32 bit and 64 bit platform for bullguard
key = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\BullGuard";
if(!registry_key_exists(key:key)){
  exit(0);
}

##Grep for app Name
bgName = registry_get_sz(key:key, item:"DisplayName");

##Confirm Application
if("BullGuard Internet Security" >< bgName)
{
  ##Get Installation Path
  bgPath = registry_get_sz(key:key, item:"InstallLocation");

  if(bgPath)
  {
    ##Read version from file
    bgfile = bgPath + "\version.txt";

    share = ereg_replace(pattern:"([A-Z]):.*", replace:"\1$", string:bgfile);
    file = ereg_replace(pattern:"[A-Z]:(.*)", replace:"\1", string:bgfile);
    txtRead = read_file(share:share, file:file, offset:0, count:50);

    bgVer = eregmatch(pattern:"^([0-9.]+)", string:txtRead);
    bgVer = bgVer[1];

    if(bgVer)
    {
      ##Set version in KB
      set_kb_item(name:"BullGuard/Internet/Security/Ver", value:bgVer);

      ## Build CPE
      cpe = build_cpe(value:bgVer, exp:"^([0-9.]+)", base:"cpe:/a:bullguard:internet_security:");
      if(isnull(cpe))
        cpe = 'cpe:/a:bullguard:internet_security';

      ## Register for 64 bit app on 64 bit OS once again
      if("64" >< os_arch)
      {
        set_kb_item(name:"BullGuard/Internet/Security64/Ver", value:bgVer);

        ## Build CPE
        cpe = build_cpe(value:bgVer, exp:"^([0-9.]+)", base:"cpe:/a:bullguard:internet_security:x64:");
        if(isnull(cpe))
          cpe = "cpe:/a:bullguard:internet_security:x64";

      }
      ##register cpe
      register_product(cpe:cpe, location:bgPath);
      log_message(data: build_detection_report(app: bgName,
                                               version: bgVer,
                                               install: bgPath,
                                               cpe: cpe,
                                               concluded: bgVer));
    } 
  }
}