This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$conn = New-Object system.net.sockets.tcpclient($host, $port) | |
$stream = New-Object system.net.security.sslstream($conn.getstream(), $null, { | |
Write-Host $args[2].ChainElements[0].Certificate.Subject; | |
Write-Host "PolicyErrors: $($args[3])"; | |
}) | |
$result = $stream.authenticateasclient("chocolatey.org") | |
$conn.Close() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$conn = New-Object system.net.sockets.tcpclient($host, $port) | |
$stream = New-Object system.net.security.sslstream($conn.getstream(), $null, { | |
Write-Host $args[2].ChainElements[0].Certificate.Subject; | |
Write-Host "PolicyErrors: $($args[3])"; | |
# Immer True zurückgeben, damit alle Zertifikate auch mit Fehler akzeptiert werden. | |
$true; | |
}) | |
$result = $stream.authenticateasclient("chocolatey.org") | |
$conn.Close() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$SFTCode = @" | |
[DllImport("kernel32")] public static extern uint EnumSystemFirmwareTables (uint FirmwareTableProviderSignature, IntPtr pFirmwareTableBuffer, uint BufferSize); | |
[DllImport("kernel32")] public static extern uint GetSystemFirmwareTable (uint FirmwareTableProviderSignature, uint FimrwareTableID, IntPtr pFirmwareTableBuffer, uint BufferSize); | |
"@ | |
$SFT = Add-Type -MemberDefinition $SFTCode -Name "SFTKlasse" -Language CSharp -UsingNamespace "System.Reflection", "System.Diagnostics", "System.Collections.Generic" -PassThru | |
# 0×41435049=ACPI ? https://github.com/michaelforney/coreboot/blob/master/src/include/cbmem.h |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Format-Hex based on http://www.leeholmes.com/blog/2009/11/23/hex-dumper-in-powershell/ | |
# Extended with additional parameters and fixed some formatting issues. | |
############################################################################## | |
## | |
## Format-Hex | |
## | |
## From Windows PowerShell Cookbook (O’Reilly) | |
## by Lee Holmes (http://www.leeholmes.com/guide) | |
## |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Verbindung zu Web.de aufbauen | |
$c=Test-NetConnection smtp.web.de -Port 587 | |
# Antwort vom SMTP-Server holen und ausgeben | |
[byte[]]$buffer= @(0) * $c.TcpClientSocket.Available | |
$c.TcpClientSocket.Receive($buffer) | |
[System.Text.Encoding]::ASCII.GetString($buffer) | |
# Begrüßung durchführen | |
$buffer=[System.Text.Encoding]::ASCII.GetBytes("EHLO $Env:Computername`r`n") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
Add-Type -AssemblyName "System.Drawing" | |
Add-Type -AssemblyName "System.Windows.Forms" | |
function Get-VMScreenBMP { | |
param | |
( | |
$VMName, | |
$index=0 | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Function Get-PwnedPasswordCounter ($password) { | |
# Hashstring erzeugen | |
$sha1=[System.Security.Cryptography.SHA1]::Create() | |
$sha1Hash=$sha1.ComputeHash([System.Text.Encoding]::UTF8.GetBytes($password)) | |
$sha1HashString=[System.BitConverter]::ToString($sha1Hash).Replace('-','') | |
$hashPrefix=$sha1HashString.Substring(0,5) | |
$hashSuffix=$sha1HashString.Substring(5) | |
# pwnedpasswords-API anrufen |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Microsoft.Win32; | |
using Newtonsoft.Json; | |
using System; | |
using System.Collections.Generic; | |
using System.ComponentModel; | |
using System.IO; | |
using System.Runtime.InteropServices; | |
using System.Text; | |
/// <summary> | |
/// A small class to recover Firefox Data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Grundlage: Diese geniale Antwort auf Superuser: https://superuser.com/questions/1168551/turn-on-off-bluetooth-radio-adapter-from-cmd-powershell-in-windows-10/1293303#1293303 | |
# Das Besondere daran, die Verwendung von Async und Await mit WindowsRuntime und alles in purem Powershell! | |
# hier nur die BluetoothVariante aber man kann durch Ändern der Kind-Abrage nach Wifi, MobileBroadband, FM und Other vorgehen. https://docs.microsoft.com/en-us/uwp/api/windows.devices.radios.radiokind | |
Function Bluetooth { | |
[CmdletBinding()] | |
Param ( | |
[Parameter(Mandatory=$true)][ValidateSet('Off', 'On')][string]$BluetoothStatus | |
) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# zunächst brauchen wir eine Windows Runtime Referenz | |
Add-Type -AssemblyName System.Runtime.WindowsRuntime | |
# dann die passende API-Laden, https://docs.microsoft.com/en-us/uwp/api/windows.foundation.metadata.apiinformation | |
[Windows.Foundation.Metadata.ApiInformation,Windows.Foundation.UniversalAPIContract,ContentType=WindowsRuntime] | |
# Featureabfrage | |
[Windows.Foundation.Metadata.ApiInformation]::IsTypePresent("Windows.Media.Playlists.Playlist") | |
# oder API-Contract mit Version | |
[Windows.Foundation.Metadata.ApiInformation]::IsApiContractPresent("Windows.Foundation.UniversalApiContract", 1,0) | |
# bisher bekannte API-Contracts: https://docs.microsoft.com/en-us/uwp/extension-sdks/windows-universal-sdk | |
# genauer: https://docs.microsoft.com/en-us/uwp/extension-sdks/ |
OlderNewer