tis-audit-network-profile icon

Audit Network Profile

Silent install package for Audit Network Profile

1.3.1-6

  • package: tis-audit-network-profile
  • name: Audit Network Profile
  • version: 1.3.1-6
  • categories: Security
  • maintainer: WAPT Team,Tranquil IT,Jimmy PELÉ
  • locale: all
  • target_os: windows
  • architecture: all
  • signature_date:
  • size: 6.60 Ko

package           : tis-audit-network-profile
version           : 1.3.1-6
architecture      : all
section           : base
priority          : optional
name              : Audit Network Profile
categories        : Security
maintainer        : WAPT Team,Tranquil IT,Jimmy PELÉ
description       : Auditing the network connection profile of the connected network cards on Windows and allow WAPT to avoid network issues for users in VPN
depends           : 
conflicts         : 
maturity          : PROD
locale            : all
target_os         : windows
min_wapt_version  : 2.0
sources           : 
installed_size    : 
impacted_process  : 
description_fr    : Audit du profil de connexion réseau des cartes réseaux connectées sous Windows et autorise WAPT à corriger les problèmes réseaux en VPN des utilisateurs.
description_pl    : Audytowanie profilu połączenia sieciowego podłączonych kart sieciowych w systemie Windows i umożliwienie WAPT uniknięcia problemów sieciowych dla użytkowników w VPN
description_de    : Überprüfung des Netzwerkverbindungsprofils der angeschlossenen Netzwerkkarten unter Windows, damit WAPT Netzwerkprobleme für Benutzer im VPN vermeiden kann
description_es    : Auditar el perfil de conexión de red de las tarjetas de red conectadas en Windows y permitir que WAPT evite los problemas de red de los usuarios en la VPN
description_pt    : Auditar o perfil de ligação de rede das placas de rede ligadas no Windows e permitir que o WAPT evite problemas de rede para os utilizadores na VPN
description_it    : Controllare il profilo di connessione di rete delle schede di rete collegate su Windows e consentire a WAPT di evitare problemi di rete per gli utenti in VPN
description_nl    : Controle van het netwerkverbindingsprofiel van de aangesloten netwerkkaarten op Windows en WAPT in staat stellen netwerkproblemen voor gebruikers in VPN te voorkomen
description_ru    : Аудит профиля сетевого подключения подключенных сетевых карт в Windows и позволяет WAPT избежать сетевых проблем для пользователей в VPN
audit_schedule    : 
editor            : 
keywords          : 
licence           : 
homepage          : 
package_uuid      : 2b4e2873-166e-49bf-9ca0-dcb6b1478b9e
valid_from        : 
valid_until       : 
forced_install_on : 
changelog         : 
min_os_version    : 10.0
max_os_version    : 
icon_sha256sum    : 9420721210f5d9c50c9e35c9fdbf0a088b30e165df8311c5f2176ce60e122475
signer            : Tranquil IT
signer_fingerprint: 8c5127a75392be9cc9afd0dbae1222a673072c308c14d88ab246e23832e8c6bb
signature         : IGWJOWUOeAC5R7qyj1jvSsZJfD8LFtfIcYPOhZvChw/l4dKMYhq/+dTSqtqizUTdBRUr7J+Dmg1F9gdcDbJnJAuvofzJ3MYv6QrOOaOvmU86A7W/H/jzcuXA5MdnxuIdFbA/KAtlZgxNsZ51al74Bfxvc6wjLoDema3euCqMSCsSLM5efF+NF+CNHtuL9+AvHjc+HRq9lKgUzyFij/wYu+SQZOT5S8uQXuNV8E6jaSAgakRI0sZuyR8fZmN6cEzJ2S3NFlHnM9QbxI/vjR1AyLt6lrYI7dcXuS5YsHIoN0izwGkfkkaSoP00rwJfyOVbz4hw+pWXPZDmoPKvHvAPCA==
signature_date    : 2022-07-28T03:18:55.792546
signed_attributes : package,version,architecture,section,priority,name,categories,maintainer,description,depends,conflicts,maturity,locale,target_os,min_wapt_version,sources,installed_size,impacted_process,description_fr,description_pl,description_de,description_es,description_pt,description_it,description_nl,description_ru,audit_schedule,editor,keywords,licence,homepage,package_uuid,valid_from,valid_until,forced_install_on,changelog,min_os_version,max_os_version,icon_sha256sum,signer,signer_fingerprint,signature_date,signed_attributes

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

allow_auto_remediation = True


def install():
    pass


def session_setup():
    """
    NetworkCategory:
    Public = 0
    Private = 1
    DomainAuthenticated = 2
    """
    # Getting Network Profile Informations
    net_profiles_data = run_powershell("Get-NetConnectionProfile")
    net_public_interfaces = []

    # Cleaning up the output
    del_elements = [
        "Caption",
        "CimClass",
        "CimInstanceProperties",
        "CimSystemProperties",
        "PSComputerName",
        "InstanceID",
        "IPv4Connectivity",
        "IPv6Connectivity",
        "ElementName",
    ]

    if type(net_profiles_data) == list:
        multiple_interfaces = True
    else:
        multiple_interfaces = False
    if multiple_interfaces:
        for interface in net_profiles_data:
            for elem in list(interface):
                for del_elem in del_elements:
                    if del_elem in elem:
                        del interface[del_elem]
            if interface["NetworkCategory"] == 0:
                interface_data = {
                    "InterfaceAlias": interface["InterfaceAlias"],
                    "InterfaceIndex": interface["InterfaceIndex"],
                    "NetworkCategory": interface["NetworkCategory"],
                }
                net_public_interfaces.append(interface_data)
    else:
        for elem in list(net_profiles_data):
            for del_elem in del_elements:
                if del_elem in elem:
                    del net_profiles_data[del_elem]
        if net_profiles_data["NetworkCategory"] == 0:
            interface_data = {
                "InterfaceAlias": net_profiles_data["InterfaceAlias"],
                "InterfaceIndex": net_profiles_data["InterfaceIndex"],
                "NetworkCategory": net_profiles_data["NetworkCategory"],
            }
            net_public_interfaces.append(interface_data)

    print("Network Profiles result in json format:")
    print(net_profiles_data)
    # json_write_file('net_profiles.json', net_profiles_data)

    if net_public_interfaces != []:
        print("WARNING: At least one network interface is in Public profile, you may need to execute the following command(s):")
        for pub_int in net_public_interfaces:
            print("Set-NetConnectionProfile -InterfaceIndex %s -NetworkCategory %s" % (pub_int["InterfaceIndex"], "Private"))
    else:
        print("OK: Network Interfaces are in correct profile.")


def audit():
    """
    NetworkCategory:
    Public = 0
    Private = 1
    DomainAuthenticated = 2
    """
    # Getting Network Profile Informations
    net_profiles_data = run_powershell("Get-NetConnectionProfile")
    net_public_interfaces = []

    # Cleaning up the output
    del_elements = [
        "Caption",
        "CimClass",
        "CimInstanceProperties",
        "CimSystemProperties",
        "PSComputerName",
        "InstanceID",
        "IPv4Connectivity",
        "IPv6Connectivity",
        "ElementName",
    ]

    if type(net_profiles_data) == list:
        multiple_interfaces = True
    else:
        multiple_interfaces = False
    if multiple_interfaces:
        for interface in net_profiles_data:
            for elem in list(interface):
                for del_elem in del_elements:
                    if del_elem in elem:
                        del interface[del_elem]
            if interface["NetworkCategory"] == 0:
                interface_data = {
                    "InterfaceAlias": interface["InterfaceAlias"],
                    "InterfaceIndex": interface["InterfaceIndex"],
                    "NetworkCategory": interface["NetworkCategory"],
                }
                net_public_interfaces.append(interface_data)
    else:
        for elem in list(net_profiles_data):
            for del_elem in del_elements:
                if del_elem in elem:
                    del net_profiles_data[del_elem]
        if net_profiles_data["NetworkCategory"] == 0:
            interface_data = {
                "InterfaceAlias": net_profiles_data["InterfaceAlias"],
                "InterfaceIndex": net_profiles_data["InterfaceIndex"],
                "NetworkCategory": net_profiles_data["NetworkCategory"],
            }
            net_public_interfaces.append(interface_data)

    print("Network Profiles result in json format:")
    print(net_profiles_data)
    # json_write_file('net_profiles.json', net_profiles_data)

    if allow_auto_remediation:
        if net_public_interfaces != []:
            print("WARNING: At least one network interface is in Public profile, switching it to Private profile...")
            for pub_int in net_public_interfaces:
                WAPT.write_audit_data("audit-network-profile", "auto-remediate-card", pub_int["InterfaceAlias"], keep_days=365)
                print(
                    "Switching Interface: %s (Interface Index: %s) from: Public profile to: Private profile"
                    % (pub_int["InterfaceAlias"], pub_int["InterfaceIndex"])
                )
                print("Set-NetConnectionProfile -InterfaceIndex %s -NetworkCategory %s" % (pub_int["InterfaceIndex"], "Private"))
                run_powershell("Set-NetConnectionProfile -InterfaceIndex %s -NetworkCategory %s" % (pub_int["InterfaceIndex"], "Private"))
            return "WARNING"

    if net_public_interfaces != []:
        print("WARNING: At least one network interface is in Public profile, you may need to execute the following command(s):")
        for pub_int in net_public_interfaces:
            print("Set-NetConnectionProfile -InterfaceIndex %s -NetworkCategory %s" % (pub_int["InterfaceIndex"], "Private"))
        return "WARNING"
    else:
        print("OK: Network Interfaces are in correct profile.")
        return "OK"


def remove_extra_keys(dictionnary, list_keys):
    # .keys() permit to delete dynamicaly values in a dict
    for elem in list(dictionnary):
        for del_elem in list_keys:
            if del_elem in elem:
                del dictionnary[del_elem]
    return dictionnary

dafe93dc68d4b1d6a23694eab8b5ce2ba51a3b8213c859af1c6ebf58b0beeee5 : setup.py
9420721210f5d9c50c9e35c9fdbf0a088b30e165df8311c5f2176ce60e122475 : WAPT/icon.png
a5a97261381e1d0ad46ee15916abec9c2631d0201f5cc50ceb0197a165a0bbbf : WAPT/certificate.crt
70ba3caa31db76c75e8408a81ba64971add92f7a81e282508844d661486128c0 : luti.json
8b24ec17e0c8e696a28009a0423e079017dd6a50f46b43fd032fafe301bd4d4f : WAPT/control