Update list-cli-tools.ps1

This commit is contained in:
Markus 2021-08-24 21:20:33 +02:00
parent 86a0db9640
commit d55bf05845
2 changed files with 72 additions and 242 deletions

View File

@ -44,118 +44,119 @@ function CheckFor { param([string]$Cmd, [string]$VersionArg)
} }
function ListTools { function ListTools {
CheckFor 7z "-version" CheckFor 7z "-version"
CheckFor ant "-v" CheckFor ant "-v"
CheckFor apt "--version" CheckFor apt "--version"
CheckFor apt-get "--version" CheckFor apt-get "--version"
CheckFor amixer "--version" CheckFor amixer "--version"
CheckFor aplay "--version" CheckFor aplay "--version"
CheckFor ar "--version" CheckFor ar "--version"
CheckFor arecord "--version" CheckFor arecord "--version"
CheckFor at "" CheckFor at ""
CheckFor attrib "" CheckFor attrib ""
CheckFor awk "--version" CheckFor awk "--version"
CheckFor basename "--version" CheckFor basename "--version"
CheckFor bash "--version" CheckFor bash "--version"
CheckFor bc "--version" CheckFor bc "--version"
CheckFor cc "--version" CheckFor cc "--version"
CheckFor chdsk "" CheckFor chdsk ""
CheckFor chkntfs "" CheckFor chkntfs ""
CheckFor cipher "" CheckFor cipher ""
CheckFor cksum "--version" CheckFor cksum "--version"
CheckFor clang "--version" CheckFor clang "--version"
CheckFor cmake "--version" CheckFor cmake "--version"
CheckFor cmd "" CheckFor cmd ""
CheckFor comp "" CheckFor comp ""
CheckFor compact "" CheckFor compact ""
CheckFor cpack "--version" CheckFor cpack "--version"
CheckFor ctest "--version" CheckFor ctest "--version"
CheckFor curl "--version" CheckFor curl "--version"
CheckFor cut "--version" CheckFor cut "--version"
CheckFor date "" CheckFor date ""
CheckFor diff "--version" CheckFor diff "--version"
CheckFor dism "" CheckFor dism ""
CheckFor driverquery "" CheckFor driverquery ""
CheckFor find "--version" CheckFor find "--version"
CheckFor ftp "--version" CheckFor ftp "--version"
CheckFor gcc "--version" CheckFor gcc "--version"
CheckFor gdb "--version" CheckFor gdb "--version"
CheckFor git "--version" CheckFor gh "--version"
CheckFor gpg "--version" CheckFor git "--version"
CheckFor help "--version" CheckFor gpg "--version"
CheckFor help "--version"
CheckFor hostname "" CheckFor hostname ""
CheckFor htop "--version" CheckFor htop "--version"
CheckFor ipfs "--version" CheckFor ipfs "--version"
CheckFor java "--version" CheckFor java "--version"
CheckFor lsb_release "" CheckFor lsb_release ""
CheckFor lzma "--version" CheckFor lzma "--version"
CheckFor make "--version" CheckFor make "--version"
CheckFor md5sum "--version" CheckFor md5sum "--version"
CheckFor mkfifo "--version" CheckFor mkfifo "--version"
CheckFor nice "--version" CheckFor nice "--version"
CheckFor nroff "--version" CheckFor nroff "--version"
CheckFor nslookup "" CheckFor nslookup ""
CheckFor openssl "" CheckFor openssl ""
CheckFor perl "--version" CheckFor perl "--version"
CheckFor ping "-V" CheckFor ping "-V"
CheckFor ping6 "-V" CheckFor ping6 "-V"
CheckFor print "" CheckFor print ""
CheckFor printf "--version" CheckFor printf "--version"
CheckFor python "" CheckFor python ""
CheckFor regedit "--version" CheckFor regedit "--version"
CheckFor replace "--version" CheckFor replace "--version"
CheckFor robocopy "--version" CheckFor robocopy "--version"
CheckFor rsh "" CheckFor rsh ""
CheckFor rsync "--version" CheckFor rsync "--version"
CheckFor rundll32 "--version" CheckFor rundll32 "--version"
CheckFor scp "" CheckFor scp ""
CheckFor sftp "" CheckFor sftp ""
CheckFor sha1sum "--version" CheckFor sha1sum "--version"
CheckFor sha256sum "--version" CheckFor sha256sum "--version"
CheckFor sha512sum "--version" CheckFor sha512sum "--version"
CheckFor ssh "" CheckFor ssh ""
CheckFor ssh-keygen "" CheckFor ssh-keygen ""
CheckFor sort "--version" CheckFor sort "--version"
CheckFor split "--version" CheckFor split "--version"
CheckFor strace "--version" CheckFor strace "--version"
CheckFor strings "--version" CheckFor strings "--version"
CheckFor strip "--version" CheckFor strip "--version"
CheckFor sudo "--version" CheckFor sudo "--version"
CheckFor systeminfo "" CheckFor systeminfo ""
CheckFor tail "--version" CheckFor tail "--version"
CheckFor tar "--version" CheckFor tar "--version"
CheckFor taskkill "" CheckFor taskkill ""
CheckFor tasklist "" CheckFor tasklist ""
CheckFor tee "--version" CheckFor tee "--version"
CheckFor time "" CheckFor time ""
CheckFor timeout "" CheckFor timeout ""
CheckFor top "-v" CheckFor top "-v"
CheckFor tskill "" CheckFor tskill ""
CheckFor tzsync "--version" CheckFor tzsync "--version"
CheckFor uniq "--version" CheckFor uniq "--version"
CheckFor vi "--version" CheckFor vi "--version"
CheckFor vim "--version" CheckFor vim "--version"
CheckFor vulkaninfo "--version" CheckFor vulkaninfo "--version"
CheckFor waitfor "--version" CheckFor waitfor "--version"
CheckFor wakeonlan "" CheckFor wakeonlan ""
CheckFor wget "--version" CheckFor wget "--version"
CheckFor where "--version" CheckFor where "--version"
CheckFor whatis "--version" CheckFor whatis "--version"
CheckFor which "" CheckFor which ""
CheckFor whoami "--version" CheckFor whoami "--version"
CheckFor wput "--version" CheckFor wput "--version"
CheckFor write "" CheckFor write ""
CheckFor wsl "" CheckFor wsl ""
CheckFor xcopy "--version" CheckFor xcopy "--version"
CheckFor yes "--version" CheckFor yes "--version"
CheckFor zip "--version" CheckFor zip "--version"
CheckFor zipcloak "--version" CheckFor zipcloak "--version"
CheckFor zipdetails "" CheckFor zipdetails ""
CheckFor zipgrep "" CheckFor zipgrep ""
CheckFor zipinfo "" CheckFor zipinfo ""
CheckFor zipnote "" CheckFor zipnote ""
CheckFor zipsplit "" CheckFor zipsplit ""
CheckFor zsh "--version" CheckFor zsh "--version"
} }
try { try {

View File

@ -1,171 +0,0 @@
function Get-MicrophoneAudio {
<#
.SYNOPSIS
Records audio from the microphone and saves to a file on disk
Author: Justin Warner (@sixdub)
License: BSD 3-Clause
Required Dependencies: None
Optional Dependencies: None
.DESCRIPTION
Get-MicrophoneAudio utilizes the Windows API from winmm.dll to record audio from the microphone and saves the wave file to disk.
.OUTPUTS
Outputs the FileInfo object pointing to the recording which has been saved to disk.
.PARAMETER Path
The location to save the audio
.PARAMETER Length
The length of the audio to record in seconds. Default: 30
.PARAMETER Alias
The alias to use for the WinMM recording. Default: Random 10 Chars
.EXAMPLE
Get-MicrophoneAudio -Path c:\windows\temp\secret.wav -Length 10 -Alias "SECRET"
Description
-----------
Records 10 seconds of audio to the path C:\windows\temp\secret.wav using WinMM alias "secret"
#>
[OutputType([System.IO.FileInfo])]
Param
(
[Parameter( Position = 0, Mandatory = $True)]
[ValidateScript({Split-Path $_ | Test-Path})]
[String] $Path,
[Parameter( Position = 1, Mandatory = $False)]
[Int] $Length = 30,
[Parameter( Position = 2, Mandatory = $False)]
[String] $Alias = $(-join ((65..90) + (97..122) | Get-Random -Count 10 | % {[char]$_}))
)
function Local:Get-DelegateType
{
Param
(
[OutputType([Type])]
[Parameter( Position = 0)]
[Type[]]
$Parameters = (New-Object Type[](0)),
[Parameter( Position = 1 )]
[Type]
$ReturnType = [Void]
)
$Domain = [AppDomain]::CurrentDomain
$DynAssembly = New-Object System.Reflection.AssemblyName('ReflectedDelegate')
$AssemblyBuilder = $Domain.DefineDynamicAssembly($DynAssembly, [System.Reflection.Emit.AssemblyBuilderAccess]::Run)
$ModuleBuilder = $AssemblyBuilder.DefineDynamicModule('InMemoryModule', $false)
$TypeBuilder = $ModuleBuilder.DefineType('MyDelegateType', 'Class, Public, Sealed, AnsiClass, AutoClass', [System.MulticastDelegate])
$ConstructorBuilder = $TypeBuilder.DefineConstructor('RTSpecialName, HideBySig, Public', [System.Reflection.CallingConventions]::Standard, $Parameters)
$ConstructorBuilder.SetImplementationFlags('Runtime, Managed')
$MethodBuilder = $TypeBuilder.DefineMethod('Invoke', 'Public, HideBySig, NewSlot, Virtual', $ReturnType, $Parameters)
$MethodBuilder.SetImplementationFlags('Runtime, Managed')
Write-Output $TypeBuilder.CreateType()
}
function local:Get-ProcAddress
{
Param
(
[OutputType([IntPtr])]
[Parameter( Position = 0, Mandatory = $True )]
[String]
$Module,
[Parameter( Position = 1, Mandatory = $True )]
[String]
$Procedure
)
# Get a reference to System.dll in the GAC
$SystemAssembly = [AppDomain]::CurrentDomain.GetAssemblies() |
Where-Object { $_.GlobalAssemblyCache -And $_.Location.Split('\\')[-1].Equals('System.dll') }
$UnsafeNativeMethods = $SystemAssembly.GetType('Microsoft.Win32.UnsafeNativeMethods')
# Get a reference to the GetModuleHandle and GetProcAddress methods
$GetModuleHandle = $UnsafeNativeMethods.GetMethod('GetModuleHandle')
$GetProcAddress = $UnsafeNativeMethods.GetMethod('GetProcAddress')
# Get a handle to the module specified
$Kern32Handle = $GetModuleHandle.Invoke($null, @($Module))
$tmpPtr = New-Object IntPtr
$HandleRef = New-Object System.Runtime.InteropServices.HandleRef($tmpPtr, $Kern32Handle)
# Return the address of the function
Write-Output $GetProcAddress.Invoke($null, @([System.Runtime.InteropServices.HandleRef]$HandleRef, $Procedure))
}
#Initialize and call LoadLibrary on our required DLL
$LoadLibraryAddr = Get-ProcAddress kernel32.dll LoadLibraryA
$LoadLibraryDelegate = Get-DelegateType @([String]) ([IntPtr])
$LoadLibrary = [System.Runtime.InteropServices.Marshal]::GetDelegateForFunctionPointer($LoadLibraryAddr, $LoadLibraryDelegate)
$HND = $null
$HND = $LoadLibrary.Invoke('winmm.dll')
if ($HND -eq $null)
{
throw 'Failed to aquire handle to winmm.dll'
}
#Initialize the function call to count devices
$waveInGetNumDevsAddr = $null
$waveInGetNumDevsAddr = Get-ProcAddress winmm.dll waveInGetNumDevs
$waveInGetNumDevsDelegate = Get-DelegateType @() ([Uint32])
if ($waveInGetNumDevsAddr -eq $null)
{
throw 'Failed to aquire address to WaveInGetNumDevs'
}
$waveInGetNumDevs = [System.Runtime.InteropServices.Marshal]::GetDelegateForFunctionPointer($waveInGetNumDevsAddr, $waveInGetNumDevsDelegate)
#Initilize the function call to record audio
$mciSendStringAddr = $null
$mciSendStringAddr = Get-ProcAddress winmm.dll mciSendStringA
$mciSendStringDelegate = Get-DelegateType @([String],[String],[UInt32],[IntPtr]) ([Uint32])
if ($mciSendStringAddr -eq $null)
{
Throw 'Failed to aquire address to mciSendStringA'
}
$mciSendString = [System.Runtime.InteropServices.Marshal]::GetDelegateForFunctionPointer($mciSendStringAddr, $mciSendStringDelegate)
#Initialize the ability to resolve MCI Errors
$mciGetErrorStringAddr = $null
$mciGetErrorStringAddr = Get-ProcAddress winmm.dll mciGetErrorStringA
$mciGetErrorStringDelegate = Get-DelegateType @([UInt32],[Text.StringBuilder],[UInt32]) ([bool])
if ($mciGetErrorStringAddr -eq $null)
{
throw 'Failed to aquire address to mciGetErrorString'
}
$mciGetErrorString = [System.Runtime.InteropServices.Marshal]::GetDelegateForFunctionPointer($mciGetErrorStringAddr,$mciGetErrorStringDelegate)
$DeviceCount = $waveInGetNumDevs.Invoke()
if ($DeviceCount -gt 0)
{
#Define buffer for MCI errors. https://msdn.microsoft.com/en-us/library/windows/desktop/dd757153(v=vs.85).aspx
$errmsg = New-Object Text.StringBuilder 150
#Open an alias
$rtnVal = $mciSendString.Invoke("open new Type waveaudio Alias $alias",'',0,0)
if ($rtnVal -ne 0) {$mciGetErrorString.Invoke($rtnVal,$errmsg,150); $msg=$errmsg.ToString();Throw "MCI Error ($rtnVal): $msg"}
#Call recording function
$rtnVal = $mciSendString.Invoke("record $alias", '', 0, 0)
if ($rtnVal -ne 0) {$mciGetErrorString.Invoke($rtnVal,$errmsg,150); $msg=$errmsg.ToString();Throw "MCI Error ($rtnVal): $msg"}
Start-Sleep -s $Length
#save recorded audio to disk
$rtnVal = $mciSendString.Invoke("save $alias `"$path`"", '', 0, 0)
if ($rtnVal -ne 0) {$mciGetErrorString.Invoke($rtnVal,$errmsg,150); $msg=$errmsg.ToString();Throw "MCI Error ($rtnVal): $msg"}
#terminate alias
$rtnVal = $mciSendString.Invoke("close $alias", '', 0, 0);
if ($rtnVal -ne 0) {$mciGetErrorString.Invoke($rtnVal,$errmsg,150); $msg=$errmsg.ToString();Throw "MCI Error ($rtnVal): $msg"}
$OutFile = Get-ChildItem -path $path
Write-Output $OutFile
}
else
{
throw 'Failed to enumerate any recording devices'
}
}