Dre4m Shell
Server IP : 85.214.239.14  /  Your IP : 13.58.232.94
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_psexec.ps1
#!powershell

# Copyright: (c) 2017, Dag Wieers (@dagwieers) <dag@wieers.com>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)

#AnsibleRequires -CSharpUtil Ansible.Basic
#Requires -Module Ansible.ModuleUtils.ArgvParser
#Requires -Module Ansible.ModuleUtils.CommandUtil

# See also: https://technet.microsoft.com/en-us/sysinternals/pxexec.aspx

$spec = @{
    options = @{
        command = @{ type = 'str'; required = $true }
        executable = @{ type = 'path'; default = 'psexec.exe' }
        hostnames = @{ type = 'list'; elements = 'str' }
        username = @{ type = 'str' }
        password = @{ type = 'str'; no_log = $true }
        chdir = @{ type = 'path' }
        wait = @{ type = 'bool'; default = $true }
        nobanner = @{ type = 'bool'; default = $false }
        noprofile = @{ type = 'bool'; default = $false }
        elevated = @{ type = 'bool'; default = $false }
        limited = @{ type = 'bool'; default = $false }
        system = @{ type = 'bool'; default = $false }
        interactive = @{ type = 'bool'; default = $false }
        session = @{ type = 'int' }
        priority = @{ type = 'str'; choices = @( 'background', 'low', 'belownormal', 'abovenormal', 'high', 'realtime' ) }
        timeout = @{ type = 'int' }
    }
}

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

$command = $module.Params.command
$executable = $module.Params.executable
$hostnames = $module.Params.hostnames
$username = $module.Params.username
$password = $module.Params.password
$chdir = $module.Params.chdir
$wait = $module.Params.wait
$nobanner = $module.Params.nobanner
$noprofile = $module.Params.noprofile
$elevated = $module.Params.elevated
$limited = $module.Params.limited
$system = $module.Params.system
$interactive = $module.Params.interactive
$session = $module.Params.session
$priority = $module.Params.Priority
$timeout = $module.Params.timeout

$module.Result.changed = $true

If (-Not (Get-Command $executable -ErrorAction SilentlyContinue)) {
    $module.FailJson("Executable '$executable' was not found.")
}

$arguments = [System.Collections.Generic.List`1[String]]@($executable)

If ($nobanner -eq $true) {
    $arguments.Add("-nobanner")
}

# Support running on local system if no hostname is specified
If ($hostnames) {
    $hostname_argument = ($hostnames | Sort-Object  -Unique) -join ','
    $arguments.Add("\\$hostname_argument")
}

# Username is optional
If ($null -ne $username) {
    $arguments.Add("-u")
    $arguments.Add($username)
}

# Password is optional
If ($null -ne $password) {
    $arguments.Add("-p")
    $arguments.Add($password)
}

If ($null -ne $chdir) {
    $arguments.Add("-w")
    $arguments.Add($chdir)
}

If ($wait -eq $false) {
    $arguments.Add("-d")
}

If ($noprofile -eq $true) {
    $arguments.Add("-e")
}

If ($elevated -eq $true) {
    $arguments.Add("-h")
}

If ($system -eq $true) {
    $arguments.Add("-s")
}

If ($interactive -eq $true) {
    $arguments.Add("-i")
    If ($null -ne $session) {
        $arguments.Add($session)
    }
}

If ($limited -eq $true) {
    $arguments.Add("-l")
}

If ($null -ne $priority) {
    $arguments.Add("-$priority")
}

If ($null -ne $timeout) {
    $arguments.Add("-n")
    $arguments.Add($timeout)
}

$arguments.Add("-accepteula")

$argument_string = Argv-ToString -arguments $arguments

# Add the command at the end of the argument string, we don't want to escape
# that as psexec doesn't expect it to be one arg
$argument_string += " $command"

$start_datetime = [DateTime]::UtcNow

# Replace password with *PASSWORD_REPLACED* to avoid disclosing sensitive data
$toLog = $argument_string
if ($password) {
    $maskedPassword = Argv-ToString $password
    $toLog = $toLog.Replace($maskedPassword, "*PASSWORD_REPLACED*")
}

$module.Result.psexec_command = $toLog

$command_result = Run-Command -command $argument_string

$end_datetime = [DateTime]::UtcNow

$module.Result.stdout = $command_result.stdout
$module.Result.stderr = $command_result.stderr

If ($wait -eq $true) {
    $module.Result.rc = $command_result.rc
}
else {
    $module.Result.rc = 0
    $module.Result.pid = $command_result.rc
}

$module.Result.start = $start_datetime.ToString("yyyy-MM-dd hh:mm:ss.ffffff")
$module.Result.end = $end_datetime.ToString("yyyy-MM-dd hh:mm:ss.ffffff")
$module.Result.delta = $($end_datetime - $start_datetime).ToString("h\:mm\:ss\.ffffff")

$module.ExitJson()

Anon7 - 2022
AnonSec Team