[SOLVED]Cisco Immunet antivirus

Questions about WAPT Packaging / Requests and help regarding Wapt packages.
Forum Rules
Community Forum Rules
* English support on www.reddit.com/r/wapt
* French community support is available on this forum
* Please prefix the topic title with [RESOLVED] if it is resolved.
* Please do not edit a topic that is tagged [RESOLVED]. Open a new topic referencing the old one.
* Specify the installed WAPT version, full version, and build number (2.2.1.11957 / 2.2.2.12337 / etc.) as well as the Enterprise/Discovery edition.
* Versions 1.8.2 and earlier are no longer supported. The only questions accepted regarding version 1.8.2 are related to upgrading to a supported version (2.1, 2.2, etc.).
* Specify the server OS (Linux/Windows) and version (Debian Buster/Bullseye - CentOS 7 - Windows Server 2012/2016/2019).
* Specify the OS of the administration/package creation machine and the machine with the problematic agent, if applicable (Windows 7/10/11/Debian 11/etc.).
* Avoid asking multiple questions when opening a topic, otherwise it may be ignored. If there are multiple topics, open separate topics, preferably one after the other and not all at the same time (i.e., do not spam the forum).
* Include code snippets, screenshots, and other images directly in the post. Links to Pastebin, Bitly, and other third-party sites will be systematically removed.
* As with any community forum, support is provided voluntarily by members. If you require commercial support, you can contact Tranquil IT's sales department at 02.40.97.57.55
Locked
nliaudat
Messages: 29
Registration: August 8, 2019 - 8:31 AM

October 23, 2019 - 4:09 PM

Working sample to deploy and add exclusions for free Immunet antivirus

setup.py

Code: Select all

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

uninstallkey = []

config_path = makepath(programfiles,'Immunet','local.xml')

def install():
    print('installing %s' % control.asrequirement())


    install_exe_if_needed("ImmunetSetup.exe",'/S',key='',min_version='7.0.0',accept_returncodes=[0,1638])



def uninstall():
    print('uninstalling %s' % control.asrequirement())
    #not a silent uninstaller => manual command
    run(r'"C:\Program Files\Immunet\7.0.0\uninstall.exe" /S /remove 1')

def session_setup():
    print('Session setup for %s' % control.asrequirement())

    #can be run under session setup cause user has permission to write
    update_config()


def update_package():
    print('Update package content from upstream binary sources')


def audit():
    print('Auditing %s' % control.asrequirement())



def update_config():

    import xml.etree.ElementTree as etree

    config = etree.parse(config_path)

    '''
<config>
  <exclusions>
   <info>
    <item>256|3|0|1|.dwg</item>
    <item>256|3|0|1|.dxf</item>
    <item>256|2|1|0|C:\Program Files (x86)\wapt\</item>
    <item>256|2|1|0|C:\powerplan</item>
    <item>256|1|0|0|toolbox.exe</item>
   </info>
  </exclusions>
  '''
    exclusions = config.find('exclusions/info')


    items = []

    dwg = dxf = wapt = need_write = False

    for item in exclusions.iter():
        #list all items
        if item.text:
            if len(item.text.split()) > 0:
                items.append(item.text)
        if item.text.find('.dwg') > 0: #dwg is found
            dwg = True
        if item.text.find('.dxf') > 0:
            dxf = True
        if item.text.find('wapt') > 0:
            wapt = True


    #print(items)

    if dwg == False :
        dwg = etree.SubElement(exclusions, 'item')
        dwg.text = '256|3|0|1|.dwg'
        print('add .dwg exclusion')
        need_write = True

    if dxf == False :
        dxf = etree.SubElement(exclusions, 'item')
        dxf.text = '256|3|0|1|.dxf'
        print('add .dxf exclusion')
        need_write = True

    if wapt == False :
        wapt = etree.SubElement(exclusions, 'item')
        wapt.text = '256|2|1|0|C:\\Program Files (x86)\\wapt\\'
        print('add wapt exclusion')
        need_write = True

    if need_write == True:
        config.write(config_path)


    '''
<scansettings>
    <clamav>
     <options>
      <ondemand>
       <scanarchives>1</scanarchives>
       <scanpacked>1</scanpacked>
      </ondemand>
     </options>
    </clamav>
    <tetra>
     <options>
      <ondemand>
       <scanarchives>1</scanarchives>
       <scanpacked>1</scanpacked>
      </ondemand>
     </options>
    </tetra>
   </scansettings>

  '''

Locked