Page 1 of 1

Problem Creating Bitdefender Endpoint Package

Published: June 18, 2021 - 6:21 PM
by Remi
Hello everyone,

First of all, being brand new here, if I'm not in the right section or if anything is missing, please excuse me in advance :D

For testing prior to deployment for a client company, I am creating a Bitdefender Gravityzone version package.

Currently, it is possible to launch a classic Windows command-line installation and an uninstallation using a setup obtained from the Bitdefender website and also launched via the command line.

installation line:

Code: Select all

epskit_x64.exe /configure "installer.xml
uninstallation line:

Code: Select all

Best_uninstallTool.exe /bdparams /password=monpassword
Currently, I have managed to get the def install() part of my setup.py working, however I am a little stuck on the procedure for the def uninstall() part.

Here is my setyp.py:

Code: Select all

# -*- coding: utf-8 -*-
from setuphelpers import *

uninstallkey = []

def install():

    if not installed_softwares(u'60c0cf4edc234a6808744eab'):
        print('BitDefender Gravity Zone : Installing...')

        run(u'epskit_x64.exe /configure "installer.xml',timeout=2000,accept_returncodes=[1641,3010,0])

        print('BitDefender Gravity Zone: Installation Complete')
    else:
        print('BitDefender Gravity Zone: Deja installe')

    if not isdir(makepath(programfiles,'Bitdefender','BitdefenderUninstall')):
        mkdirs(makepath(programfiles,'Bitdefender','BitdefenderUninstall'))
        filecopyto('BEST_uninstallTool.exe',makepath(programfiles,'Bitdefender','BitdefenderUninstall'))

def uninstall():

    print('Bitdender Gravity Zone : desinstallation en cours...')

    uninstallstring = ["C:\Program Files\Bitdefender\BitdefenderUninstall\Best_uninstallTool.exe"]

    x = "/bdparams"
    y = "/password=monpassword"

    run(uninstallstring,x,y,timeout=2000,accept_returncodes=[1641,3010,0])

    print('Nettoyage des fichiers de desinstallation.')
    remove_file(makepath(programfiles,'Bitdefender','BitdefenderUninstall','Best_uninstallTool.exe'))

    print('Suppression du dossier.')
    if dir_is_empty(makepath(programfiles,'Bitdefender','BitdefenderUninstall')):
        remove_tree(makepath(programfiles,'Bitdefender','BitdefenderUninstall'))

    print('Bitdefender Gravity Zone : Desinstallation complete')

Regarding the uninstallation process, I'm not quite sure how to add my /params and /password to an uninstallation command. Can `run` do this, or am I doing it completely wrong? ;)

Thank you in advance to the entire community.
Have a good evening and a good weekend :)
Rémi Lhommeau

Re: Bitdefender Endpoint Package Creation Problem

Published: June 21, 2021 - 3:48 PM
by dcardon
Hello Remi,
uninstallstring = ["C:\Program Files\Bitdefender\BitdefenderUninstall\Best_uninstallTool.exe"]
Backslashes are an escape character in Python; you must add an r"" before the string if you do not want it to be interpreted.
Sincerely,
Denis

Re: Bitdefender Endpoint Package Creation Problem

Published: June 21, 2021 - 4:06 PM
by Remi
Hello Denis,

Thank you for the clarification.

If I understand correctly, the command syntax should be as follows:

Code: Select all

uninstallstring = [r"C:\Program Files\Bitdefender\BitdefenderUninstall\Best_uninstallTool.exe"]
Can I add the arguments /bdparams and /password=mypassword like this:

Code: Select all

uninstallstring = [r"C:\Program Files\Bitdefender\BitdefenderUninstall\Best_uninstallTool.exe /bdparams /password=monpassword"]
Or do I need the run command afterwards to incorporate these two arguments?

Best regards,
Rémi

Re: Bitdefender Endpoint Package Creation Problem

Published: June 24, 2021 - 11:48 AM
by Remi
Good morning,

Small update:

I managed to launch the uninstallation command using the following command:

Code: Select all

def uninstall():

    print('Bitdender Gravity Zone : desinstallation en cours...')

    uninstallstring=r'"C:\Program Files\Bitdefender\BitdefenderUninstall\Best_uninstallTool.exe" "/bdparams" "/password=monpassword"'
    run(uninstallstring,timeout=2000,accept_returncodes=[1641,3010,0])

    print('Nettoyage des fichiers de desinstallation.')
    remove_file(makepath(programfiles,'Bitdefender','BitdefenderUninstall','Best_uninstallTool.exe'))

    print('Suppression du dossier.')
    if dir_is_empty(makepath(programfiles,'Bitdefender','BitdefenderUninstall')):
        remove_tree(makepath(programfiles,'Bitdefender','BitdefenderUninstall'))

    print('Bitdefender Gravity Zone : Desinstallation complete')

However, there's a small problem: the `run` command doesn't complete, and I get the following error:

Code: Select all

2021-06-24 11:38:12,991 [waptcore       ] CRITICAL Fatal error in uninstall function: TimeoutExpired: Command '"C:\Program Files\Bitdefender\BitdefenderUninstall\Best_uninstallTool.exe" "/bdparams" "/password=monpassword"' timed out after 2000 seconds with output '''':
Traceback (most recent call last):
  File "C:\Program Files (x86)\wapt\waptpackage.py", line 2928, in call_setup_hook
    hookdata = hook_func()
  File "<string>", line 27, in uninstall
  File "C:\Program Files (x86)\wapt\common.py", line 3705, in run
    return ensure_unicode(setuphelpers.run(*arg, **args))
  File "C:\Program Files (x86)\wapt\setuphelpers_windows.py", line 4014, in run
    raise TimeoutExpired(cmd, ''.join(output), timeout)
waptutils.TimeoutExpired: Command '"C:\Program Files\Bitdefender\BitdefenderUninstall\Best_uninstallTool.exe" "/bdparams" "/password=monpassword"' timed out after 2000 seconds with output ''''
Why doesn't it proceed with deleting the folder and file? I ran the command directly from the command line on the machine and it works fine.

However, my software log shows it's OK:

Code: Select all

2021-06-24 11:04:54.928 007524 [uninstalltoo] [   TRACE] [ryUt::TelemetryApp::AddUtVersion] -> UninstallTool::TelemetryUt::TelemetryApp::AddUtVersion()
2021-06-24 11:04:54.930 007524 [uninstalltoo] [   TRACE] [tryApp::GetProductVersionFromXml]     -> UninstallTool::TelemetryUt::TelemetryApp::GetProductVersionFromXml()
2021-06-24 11:04:54.930 007524 [uninstalltoo] [   TRACE] [tryApp::GetProductVersionFromXml]     <- UninstallTool::TelemetryUt::TelemetryApp::GetProductVersionFromXml() [0]
2021-06-24 11:04:54.930 007524 [uninstalltoo] [   TRACE] [ryUt::TelemetryApp::AddUtVersion] <- UninstallTool::TelemetryUt::TelemetryApp::AddUtVersion() [31]
2021-06-24 11:04:54.931 007524 [uninstalltoo] [   TRACE] [tryApp::AddTelemetryCommonFields] -> UninstallTool::TelemetryUt::TelemetryApp::AddTelemetryCommonFields()
2021-06-24 11:04:54.931 007524 [uninstalltoo] [   TRACE] [TelemetryApp::GetStrValueFromKey]     -> UninstallTool::TelemetryUt::TelemetryApp::GetStrValueFromKey()
2021-06-24 11:04:54.931 007524 [uninstalltoo] [   TRACE] [TelemetryApp::GetStrValueFromKey]     <- UninstallTool::TelemetryUt::TelemetryApp::GetStrValueFromKey() [0]
2021-06-24 11:04:54.931 007524 [uninstalltoo] [   TRACE] [tryApp::GetProductVersionFromXml]     -> UninstallTool::TelemetryUt::TelemetryApp::GetProductVersionFromXml()
2021-06-24 11:04:54.931 007524 [uninstalltoo] [   TRACE] [tryApp::GetProductVersionFromXml]     <- UninstallTool::TelemetryUt::TelemetryApp::GetProductVersionFromXml() [0]
2021-06-24 11:04:54.931 007524 [uninstalltoo] [   TRACE] [tryApp::GetVarsFromServConfigXml]     -> UninstallTool::TelemetryUt::TelemetryApp::GetVarsFromServConfigXml()
2021-06-24 11:04:54.933 007524 [uninstalltoo] [   TRACE] [tryApp::GetVarsFromServConfigXml]     <- UninstallTool::TelemetryUt::TelemetryApp::GetVarsFromServConfigXml() [0]
2021-06-24 11:04:54.933 007524 [uninstalltoo] [   TRACE] [TelemetryApp::GetStrValueFromKey]     -> UninstallTool::TelemetryUt::TelemetryApp::GetStrValueFromKey()
2021-06-24 11:04:54.933 007524 [uninstalltoo] [   TRACE] [TelemetryApp::GetStrValueFromKey]     <- UninstallTool::TelemetryUt::TelemetryApp::GetStrValueFromKey() [0]
2021-06-24 11:04:54.933 007524 [uninstalltoo] [   TRACE] [tryApp::AddTelemetryCommonFields] <- UninstallTool::TelemetryUt::TelemetryApp::AddTelemetryCommonFields() [0]
2021-06-24 11:04:54.933 007524 [uninstalltoo] [   TRACE] [ UninstallToolApp::GetVendorInfo] -> UninstallToolApp::GetVendorInfo()
2021-06-24 11:04:54.933 007524 [UninstallLib] [   TRACE] [      Uninstaller::GetVendorInfo]     -> Uninstaller::GetVendorInfo()
2021-06-24 11:04:54.942 007524 [UninstallLib] [   TRACE] [      Uninstaller::GetVendorInfo]     <- Uninstaller::GetVendorInfo() [0]
2021-06-24 11:04:54.942 007524 [uninstalltoo] [   TRACE] [ UninstallToolApp::GetVendorInfo] <- UninstallToolApp::GetVendorInfo() [0]
2021-06-24 11:04:54.942 007524 [uninstalltoo] [   TRACE] [etryUt::TelemetryApp::AddOptions] -> UninstallTool::TelemetryUt::TelemetryApp::AddOptions()
2021-06-24 11:04:54.943 007524 [uninstalltoo] [   TRACE] [etryUt::TelemetryApp::AddOptions] <- UninstallTool::TelemetryUt::TelemetryApp::AddOptions() [0]
2021-06-24 11:04:54.944 007524 [uninstalltoo] [    INFO] [  UninstallToolApp::ParseCmdLine] Parent process command line: C:\Program Files\Bitdefender\BitdefenderUninstall\Best_uninstallTool.exe /bdparams /password=monpassword 
2021-06-24 11:04:54.944 007524 [uninstalltoo] [   TRACE] [  UninstallToolApp::ParseCmdLine] -> UninstallToolApp::ParseCmdLine()
2021-06-24 11:04:54.944 007524 [uninstalltoo] [ WARNING] [  UninstallToolApp::ParseCmdLine]     user command line: "C:\Windows\TEMP\RarSFX5\uninstalltool.exe" 
2021-06-24 11:04:54.944 007524 [uninstalltoo] [    INFO] [  UninstallToolApp::ParseCmdLine]     command: bdparams forceall password 
2021-06-24 11:04:54.944 007524 [uninstalltoo] [   TRACE] [  UninstallToolApp::ParseCmdLine] <- UninstallToolApp::ParseCmdLine() [0]
2021-06-24 11:04:54.945 007524 [uninstalltoo] [   TRACE] [lToolApp::CallProductUninstaller] -> UninstallToolApp::CallProductUninstaller()
2021-06-24 11:04:54.945 007524 [uninstalltoo] [   TRACE] [ninstallToolApp::GetRegistryInfo]     -> UninstallToolApp::GetRegistryInfo()
2021-06-24 11:04:54.955 007524 [uninstalltoo] [   TRACE] [ninstallToolApp::GetRegistryInfo]     <- UninstallToolApp::GetRegistryInfo() [17]
2021-06-24 11:06:14.123 007524 [uninstalltoo] [    INFO] [lToolApp::CallProductUninstaller]     Uninstall finished successfully.
2021-06-24 11:06:14.124 007524 [uninstalltoo] [   TRACE] [lToolApp::CallProductUninstaller] <- UninstallToolApp::CallProductUninstaller() [79187]
2021-06-24 11:06:14.127 007524 [uninstalltoo] [   TRACE] [TelemetryApp::SendTelemetryEvent] -> UninstallTool::TelemetryUt::TelemetryApp::SendTelemetryEvent()
2021-06-24 11:06:14.127 007524 [uninstalltoo] [   TRACE] [TelemetryApp::SendTelemetryEvent]     Dumped telemetry event data: {"anon_id":"242D4D56-1F91-2586-FD78-3B77EC891074-000C29891074","bd_display_name":"Bitdefender Endpoint Security Tools","bd_locale":"fr-FR","bd_product_version":"7.1.2.33","event_name":"m_tool_ran","event_version":"1.0","exit_code":0,"exit_reason":"success","options":["password"],"sensor_class":"com.bitdefender.epswin","sensor_name":"com.bitdefender.epswin","tool":"uninstallTool","tool_version":"7.1.2.33"}

2021-06-24 11:06:14.230 007524 [uninstalltoo] [    INFO] [ls::ExtractEcReportInfoFromEvent]     Warning: event_time field not specified. Fallback to current time [value = 1624525574230]
2021-06-24 11:06:14.230 007524 [uninstalltoo] [   TRACE] [s::TranslateJsonValueToBdecEvent]     -> TelemetryUtils::TranslateJsonValueToBdecEvent()
2021-06-24 11:06:14.230 007524 [uninstalltoo] [    INFO] [cEventWrapper::~BdecEventWrapper]         GetEventTextA = 0
2021-06-24 11:06:14.231 007524 [uninstalltoo] [    INFO] [cEventWrapper::~BdecEventWrapper]         Event [text = {"anon_id": "no_anon_id_provided", "bd_display_name": "Bitdefender Endpoint Security Tools", "bd_locale": "fr-FR", "bd_product_version": "7.1.2.33", "bd_user_hashed": "UNKNOWN", "bdec_version": "3.0.21.191", "fingerprint": "no_fingerprint_provided", "machine_architecture": "x64", "os_build": "10.0.19043.1052", "os_edition": "Professional", "os_name": "Win 8", "os_product_name": "Windows 10 Enterprise", "os_product_type": "workstation", "os_release": "2009", "os_type": "Windows", "os_version": "10.0.19043", "sensor_name": "com.bitdefender.epswin", "temp_device_id": "UNKNOWN"}]
2021-06-24 11:06:14.231 007524 [uninstalltoo] [   TRACE] [s::TranslateJsonValueToBdecEvent]     <- TelemetryUtils::TranslateJsonValueToBdecEvent() [0]
2021-06-24 11:06:14.890 007524 [uninstalltoo] [    INFO] [cEventWrapper::~BdecEventWrapper]     GetEventTextA = 0
2021-06-24 11:06:14.890 007524 [uninstalltoo] [    INFO] [cEventWrapper::~BdecEventWrapper]     Event [text = {"anon_id": "242D4D56-1F91-2586-FD78-3B77EC891074-000C29891074", "bd_display_name": "Bitdefender Endpoint Security Tools", "bd_locale": "fr-FR", "bd_product_version": "7.1.2.33", "bd_user_hashed": "UNKNOWN", "bdec_version": "3.0.21.191", "event_name": "m_tool_ran", "event_time": 1624525574230, "event_version": "1.0", "exit_code": 0, "exit_reason": "success", "fingerprint": "no_fingerprint_provided", "machine_architecture": "x64", "options": ["password"], "os_build": "10.0.19043.1052", "os_edition": "Professional", "os_name": "Win 8", "os_product_name": "Windows 10 Enterprise", "os_product_type": "workstation", "os_release": "2009", "os_type": "Windows", "os_version": "10.0.19043", "sensor_class": "com.bitdefender.epswin", "sensor_name": "com.bitdefender.epswin", "temp_device_id": "UNKNOWN", "tool": "uninstallTool", "tool_version": "7.1.2.33"}]
2021-06-24 11:06:14.890 007524 [uninstalltoo] [    INFO] [TelemetryApp::SendTelemetryEvent]     TelemetryUtils::SendRawNotification returned: 0.
2021-06-24 11:06:14.890 007524 [uninstalltoo] [   TRACE] [TelemetryApp::SendTelemetryEvent] <- UninstallTool::TelemetryUt::TelemetryApp::SendTelemetryEvent() [766]

Best regards
Rémi

Re: Bitdefender Endpoint Package Creation Problem

Published: July 7, 2021 - 5:29 PM
by dcardon
See forum rules above.

If there's a timeout, it's either because the software takes a very long time to uninstall (unlikely), or because it displayed a popup while waiting for a result. If the timeout occurs in PyScripter without any specific message, it's best to contact the developer. If it occurs when launching through the service, you need to verify that it works correctly under Local System account (see other posts or search online for instructions).

Regards,

Denis

Re: Bitdefender Endpoint Package Creation Problem

Published: September 21, 2021 - 11:23 AM
by Tim
Hi Rémi,

did you finally resolve your removal issue?
I'd like to do the same thing as you and use a WAPT package to install/uninstall Bitdefender. :D