Skip to content

Instantly share code, notes, and snippets.

@jborean93
jborean93 / Install-Driver.ps1
Created March 22, 2020 03:07
Installs a driver from an .inf file.
# Copyright: (c) 2020, Jordan Borean (@jborean93) <jborean93@gmail.com>
# MIT License (see LICENSE or https://opensource.org/licenses/MIT)
Function Install-Driver {
<#
.SYNOPSIS
Install a driver from an .inf.
.DESCRIPTION
Long description
@jborean93
jborean93 / parse_negotiate_token.py
Last active March 28, 2020 03:04
Parse a raw Negotiate authentication token and create an easy to understand dict of it's key/values
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# PYTHON_ARGCOMPLETE_OK
# Copyright: (c) 2018, Jordan Borean (@jborean93) <jborean93@gmail.com>
# MIT License (see LICENSE or https://opensource.org/licenses/MIT)
"""
Script that can be used to parse a Negotiate token and output a human readable structure. You can pass in an actual
SPNEGO token or just a raw Kerberos or NTLM token, the script should be smart enough to detect the structure of the
@jborean93
jborean93 / sspi.cs
Created May 29, 2020 01:46
.NET wrapper behind the SSPI functions for authentication and message wrapping
using Microsoft.Win32.SafeHandles;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.ConstrainedExecution;
using System.Runtime.InteropServices;
namespace SSPI
{
internal class NativeHelpers
@jborean93
jborean93 / omi.md
Last active June 5, 2020 05:48
Info around macOS OMI building and GSSAPI issues

Requires the following pre-reqs

brew install pkg-config openssl

Build OMI

rm -rf output
./configure --enable-debug --prefix=/opt/omi-dev
make
@jborean93
jborean93 / Get-SMBIOSData.ps1
Last active June 25, 2020 23:46
Extract SMBIOS info with PowerShell
Add-Type -TypeDefinition @'
using Microsoft.Win32.SafeHandles;
using System;
using System.Collections.Generic;
using System.Runtime.ConstrainedExecution;
using System.Runtime.InteropServices;
namespace Ansible.Windows.Setup
{
public class NativeHelpers
@jborean93
jborean93 / GSS_C_DELEG_POLICY_FLAG.md
Last active July 12, 2020 11:06
Documenting the behaviour of GSS_C_DELEG_POLICY_FLAG on both MIT and Heimdal

Scenario

  • Kerberos authentication to a WinRM endpoint
  • 2 Windows endpoints, 1 is trusted for unconstrained delegation (Y), the other is not trusted for any delegation (N)
  • Trying to reconcile the behaviour of GSS_C_DELEG_POLICY_FLAG for both MIT and Heimdal
  • This does not take consider any krb5.conf values that could affect this behaviour
  • The docs behaviour is based on what is in this blog post
  • Tested on Centos 8 against a Microsoft KDC
  • MIT krb5 version 1.17
  • Heimdal krb5 version 7.7.0
@jborean93
jborean93 / runtime_checker.py
Last active July 29, 2020 03:21
Checks Ansible's ansible_builtin_runtime.yml for any missing or extra plugin entries
#!/usr/bin/env python3
import asyncio
import json
import os
import subprocess
import sys
import tempfile
import yaml
@jborean93
jborean93 / ConvertFrom-IndirectString.ps1
Created August 13, 2020 00:16
Converts an indirect string to the actual string value
# Copyright: (c) 2020, Jordan Borean (@jborean93) <jborean93@gmail.com>
# MIT License (see LICENSE or https://opensource.org/licenses/MIT)
Function ConvertFrom-IndirectString {
<#
.SYNOPSIS
Converts a indirect string identifier to the actual string value it represents.
.PARAMETER IndirectString
The indirect string that begins with '@' to convert to the proper string value.
@jborean93
jborean93 / setup.sh
Created September 15, 2020 05:13
ansible-galaxy collection update scenarios
#!/usr/bin/env bash
set -o pipefail -eu
function create_package {
name="${1}"
version="${2}"
requirements="${3:-}"
if [ ! -z "${requirements}" ]; then
@jborean93
jborean93 / Get-SSHAgentKey.ps1
Created October 13, 2020 23:23
Extract SSH keys from ssh-agent for the current user
# Copyright: (c) 2020, Jordan Borean (@jborean93) <jborean93@gmail.com>
# MIT License (see LICENSE or https://opensource.org/licenses/MIT)
Function Find-InArray {
<#
.SYNOPSIS
Finds the index of a byte[] in a byte[].
#>
[CmdletBinding()]
param (