Downloads:

105,256

Downloads of v 1.1.1:

4,964

Last Update:

12 Mar 2022

Package Maintainer(s):

Software Author(s):

  • Gerardo Grignoli

Tags:

sudo for windows run elevated user command runas powershell wsl

gsudo - a sudo for windows

This is not the latest version of gsudo - a sudo for windows available.

  • 1
  • 2
  • 3

1.1.1 | Updated: 12 Mar 2022

Downloads:

105,256

Downloads of v 1.1.1:

4,964

Maintainer(s):

Software Author(s):

  • Gerardo Grignoli

  • 1
  • 2
  • 3
gsudo - a sudo for windows 1.1.1

This is not the latest version of gsudo - a sudo for windows available.

  • 1
  • 2
  • 3

Some Checks Have Failed or Are Not Yet Complete

Not All Tests Have Passed


Validation Testing Passed


Verification Testing Passed

Details

Scan Testing Resulted in Flagged as a Note:

At least one file within this package has greater than 0 detections, but less than 5

Details
Learn More

Deployment Method: Individual Install, Upgrade, & Uninstall

To install gsudo - a sudo for windows, run the following command from the command line or from PowerShell:

>

To upgrade gsudo - a sudo for windows, run the following command from the command line or from PowerShell:

>

To uninstall gsudo - a sudo for windows, run the following command from the command line or from PowerShell:

>

Deployment Method:

📝 NOTE: This applies to both open source and commercial editions of Chocolatey.

1. Enter Your Internal Repository Url

(this should look similar to https://community.chocolatey.org/api/v2/)


2. Setup Your Environment

1. Ensure you are set for organizational deployment

Please see the organizational deployment guide

2. Get the package into your environment

  • Open Source or Commercial:
    • Proxy Repository - Create a proxy nuget repository on Nexus, Artifactory Pro, or a proxy Chocolatey repository on ProGet. Point your upstream to https://community.chocolatey.org/api/v2/. Packages cache on first access automatically. Make sure your choco clients are using your proxy repository as a source and NOT the default community repository. See source command for more information.
    • You can also just download the package and push it to a repository Download

3. Copy Your Script

choco upgrade gsudo -y --source="'INTERNAL REPO URL'" --version="'1.1.1'" [other options]

See options you can pass to upgrade.

See best practices for scripting.

Add this to a PowerShell script or use a Batch script with tools and in places where you are calling directly to Chocolatey. If you are integrating, keep in mind enhanced exit codes.

If you do use a PowerShell script, use the following to ensure bad exit codes are shown as failures:


choco upgrade gsudo -y --source="'INTERNAL REPO URL'" --version="'1.1.1'" 
$exitCode = $LASTEXITCODE

Write-Verbose "Exit code was $exitCode"
$validExitCodes = @(0, 1605, 1614, 1641, 3010)
if ($validExitCodes -contains $exitCode) {
  Exit 0
}

Exit $exitCode

- name: Install gsudo
  win_chocolatey:
    name: gsudo
    version: '1.1.1'
    source: INTERNAL REPO URL
    state: present

See docs at https://docs.ansible.com/ansible/latest/modules/win_chocolatey_module.html.


chocolatey_package 'gsudo' do
  action    :install
  source   'INTERNAL REPO URL'
  version  '1.1.1'
end

See docs at https://docs.chef.io/resource_chocolatey_package.html.


cChocoPackageInstaller gsudo
{
    Name     = "gsudo"
    Version  = "1.1.1"
    Source   = "INTERNAL REPO URL"
}

Requires cChoco DSC Resource. See docs at https://github.com/chocolatey/cChoco.


package { 'gsudo':
  ensure   => '1.1.1',
  provider => 'chocolatey',
  source   => 'INTERNAL REPO URL',
}

Requires Puppet Chocolatey Provider module. See docs at https://forge.puppet.com/puppetlabs/chocolatey.


4. If applicable - Chocolatey configuration/installation

See infrastructure management matrix for Chocolatey configuration elements and examples.

This package was approved as a trusted package on 14 Mar 2022.

Description

gsudo allows to run commands with elevated permissions within the current console.
It is a sudo equivalent for Windows, with a similar user-experience as the original *nix sudo.

Elevated commands are shown in the caller (non-elevated) console, no switching to another console required.

http://github.com/gerardog/gsudo

Usage

gsudo [command] [arguments]
Executes the specified command, elevated, and returns.

Examples

gsudo notepad c:\Windows\System32\drivers\etc\hosts
gsudo cmd


bin\gsudo
 
bin\gsudo.exe
md5: ABBCFDCAE70471B03D77F976788335C7 | sha1: B0234831678C44433034C0DBF4372C2D2880D4AC | sha256: 77CA409679ADA9FDA70CA297966274D9A8DEB876B2A1F2E2629FE61559D72533 | sha512: 1E1EA457DF50532CAA3B3DEE8ED7CA68BD1B0C35F600B7FE6E30DBEDCC16CDAC4C14219AB1B4FE85AD296049F3FD739DF4AFD6DB4A0688294BD82D39A2AAA6D1
bin\gsudo.exe.ignore
 
bin\gsudoModule.psd1
#
# Module manifest for module 'gsudoModule'
#
# Generated by: Gerardo Grignoli
#
# Generated on: 2/1/2022
#

@{

# Script module or binary module file associated with this manifest.
RootModule = 'gsudoModule.psm1'

# Version number of this module.
ModuleVersion = "1.1.1"

# Supported PSEditions
# CompatiblePSEditions = @()

# ID used to uniquely identify this module
GUID = 'c50a89c0-75c0-4b08-8dac-473404b73379'

# Author of this module
Author = 'Gerardo Grignoli'

# Company or vendor of this module
CompanyName = 'gsudo'

# Copyright statement for this module
Copyright = '(c) Gerardo Grignoli. All rights reserved.'

# Description of the functionality provided by this module
# Description = ''

# Minimum version of the PowerShell engine required by this module
# PowerShellVersion = ''

# Name of the PowerShell host required by this module
# PowerShellHostName = ''

# Minimum version of the PowerShell host required by this module
# PowerShellHostVersion = ''

# Minimum version of Microsoft .NET Framework required by this module. This prerequisite is valid for the PowerShell Desktop edition only.
# DotNetFrameworkVersion = ''

# Minimum version of the common language runtime (CLR) required by this module. This prerequisite is valid for the PowerShell Desktop edition only.
# ClrVersion = ''

# Processor architecture (None, X86, Amd64) required by this module
# ProcessorArchitecture = ''

# Modules that must be imported into the global environment prior to importing this module
# RequiredModules = @()

# Assemblies that must be loaded prior to importing this module
# RequiredAssemblies = @()

# Script files (.ps1) that are run in the caller's environment prior to importing this module.
# ScriptsToProcess = @()

# Type files (.ps1xml) to be loaded when importing this module
# TypesToProcess = @()

# Format files (.ps1xml) to be loaded when importing this module
# FormatsToProcess = @()

# Modules to import as nested modules of the module specified in RootModule/ModuleToProcess
# NestedModules = @()

# Functions to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no functions to export.
FunctionsToExport = 'gsudo', 'invoke-gsudo'

# Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export.
CmdletsToExport = @()

# Variables to export from this module
VariablesToExport = 'gsudoVerbose'

# Aliases to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no aliases to export.
AliasesToExport = @()

# DSC resources to export from this module
# DscResourcesToExport = @()

# List of all modules packaged with this module
# ModuleList = @()

# List of all files packaged with this module
# FileList = @()

# Private data to pass to the module specified in RootModule/ModuleToProcess. This may also contain a PSData hashtable with additional module metadata used by PowerShell.
PrivateData = @{

    PSData = @{

        # Tags applied to this module. These help with module discovery in online galleries.
        # Tags = @()

        # A URL to the license for this module.
        # LicenseUri = ''

        # A URL to the main website for this project.
        # ProjectUri = ''

        # A URL to an icon representing this module.
        # IconUri = ''

        # ReleaseNotes of this module
        # ReleaseNotes = ''

        # Prerelease string of this module
        # Prerelease = ''

        # Flag to indicate whether the module requires explicit user acceptance for install/update/save
        # RequireLicenseAcceptance = $false

        # External dependent modules of this module
        # ExternalModuleDependencies = @()

    } # End of PSData hashtable

} # End of PrivateData hashtable

# HelpInfo URI of this module
# HelpInfoURI = ''

# Default prefix for commands exported from this module. Override the default prefix using Import-Module -Prefix.
# DefaultCommandPrefix = ''

}


# SIG # Begin signature block
# MIIk+gYJKoZIhvcNAQcCoIIk6zCCJOcCAQExDzANBglghkgBZQMEAgEFADB5Bgor
# BgEEAYI3AgEEoGswaTA0BgorBgEEAYI3AgEeMCYCAwEAAAQQH8w7YFlLCE63JNLG
# KX7zUQIBAAIBAAIBAAIBAAIBADAxMA0GCWCGSAFlAwQCAQUABCCBTpajc0iOs+r7
# MYBqBwOI+msjJUwWPUtXF/VjeSLhGaCCCfMwggTeMIIDxqADAgECAhBrMmoPAyjT
# eh1TC/0jvUjiMA0GCSqGSIb3DQEBCwUAMH4xCzAJBgNVBAYTAlBMMSIwIAYDVQQK
# ExlVbml6ZXRvIFRlY2hub2xvZ2llcyBTLkEuMScwJQYDVQQLEx5DZXJ0dW0gQ2Vy
# dGlmaWNhdGlvbiBBdXRob3JpdHkxIjAgBgNVBAMTGUNlcnR1bSBUcnVzdGVkIE5l
# dHdvcmsgQ0EwHhcNMTUxMDI5MTEzMDI5WhcNMjcwNjA5MTEzMDI5WjCBgDELMAkG
# A1UEBhMCUEwxIjAgBgN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TeXN0ZW1zIFMu
# QS4xJDAiBgNVBAMTG0NlcnR1bSBUaW1lc3RhbXBpbmcgMjAyMSBDQQIRAPFkJYwJ
# tuJ74g4yYI5L9KgwDQYJKoZIhvcNAQEBBQAEggIAS18YeXkQBdYwLGxQfBtehese
# FGythmYna3FmFLl7boUTb4VwJIgFu9p8Uoh/OUFgXMn1PRs1yOqwV50uP9I6osIl
# yRCY4ZzRafn3fu8YlJE5IT7tgxG1u0/X99XLO2GQArPp4UKFz1bPlb3BMpGaDzTa
# IU1qkp4ZUkn/fw1zdl5Ts2Q6kVgAdy8uxX6DlcXS4JsPeXMLdibpZhJmlEVRKkaA
# 05grcCgoQF3Qk4L2VndYjDia5R2WJTh2qW5+/Hzswt1AmzuEiYtx4d4e/sgSvg3b
# RzhCK5IpUB66dP4YNAvLjECUVN+OARKOMfxlQjoNI3l3nXSyiQDr/PNm/S5I+DJ7
# M7Dsa8TmL61fIhi7rkr9LxkvWVVRr1+g7IeLAP9KLC887i3FkNzyWfwbMX8aiqZM
# DZN86FoX9q66TNS8NPGhaAi5+VAAh4Gl3tgkldFRyyNGVFadQ9CgA9v9ZMKiSe9E
# GJ7bQtja2ziV+STM6Uu0w2F5G3dtxFeH8sEDWOak3lxgeUWuyf1Tef+/QPdPOYxl
# C4Uj+Si+aqtmIDMyFTSiZMPR+wVHEm1QOhYpoAxMjvqgHoj/oiwOgjn4Gz08mIOQ
# NVYM/pnaTyUzM5IJm9Ssrk6dR9BcJPoa+kTmyC7UQZUiwXlHDi2kATaY8mPyuvLs
# mXxKV4xe82ZSNeNrbps=
# SIG # End signature block
bin\gsudoModule.psm1
$c = @("function Invoke-Gsudo {")
$c += (Get-Content "$PSScriptRoot\Invoke-Gsudo.ps1")
$c += "}"
iex ($c -join "`n" | Out-String)

function gsudo {
	$invocationLine = $MyInvocation.Line -replace "^$($MyInvocation.InvocationName)\s+" # -replace '"','""'

	if ($invocationLine -match "(^| )!!( |$)")
	{ 
		$i = 0;
		do {
			$c = (Get-History | Select-Object -last 1 -skip $i).CommandLine
			$i++;
		} while ($c -eq $MyInvocation.Line -and $c)
		
		if ($c) { 
			if ($gsudoVerbose) { Write-verbose "Elevating Command: '$c'" -Verbose}
			gsudo.exe $c 
		}
		else {
			throw "Failed to find last invoked command in Powershell history."
		}
	}
	elseif($myinvocation.expectingInput) {
		$input | & gsudo.exe @args 
	} 
	else { 
		& gsudo.exe @args 
	}
}

$gsudoVerbose=$true;

Export-ModuleMember -function Invoke-Gsudo
Export-ModuleMember -function gsudo
Export-ModuleMember -variable gsudoVerbose

# SIG # Begin signature block
# MIIk+gYJKoZIhvcNAQcCoIIk6zCCJOcCAQExDzANBglghkgBZQMEAgEFADB5Bgor
# BgEEAYI3AgEEoGswaTA0BgorBgEEAYI3AgEeMCYCAwEAAAQQH8w7YFlLCE63JNLG
# KX7zUQIBAAIBAAIBAAIBAAIBADAxMA0GCWCGSAFlAwQCAQUABCDBsVVftoYUW/Zp
# Q7qllQyTh6MQ4XyvbzTd4DiNsRcHW6CCCfMwggTeMIIDxqADAgECAhBrMmoPAyjT
# eh1TC/0jvUjiMA0GCSqGSIb3DQEBCwUAMH4xCzAJBgNVBAYTAlBMMSIwIAYDVQQK
# ExlVbml6ZXRvIFRlY2hub2xvZ2llcyBTLkEuMScwJQYDVQQLEx5DZXJ0dW0gQ2Vy
# dGlmaWNhdGlvbiBBdXRob3JpdHkxIjAgBgNVBAMTGUNlcnR1bSBUcnVzdGVkIE5l
# dHdvcmsgQ0EwHhcNMTUxMDI5MTEzMDI5WhcNMjcwNjA5MTEzMDI5WjCBgDELMAkG
# A1UEBhMCUEwxIjAgBgNVBAoMGVVuaXpldG8gVGVjaG5vbG9naWVzIFMuQS4xJzAl
# BgNVBAsMHkNlcnR1bSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTEkMCIGA1UEAwwb
# Q2VydHVtIENvZGUgU2lnbmluZyBDQSBTSEEyMIIBIjANBgkqhkiG9w0BAQEFAAOC
# AQ8AMIIBCgKC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yqkhpT2SP27K
# v1mRXYkKtvKdGM4y/BzZWKgxAipk9OOiDFr0e6tUVyht2kh5rHithH911zlEoF34
# NdrxC25mtV/QNOyfKSN2Psj11yO+xUuUtjKcoNj81zBBthqUZG4CWN7T+4ypdcY/
# 3oh1nPCoB5xqx9boBAbt97isA5bxCRLWcEcwNDncV5qlzKgfgVBMniregPfou45L
# w4TA5tg5Pr5/NP1iIiby9Tb32Wnzi7DVFSbd5DYBecGKZMjQ/msrw+V3Kg6Dy98a
# rDCaY1rcktX7qtpiFkiso0himtq/vpOimHW7Sh1YBdeQBDLyHED6JGZoOUiMkyOs
# 7/h5hDm+NTm5ptzDUfaBNyhxBChSwGyyA3/+sWAhWN5HvgRNHsZSCow6tMgG77gL
# cSLflv3adbqnx2+VV+gdyK7nNRRxqsKEkhuYXdaRseyH/z5nmt0ji8bP9f63NfcO
# 7vEnkKkOqLmRhFPkK5M3i5S4EygpP8dTqZVP7kSEKvxQu/3Hou2A2k6jqu5s7lY5
# MOYXDyEM0KQCUEMHJK7gUIu+eAHc90EZQc5J9JIi7AM7v6r2+VzRe6GPtKOxed7R
# Ogx2JIuXW1bnw0Dck8E=
# SIG # End signature block
bin\Invoke-gsudo.ps1
<#
.SYNOPSIS
Executes a ScriptBlock in a new elevated instance of powershell, using `gsudo`.

.DESCRIPTION
Serializes a scriptblock and executes it in an elevated powershell. 
The ScriptBlock runs in a different process, so it can´t read/write variables from the invoking scope.
If you reference a variable in a scriptblock using the `$using:variableName` it will be replaced with it´s serialized value.
The elevated command can accept input from the pipeline with $Input. It will be serialized, so size matters.
The script result is serialized, sent back to the non-elevated instance, and returned.
Optionally you can check for "$LastExitCode -eq 999" to find out if gsudo failed to elevate (UAC popup cancelled) 

.PARAMETER ScriptBlock
Specifies a ScriptBlock that will be run in an elevated PowerShell instance. '
e.g. { Get-Process Notepad }

.PARAMETER ArgumentList
An list of elements that will be accesible inside the script as: $args

.PARAMETER NoElevate
A test mode where the command is executed out-of-scope but without real elevation: The serialization/marshalling is still done.

.INPUTS
You can pipe any object to Invoke-Gsudo. It will be serialized and available in the userScript as $Input.

.OUTPUTS
Whatever the scriptblock returns. Use explicit "return" in your scriptblock. 

.EXAMPLE
PS> Get-Process notepad | Invoke-gsudo { Stop-Process }

PS> Invoke-gsudo { return Get-Content 'C:\My Secret Folder\My Secret.txt'}

PS> $a=1; $b = Invoke-gsudo { $using:a+10 }; Write-Host "Sum returned: $b";
Sum returned: 11

.LINK
https://github.com/gerardog/gsudo

    #>
[CmdletBinding(DefaultParameterSetName = 'None')]
param
(
    # The script block to execute in an elevated context.
    [Parameter(Mandatory = $true, Position = 0)]
    [System.Management.Automation.ScriptBlock]
    $ScriptBlock,

    # Optional argument list for the program or the script block.
    [Parameter(Mandatory = $false, Position = 1)]
    [System.Object[]]
    $ArgumentList,

    [Parameter(ValueFromPipeline)]
    [pscustomobject]
    $InputObject,
	
	[Parameter()]
	[switch]
	$NoElevate = $false
)

# Replaces $using:variableName with the serialized value of $variableName.
# Credit: https://stackoverflow.com/a/60583163/97471
Function Serialize-Scriptblock
{ 	
    param(
        [scriptblock]$Scriptblock
    )
    $rxp = '(?<!`)\$using:(?<var>\w+)'
    $ssb = $Scriptblock.ToString()
    $cb = {
        $v = (Get-Variable -Name $args[0].Groups['var'] -ValueOnly)
		if ($v -eq $null)
		{ '$null' }
		else 
		{ 
			"`$([System.Management.Automation.PSSerializer]::Deserialize([System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String('{0}'))))" -f [Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes([System.Management.Automation.PSSerializer]::Serialize($v)))
		}		
    }
    $sb = [RegEx]::Replace($ssb, $rxp, $cb, [System.Text.RegularExpressions.RegexOptions]::IgnoreCase);
	return $sb;
}

Function Deserialize-Scriptblock
{
    param(
		[string]$sb
    )
    [Scriptblock]::Create($sb).GetNewClosure()
}

$expectingInput = $myInvocation.expectingInput;
$debug = if ($PSBoundParameters['Debug']) {$true} else {$false};
$userScriptBlock = Serialize-Scriptblock $ScriptBlock
$InputArray = $Input
$location = (Get-Location).Path;

if($PSBoundParameters["ErrorAction"]) {
	#Write-Verbose -verbose "Received ErrorAction $($PSBoundParameters["ErrorAction"])"
	$errorAction = $PSBoundParameters["ErrorAction"] | Out-String
} else {
	#Write-Verbose -verbose "ErrorActionPreference is $ErrorActionPreference"
	$errorAction = $ErrorActionPreference | Out-String
}

$remoteCmd = Serialize-Scriptblock {
	$InputObject = $using:InputArray;
	$argumentList = $using:ArgumentList;
	$expectingInput = $using:expectingInput;
	$sb = [Scriptblock]::Create($using:userScriptBlock);
	Set-Location $using:location;
	$ErrorActionPreference=$using:errorAction;

	if ($expectingInput) { 
		try { 
			($InputObject | Invoke-Command $sb -ArgumentList $argumentList)
		} catch {throw $_} 
	} else { 
		try{
			(Invoke-Command $sb -ArgumentList $argumentList)
		} catch {throw $_} 
	} 
}

if ($Debug) {
	Write-Debug "User ScriptBlock : $userScriptBlock"
	Write-Debug "Full Script to run on the isolated instance: { $remoteCmd }" 
} 

if($NoElevate) { 
	# We could invoke using Invoke-Command:
	#		$result = $InputObject | Invoke-Command (Deserialize-Scriptblock $remoteCmd) -ArgumentList $ArgumentList
	# Or run in a Job to ensure same variable isolation:

	$job = Start-Job -ScriptBlock (Deserialize-Scriptblock $remoteCmd) -errorAction $errorAction | Wait-Job; 
	$result = Receive-Job $job -errorAction $errorAction
} else {
	$pwsh = ("""$([System.Diagnostics.Process]::GetCurrentProcess().MainModule.FileName)""") # Get same running powershell EXE.
	
	if ($host.Name -notmatch 'consolehost') { # Workaround for PowerShell ISE, or PS hosted inside other process
		if ($PSVersionTable.PSVersion.Major -le 5) 
			{ $pwsh = "powershell.exe" } 
		else 
			{ $pwsh = "pwsh.exe" }
	} 
	
	$windowTitle = $host.ui.RawUI.WindowTitle;

	$dbg = if ($debug) {"--debug "} else {" "}
	$arguments = "-d $dbg--LogLevel Error $pwsh -nologo -NoProfile -NonInteractive -OutputFormat Xml -InputFormat Text -encodedCommand IAAoACQAaQBuAHAAdQB0ACAAfAAgAE8AdQB0AC0AUwB0AHIAaQBuAGcAKQAgAHwAIABpAGUAeAAgAA==".Split(" ")

	# Must Read: https://stackoverflow.com/questions/68136128/how-do-i-call-the-powershell-cli-robustly-with-respect-to-character-encoding-i?noredirect=1&lq=1
	$result = $remoteCmd | & gsudo.exe $arguments *>&1
	
	$host.ui.RawUI.WindowTitle = $windowTitle;
}

ForEach ($item in $result)
{
	if (
	$item.Exception.SerializedRemoteException.WasThrownFromThrowStatement -or
	$item.Exception.WasThrownFromThrowStatement
	)
	{
		throw $item
	}
	if ($item -is [System.Management.Automation.ErrorRecord])
	{ 
		Write-Error $item
	}
	else 
	{ 
		Write-Output $item; 
	}
}

# SIG # Begin signature block
# MIIk+gYJKoZIhvcNAQcCoIIk6zCCJOcCAQExDzANBglghkgBZQMEAgEFADB5Bgor
# BgEEAYI3AgEEoGswaTA0BgorBgEEAYI3AgEeMCYCAwEAAAQQH8w7YFlLCE63JNLG
# KX7zUQIBAAIBAAIBAAIBAAIBADAxMA0GCWCGSAFlAwQCAQUABCAzn4c2VcCnm6f2
# wsC/KWKsYARzi8pcs9q4pHGuvovToaCCCfMwggTeMIIDxqADAgECAhBrMmoPAyjT
# eh1TC/0jvUjiMA0GCSqGSIb3DQEBCwUAMH4xCzAJBgNVBAYTAlBMMSIwIAYDVQQK
# ExlVbml6ZXRvIFRlY2hub2xvZ2llcyBTLkEuMScwJQYDVQQLEx5DZXJ0dW0gQ2Vy
# dGlmaWNhdGlvbiBBdXRob3JpdHkxIjAgBgNVBAMTGUNlcnR1bSBUcnVzdGVkIE5l
# dHdvcmsgQ0EwHhcNMTUxMDI5MTEzMDI5WhcNMjcwNjA5MTEzMDI5WjCBgDELMAkG
# A1UEBhMCUEwxIjAgBgNVBAoMGVVuaXpldG8gVGVjaG5vbG9naWVzIFMuQS4xJzAl
# BgNVBAsMHkNlcnR1bSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTEkMCIGA1UEAwwb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NAQEBBQAEggIAWtkjMzGigWq/WAyqYWGW/P7M
# ucZ8nyEIVk5A34H3oiBJ7EBgcF2lwIr+dnmBXlVwgnFElZ1w53fO65J2BMrtaKYd
# XqcMaA7487aax09e48WqZeS0ieSCAsEvZBTVHJf6N50aPXIYt7u0VPaaw3vm1tgd
# S8YlI4/QClulFFBkGP0wA64G9d3PJ18m4gdI19o3EaU8253bIOn/cN17V3rDgx29
# iM7wJ3JLCpW6So/gGkap9OjEvyIeuigljmDkqfJjRjZzdfcLVbE9Rx/hBoZMyZVj
# b072QUUOtL7q89Iv7pZCRPxiPChbGKACRZwM+2ELX2OZP/+y1aMSFM99uf7tV1G8
# TKyka53GwXyedGOaiks5LKFrorBYXRc98r9eIYsolMT9M0ish6/Mu3rtU2se/MW5
# JUuxtgNqdTgeKi/8oPKdDBw3ddiRfTQCGmrAmKtz7cSJsyqw8ZSJgR+/4+QiSagr
# Q2RLjxyHdhagmqDBfxUzO7Yg6Y+KjVG1Ben7Q+36CFuK7AWxAGfaT5SBklgaqi/G
# upeir8kOgZPzQO4eGhJobwcqolmxuE53EcKC1emu+wngtxfjJRtJJ2nBwOy8NoJC
# NQOxa9EwsvP5sE0qUmu6ejsDvSJnfWkOq7WMXUKE525R7PpcHV0Mt0o6sOxO9RJO
# Q4AbCIHBdKnVhRXFFeE=
# SIG # End signature block
bin\sudo.exe.ignore
 
tools\chocolateybeforemodify.ps1
$ErrorActionPreference = 'Ignore'

if (Get-Process gsudo) {	
	if (Get-Command gsudo.exe) {
		# Stop any gsudo open cache sessions, if any. 
		gsudo.exe -k 2> $null
		Start-Sleep -Milliseconds 500
	}
}

$ToolsLocation = Get-ToolsLocation 
if ([System.Environment]::CurrentDirectory -like "$ToolsLocation*") {
	Write-Output -Verbose "Changing directory to $ToolsLocation to ensure successfull install/upgrade."
	Set-Location $ToolsLocation
}

$ErrorActionPreference = 'Continue'
tools\chocolateybeforemodify.ps1.bak
 
tools\chocolateyinstall.ps1
function Test-IsSymLink([string]$path) {
  $file = Get-Item $path -Force -ea SilentlyContinue
  return [bool]($file.Attributes -band [IO.FileAttributes]::ReparsePoint)
}

Import-Module (Join-Path (Split-Path -parent $MyInvocation.MyCommand.Definition) "Uninstall-ChocolateyPath.psm1")

$ErrorActionPreference = 'Continue'
$ToolsLocation = Get-ToolsLocation 

$bin = "$env:ChocolateyInstall\lib\gsudo\bin\"

############ Clean-up previous versions
if (Test-Path "$bin\sudo.exe")
{
	Remove-Item "$bin\sudo.exe" 
}

# Remove from User Path on previous versions ( <= 0.7.1 )
Uninstall-ChocolateyPath $bin 'User'

# Remove from Path on previous versions ( <= 1.0.2 )
Uninstall-ChocolateyPath $bin 'Machine'

if (Test-Path "$env:ChocolateyInstall\bin\gsudo.exe")  # Previous installers created symlinks on chocolatey\bin, we no longer need them.
{ 
  Remove-Item "$env:ChocolateyInstall\bin\gsudo.exe"
  if (Test-IsSymLink "$env:ChocolateyInstall\bin\sudo.exe")
  {
    Remove-Item "$env:ChocolateyInstall\bin\sudo.exe"
  }
}

if ([System.Environment]::CurrentDirectory -like "$ToolsLocation*") {
	Write-Output -Verbose "Changing directory to $ToolsLocation to ensure successfull install/upgrade."
	Set-Location $ToolsLocation
}
############

$TargetDir = "$ToolsLocation\gsudo\v" + (Get-Item "$bin\gsudo.exe").VersionInfo.FileVersion
$SymLinkDir = "$ToolsLocation\gsudo\Current"

# Add to System Path
mkdir $TargetDir -ErrorAction Ignore
copy "$bin\*.*" $TargetDir -Exclude *.ignore -Force
Install-ChocolateyPath -PathToInstall $SymLinkDir -PathType 'Machine'

cmd /c mklink "$TargetDir\sudo.exe" "$TargetDir\gsudo.exe" 2>$null

$OldCurrentDir = Get-Item $SymLinkDir -ErrorAction ignore
if ($OldCurrentDir) 
{
	$OldCurrentDir.Delete()
}

cmd /c mklink /d "$SymLinkDir" "$TargetDir\"

# gsudo powershell module banner.
"";

Write-Output "gsudo successfully installed. Please restart your consoles to use gsudo."

if (Get-Module gsudoModule) {
	"Please restart PowerShell to update PowerShell gsudo Module."
} else {
	& { 
	"PowerShell users: To use enhanced gsudo and Invoke-Gsudo cmdlet, add the following line to your `$PROFILE"
	"  Import-Module '$SymLinkDir\gsudoModule.psd1'"
	"Or run: "
	"  Write-Output `"``nImport-Module '$SymLinkDir\gsudoModule.psd1'`" | Add-Content `$PROFILE"

	} 
}
tools\chocolateyinstall.ps1.bak
 
tools\chocolateyuninstall.ps1
Import-Module (Join-Path (Split-Path -parent $MyInvocation.MyCommand.Definition) "Uninstall-ChocolateyPath.psm1")

function MarkFileDelete {
param(
    [parameter(Mandatory=$true)]
	[string] $path
)

# the code below has been used from
#    https://blogs.technet.com/b/heyscriptingguy/archive/2013/10/19/weekend-scripter-use-powershell-and-pinvoke-to-remove-stubborn-files.aspx
# with inspiration from
#    http://www.leeholmes.com/blog/2009/02/17/moving-and-deleting-really-locked-files-in-powershell/
# and error handling from
#    https://blogs.technet.com/b/heyscriptingguy/archive/2013/06/25/use-powershell-to-interact-with-the-windows-api-part-1.aspx

Add-Type @'
    using System;
    using System.Text;
    using System.Runtime.InteropServices;
       
    public class Posh
    {
        public enum MoveFileFlags
        {
            MOVEFILE_DELAY_UNTIL_REBOOT         = 0x00000004
        }
 
        [DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
        static extern bool MoveFileEx(string lpExistingFileName, string lpNewFileName, MoveFileFlags dwFlags);
        
        public static bool MarkFileDelete (string sourcefile)
        {
            return MoveFileEx(sourcefile, null, MoveFileFlags.MOVEFILE_DELAY_UNTIL_REBOOT);         
        }
    }
'@
	$deleteResult = [Posh]::MarkFileDelete($path)
	
    if ($deleteResult) {
        write-Warning "(Delete of $path failed: Will be deleted at next boot.)"
    } else {
		write-Warning "(Error marking $path for deletion at next boot.)"
    }
}


$installPath = "$(Get-ToolsLocation)\gsudo"
Uninstall-ChocolateyPath "$installPath\Current" 'Machine'

$ErrorActionPreference="Ignore"

# Delete symlinks in Pwsh 5.
Get-ChildItem $installPath -Recurse |? LinkType -eq 'SymbolicLink'|%{$_.Delete()}
# Delete the rest.
Remove-Item $installPath -Recurse -Force -ErrorAction Ignore

if (Test-Path $installPath) {
	# Files are in use so delete failed.
	# Rename used files and directories. 

	#for (($i = 0); $i -lt 3; $i++)
	Get-ChildItem $installPath -Recurse -Exclude "*.deleteMe" | Sort-Object -Descending {(++$script:i)} | Rename-Item -NewName {$_.name + ".deleteMe" }

	# Mark remaining for delete after restart.
	Get-ChildItem $installPath -Recurse | % { MarkFileDelete ( $_.FullName) }
	MarkFileDelete ( $installPath );
}

$ErrorActionPreference = 'Continue'
tools\chocolateyuninstall.ps1.bak
 
tools\LICENSE.txt
From: https://opensource.org/licenses/MIT

LICENSE

Copyright 2019 Gerardo Grignoli

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
tools\Uninstall-ChocolateyPath.psm1
function Uninstall-ChocolateyPath {
<#
.SYNOPSIS
**NOTE:** Administrative Access Required when `-PathType 'Machine'.`

This puts a directory to the PATH environment variable.

.DESCRIPTION
Looks at both PATH environment variables to ensure a path variable
does not show up on the right PATH.

.NOTES
This command will assert UAC/Admin privileges on the machine if
`-PathType 'Machine'`.

This is used when the application/tool is not being linked by Chocolatey
(not in the lib folder).

.INPUTS
None

.OUTPUTS
None

.PARAMETER PathToUninstall
The full path to a location to remove / ensure is not in the PATH.

.PARAMETER PathType
Which PATH to remove from it. If specifying `Machine`, this requires admin
privileges to run correctly.

.PARAMETER IgnoredArguments
Allows splatting with arguments that do not apply. Do not use directly.

.EXAMPLE
Uninstall-ChocolateyPath -PathToUninstall "$($env:SystemDrive)\tools\gittfs"

.EXAMPLE
Uninstall-ChocolateyPath "$($env:SystemDrive)\Program Files\MySQL\MySQL Server 5.5\bin" -PathType 'Machine'

.LINK
Install-ChocolateyPath

.LINK
Install-ChocolateyEnvironmentVariable

.LINK
Uninstall-ChocolateyEnvironmentVariable

.LINK
Get-EnvironmentVariable

.LINK
Set-EnvironmentVariable

.LINK
Get-ToolsLocation
#>
param(
  [parameter(Mandatory=$true, Position=0)][string] $pathToUninstall,
  [parameter(Mandatory=$false, Position=1)][System.EnvironmentVariableTarget] $pathType = [System.EnvironmentVariableTarget]::User,
  [parameter(ValueFromRemainingArguments = $true)][Object[]] $ignoredArguments
)

  Write-FunctionCallLogMessage -Invocation $MyInvocation -Parameters $PSBoundParameters
  ## Called from chocolateysetup.psm1 - wrap any Write-Host in try/catch

  $originalPathToUninstall = $pathToUninstall

  $statementTerminator = ";"

  # if the last digit is ;, then we are removing it
  if ($pathToUninstall.EndsWith($statementTerminator)) {
    $pathToUninstall = $pathToUninstall.Substring(0, $pathToUninstall.LastIndexOf($statementTerminator))
  }

  #get the PATH variable
  Update-SessionEnvironment
  $envPath = $env:PATH
  if ($envPath.ToLower().Contains($pathToUninstall.ToLower()))
  {
    try {
      Write-Host "PATH environment variable has $pathToUninstall in it. Removing..."
    } catch {
      Write-Verbose "PATH environment variable has $pathToUninstall in it. Removing..."
    }

    $actualPath = Get-EnvironmentVariable -Name 'Path' -Scope $pathType -PreserveVariables

    $actualPath = $actualPath.Replace($pathToUninstall, "")

    while ($actualPath.Contains($statementTerminator + $statementTerminator)) {
      $actualPath = $actualPath.Replace($statementTerminator + $statementTerminator, $statementTerminator)
    }

    if ($pathType -eq [System.EnvironmentVariableTarget]::Machine) {
      if (Test-ProcessAdminRights) {
        Set-EnvironmentVariable -Name 'Path' -Value $actualPath -Scope $pathType
      } else {
        $psArgs = "Uninstall-ChocolateyPath -pathToUninstall `'$originalPathToUninstall`' -pathType `'$pathType`'"
        Start-ChocolateyProcessAsAdmin "$psArgs"
      }
    } else {
      Set-EnvironmentVariable -Name 'Path' -Value $actualPath -Scope $pathType
    }

    #removing it from the local path as well
    $envPSPath = $env:PATH
    $envPSPath = $envPSPath.Replace($pathToUninstall, "")
    while($envPSPath.Contains($statementTerminator + $statementTerminator)) {
      $envPSPath = $envPSPath.Replace($statementTerminator + $statementTerminator, $statementTerminator)
    }
    $env:Path = $envPSPath
  }
}
tools\Uninstall-ChocolateyPath.psm1.bak
 
tools\VERIFICATION.txt
VERIFICATION
Verification is intended to assist the Chocolatey moderators and community
in verifying that this package's contents are trustworthy.

1. The embedded files are also available as a release in GitHub.

Please go to releases page
https://github.com/gerardog/gsudo/releases

Download same version as this choco package (example for v0.4)
https://github.com/gerardog/gsudo/releases/tag/v0.4

unzip and get hashes
powershell -command Get-FileHash *

2. Get hashes from this choco package. Run:

powershell -command Get-FileHash bin\*

3. The checksums should match the following:
--- 
Version Hashes for v1.1.1 
 

Algorithm       Hash                                                                   Path                                                                                                             
---------       ----                                                                   ----                                                                                                             
SHA256          77CA409679ADA9FDA70CA297966274D9A8DEB876B2A1F2E2629FE61559D72533       C:\git\gsudo\build\Chocolatey\gsudo\bin\gsudo.exe                                                                
SHA256          E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855       C:\git\gsudo\build\Chocolatey\gsudo\bin\gsudo.exe.ignore                                                         
SHA256          5CDBDAC74B8735DBAEA6F68C89FB2654E8042659356B6D79257026B1B2642825       C:\git\gsudo\build\Chocolatey\gsudo\bin\gsudoModule.psd1                                                         
SHA256          351C7F368D60C012C9FDCEE59575C1B8A9055F5BC766A492B474BE54E719C0EB       C:\git\gsudo\build\Chocolatey\gsudo\bin\gsudoModule.psm1                                                         
SHA256          87809C092B7F4EB5B17965D327B53F847589482E8DAD803789BDC43ADA7FF628       C:\git\gsudo\build\Chocolatey\gsudo\bin\Invoke-gsudo.ps1                                                         
SHA256          E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855       C:\git\gsudo\build\Chocolatey\gsudo\bin\sudo.exe.ignore                                                          



 

Log in or click on link to see number of positives.

In cases where actual malware is found, the packages are subject to removal. Software sometimes has false positives. Moderators do not necessarily validate the safety of the underlying software, only that a package retrieves software from the official distribution point and/or validate embedded software against official distribution point (where distribution rights allow redistribution).

Chocolatey Pro provides runtime protection from possible malware.

Add to Builder Version Downloads Last Updated Status
gsudo - a sudo for windows 1.2.1-alpha11 19 Tuesday, April 12, 2022 Approved
gsudo - a sudo for windows 1.2.1-alpha10 16 Tuesday, April 12, 2022 Approved
gsudo - a sudo for windows 1.2.0 6333 Friday, March 25, 2022 Approved
gsudo - a sudo for windows 1.1.1 4964 Saturday, March 12, 2022 Approved
gsudo - a sudo for windows 1.1.0 4509 Sunday, February 27, 2022 Approved

This package has no dependencies.

Discussion for the gsudo - a sudo for windows Package

Ground Rules:

  • This discussion is only about gsudo - a sudo for windows and the gsudo - a sudo for windows package. If you have feedback for Chocolatey, please contact the Google Group.
  • This discussion will carry over multiple versions. If you have a comment about a particular version, please note that in your comments.
  • The maintainers of this Chocolatey Package will be notified about new comments that are posted to this Disqus thread, however, it is NOT a guarantee that you will get a response. If you do not hear back from the maintainers after posting a message below, please follow up by using the link on the left side of this page or follow this link to contact maintainers. If you still hear nothing back, please follow the package triage process.
  • Tell us what you love about the package or gsudo - a sudo for windows, or tell us what needs improvement.
  • Share your experiences with the package, or extra configuration or gotchas that you've found.
  • If you use a url, the comment will be flagged for moderation until you've been whitelisted. Disqus moderated comments are approved on a weekly schedule if not sooner. It could take between 1-5 days for your comment to show up.
comments powered by Disqus