tis-adwcleaner

8.3.2-3
AdwCleaner is a free software program that allows you to detect and clean unwanted software such as adware, toolbars, browser hijackers and potentially unwanted programs
3455 downloads
Download
View on luti logo
tis-adwcleaner icon

  Description 

  • package : tis-adwcleaner
  • version : 8.3.2-3
  • architecture : all
  • categories : Utilities,Security
  • maintainer : WAPT Team,Tranquil IT,Gaëtan SEGAT
  • description : AdwCleaner is a free software program that allows you to detect and clean unwanted software such as adware, toolbars, browser hijackers and potentially unwanted programs
  • locale : all
  • target_os : windows
  • min_wapt_version : 2.0
  • sources : https://malwarebytes.com/adwcleaner/
  • installed_size : 8544256
  • impacted_process : adwcleaner
  • description_fr : AdwCleaner est un logiciel gratuit qui vous permet de détecter et de nettoyer les logiciels indésirables tels que les logiciels publicitaires, les barres d'outils, les pirates de navigateur et les programmes potentiellement indésirables
  • description_pl :
  • description_de :
  • description_es :
  • description_pt :
  • description_it :
  • description_nl :
  • description_ru :
  • editor : Malwarebytes
  • licence : Freeware
  • signature_date : 2022-05-07T01:07:24.832541
  • Homepage : https://malwarebytes.com/adwcleaner/

  Setup.py 

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

r"""
Usable WAPT package functions: install(), uninstall(), session_setup(), audit(), update_package()

"""
# Declaring global variables - Warnings: 1) WAPT context is only available in package functions; 2) Global variables are not persistent between calls
bin_contain = "adwcleaner_%s.exe"
app_name = "AdwCleaner"
app_dir = makepath(programfiles32, app_name)


def install():
    # Declaring local variables
    package_version = control.get_software_version()
    bin_name = bin_contain % package_version
    app_path = makepath(app_dir, bin_name)
    # Getting installed software version
    if isfile(app_path):
        installed_version = get_version_from_binary(app_path, property_name="FileVersion")
    else:
        installed_version = None

    # Installing software
    print("Installing: %s" % app_name)
    if installed_version is None or installed_version < package_version or force:
        killalltasks(control.get_impacted_process_list())
        mkdirs(app_dir)
        if isfile(app_path):
            remove_file(app_path)
        print("Copying: %s to: %s" % (bin_name, app_dir))
        filecopyto(bin_name, app_dir)

        # Creating shortcuts
        create_desktop_shortcut(app_name, app_path)
        create_programs_menu_shortcut(app_name, app_path)

        # Adding software to "list-registry"
        print("Registering %s to Windows Registry" % app_name)
        register_windows_uninstall(control, win64app=False)
        register_uninstall(app_name, icon=app_path)
    else:
        print("%s already installed. Skipping" % app_name)


def uninstall():
    # Uninstalling software
    killalltasks(control.get_impacted_process_list())
    if isdir(app_dir):
        remove_tree(app_dir)
    unregister_uninstall(app_name)

    # Removing shortcuts
    remove_desktop_shortcut(app_name)
    remove_programs_menu_shortcut(app_name)


def audit():
    # Declaring local variables
    package_version = control.get_software_version()
    bin_name = bin_contain % package_version
    app_path = makepath(app_dir, bin_name)
    # Getting installed software version
    if isfile(app_path):
        installed_version = get_version_from_binary(app_path, property_name="FileVersion")
    else:
        installed_version = None

    # Auditing software
    print("Auditing: %s" % control.package)
    if installed_version is None or installed_version < package_version:
        print("%s version is incorrect (%s)" % (app_name, installed_version))
        return "ERROR"
    else:
        print("%s is installed in correct version (%s)" % (app_name, installed_version))
        return "OK"


def update_package():
    # Declaring local variables
    result = False
    proxies = get_proxies()
    if not proxies:
        proxies = get_proxies_from_wapt_console()
    download_url = "https://downloads.malwarebytes.com/file/adwcleaner"

    # Getting latest version information from download url
    last_version = requests.head(download_url, allow_redirects=True).headers["Content-Disposition"]
    version = last_version.split("_")[-1].split(".exe")[0]

    bin_name = bin_contain % version

    print("Latest %s version is: %s" % (app_name, version))
    print("Download url is: %s" % download_url)

    # Downloading latest binaries
    if not isfile(bin_name):
        print("Downloading: %s" % bin_name)
        wget(download_url, bin_name, proxies=proxies)

        # Checking version from file
        version_from_file = get_version_from_binary(bin_name, property_name="FileVersion")
        if not version_from_file.startswith(version) and version_from_file != "":
            print("Changing version to the version number of the binary")
            version = version_from_file
        else:
            print("Binary file version corresponds to online version")

    # Changing version of the package
    if Version(version) > Version(control.get_software_version()):
        print("Software version updated (from: %s to: %s)" % (control.get_software_version(), Version(version)))
        result = True
    else:
        print("Software version up-to-date (%s)" % Version(version))
    control.version = "%s-%s" % (Version(version), control.version.split("-", 1)[-1])
    control.save_control_to_wapt()

    # Validating update-package-sources
    return result


def get_proxies():
    r"""Return system proxy with the urllib python library

    >>> get_proxies()
    {'http': 'http://srvproxy.ad.domain.lan:8080',
    'https': 'http://srvproxy.ad.domain.lan:8080'}

    """
    if platform.python_version_tuple()[0] == "3":
        from urllib.request import getproxies
    else:
        from urllib import getproxies
    return getproxies()


def get_proxies_from_wapt_console():
    r"""Return proxy information from the current user WAPT console

    >>> get_proxies_from_wapt_console()
    {'http': 'http://srvproxy.ad.domain.lan:8080',
    'https': 'http://srvproxy.ad.domain.lan:8080'}

    """
    proxies = {}
    if platform.system() == "Windows":
        waptconsole_ini_path = makepath(user_local_appdata(), "waptconsole", "waptconsole.ini")
    else:
        waptconsole_ini_path = makepath(user_home_directory(), ".config", "waptconsole", "waptconsole.ini")
    if isfile(waptconsole_ini_path):
        proxy_wapt = inifile_readstring(waptconsole_ini_path, "global", "http_proxy")
        if proxy_wapt:
            proxies = {"http": proxy_wapt, "https": proxy_wapt}
    return proxies


def get_version_from_binary(filename, property_name="ProductVersion"):
    r"""Get installer version from file informations, for now, only exe and msi files are compatibles

    Args:
        filename (str): path to the file
        property_name (str): selected property

    Returns:
        str: version number

    """
    if filename.endswith(".msi"):
        return get_msi_properties(filename)[property_name]
    else:
        return get_file_properties(filename)[property_name]


def remove_outdated_binaries(version, filename_contains=None, list_extensions=["exe", "msi", "deb", "rpm", "dmg", "pkg"]):
    r"""Remove files based on the version contained in his filename

    Args:
        version (str): version number of keeped files
        filename_contains (str or list of str): Part of the filename that must be contained (useful for distinguishing architecture and os)
        list_extensions (str or list of str): file extensions of verified files

    Returns:
        None

    .. versionadded:: 2.0

    """
    if type(list_extensions) != list:
        list_extensions = [list_extensions]
    if filename_contains:
        if type(filename_contains) != list:
            filename_contains = [filename_contains]
    list_extensions = ["." + ext for ext in list_extensions if ext[0] != "."]
    for file_ext in list_extensions:
        for bin_in_dir in glob.glob("*%s" % file_ext):
            if not version in bin_in_dir:
                remove_file(bin_in_dir)
            if filename_contains:
                for filename_contain in filename_contains:
                    if not filename_contain in bin_in_dir:
                        remove_file(bin_in_dir)

										

  Changelog 



8.3.1-3
Improve the package code
									
  manifest.sha256