Skip to content

Instantly share code, notes, and snippets.

View marcinotorowski's full-sized avatar

Marcin Otorowski marcinotorowski

View GitHub Profile
@marcinotorowski
marcinotorowski / Get-ActualError.ps1
Created January 24, 2020 20:06
A simple PowerShell class which converts HRESULT into a human-friendly error
class ActualError {
[int]$HResult;
[string]$HResultHex;
[string]$HResultBin;
[string]$Facility;
[int]$FacilityCode;
[int]$ErrorCode;
[bool]$IsFailure;
[string]$Message;
[bool]$IsCustom;
@marcinotorowski
marcinotorowski / TriggerDataHubTask.ps1
Last active September 10, 2021 14:57
A PowerShell script which shows how to trigger Data Hub tasks
$baseUrl = "<dataHubUrl>"; # for example http://localhost:81
$taskGuid = "<taskGuid>"; # for example 6ca5c4e2-5095-4422-3b5e-08d96c734da2 - the ID of the task to start (can be copied from respective URL)
$username = "<username>"; # for example MyUser
$password = "<password>"; # for example Pa$$word
function TriggerTask
{
param(
$DataHubUrl,
$AuthToken,
using System;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
namespace Otor
{
public class MsixUtils
{
public static string GetPublisherHash(string publisherId)
@marcinotorowski
marcinotorowski / TimeStampServer.json
Last active December 13, 2021 22:05
The list of some known time stamp servers, to be used by MSIX Hero
{
"obsolete": [
{
"name": "Sectigo",
"url": "https://timestamp.sectigo.com"
},
{
"name": "FreeTSA",
"url": "https://freetsa.org"
}
@marcinotorowski
marcinotorowski / decrypt-km200-output.ps1
Created January 17, 2024 23:15
Decrypting the payload of KM200 (Buderus, Bosch) devices
function Get-Md5Hash
{
param([byte[]]$InputBytes)
(Get-FileHash -InputStream ([System.IO.MemoryStream] ($InputBytes)) -Algorithm MD5).Hash.ToLower()
}
function Get-BuderusKey
{
param($PrivatePassword, $GatewayPassword)
$MagicBytes = [byte[]](0x86, 0x78, 0x45, 0xe9, 0x7c, 0x4e, 0x29, 0xdc, 0xe5, 0x22, 0xb9, 0xa7, 0xd3, 0xa3, 0xe0, 0x7b, 0x15, 0x2b, 0xff, 0xad, 0xdd, 0xbe, 0xd7, 0xf5, 0xff, 0xd8, 0x42, 0xe9, 0x89, 0x5a, 0xd1, 0xe4)