Skip to content

Instantly share code, notes, and snippets.

@jborean93
jborean93 / parse_openssh_key.py
Last active July 24, 2024 05:29
Parses an OpenSSH Private Key file
#!/usr/bin/env python3
# /// script
# dependencies = [
# "bcrypt",
# "cryptography >= 43.0.0",
# "pyyaml",
# ]
# ///
@jborean93
jborean93 / Get-ServiceCredential.ps1
Last active July 4, 2024 08:30
Get's the username and password for installed Windows services
# Copyright: (c) 2019, Jordan Borean (@jborean93) <jborean93@gmail.com>
# MIT License (see LICENSE or https://opensource.org/licenses/MIT)
Function Get-ServiceCredential {
<#
.SYNOPSIS
Retrieve the username and plaintext password for all services installed on the local computer.
.DESCRIPTION
Will retrieve the username and plaintext password for the service(s) specified. This must be run as an
@jborean93
jborean93 / tls-keylogger.ps1
Last active June 27, 2024 12:18
Logs Wireshark compatible TLS keys like the SSLKEYLOGFILE env var
#Requires -Module PSDetour
[CmdletBinding()]
param (
[Parameter(Mandatory)]
[string]
$LogPath
)
$LogPath = $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath($LogPath)
@jborean93
jborean93 / Start-ProcessEx.ps1
Last active June 27, 2024 06:20
PowerShell wrapper around CreateProcess that exposes more low level items
# Copyright: (c) 2021, Jordan Borean (@jborean93) <jborean93@gmail.com>
# MIT License (see LICENSE or https://opensource.org/licenses/MIT)
using namespace System.Management.Automation
using namespace System.Management.Automation.Host
using namespace System.Runtime.InteropServices
$typeParams = @{
TypeDefinition = @'
using Microsoft.Win32.SafeHandles;
@jborean93
jborean93 / Get-ModernCredential.ps1
Last active June 21, 2024 15:27
Get-Credential but with the modern Windows form - inspired from https://github.com/dopyrory3/Get-ModernCredential
# Copyright: (c) 2021, Jordan Borean (@jborean93) <jborean93@gmail.com>
# MIT License (see LICENSE or https://opensource.org/licenses/MIT)
Function Get-ModernCredential {
<#
.SYNOPSIS
Modern credential prompt.
.DESCRIPTION
Uses the modern Windows credential prompt to build a credential object.
@jborean93
jborean93 / Invoke-WithImpersonation.ps1
Last active June 7, 2024 15:17
Invoke a scriptblock in powershell with impersonation
# Copyright: (c) 2020, Jordan Borean (@jborean93) <jborean93@gmail.com>
# MIT License (see LICENSE or https://opensource.org/licenses/MIT)
Function Invoke-WithImpersonation {
<#
.SYNOPSIS
Invoke a scriptblock as another user.
.DESCRIPTION
Invoke a scriptblock and run it in the context of another user as supplied by -Credential.
@jborean93
jborean93 / Get-LogonSessionData.ps1
Created August 30, 2022 11:57
Get LSA logon session data
# Copyright: (c) 2022, Jordan Borean (@jborean93) <jborean93@gmail.com>
# MIT License (see LICENSE or https://opensource.org/licenses/MIT)
Function Get-LogonSessionData {
<#
.SYNOPSIS
Get LSA logon session data.
.DESCRIPTION
Get the logon session information for all or a specific logon session or specific process logon sessions.
@jborean93
jborean93 / Get-SmbShareInfo.ps1
Created May 6, 2020 19:55
Enumerates shares on a remote host
# Copyright: (c) 2020, Jordan Borean (@jborean93) <jborean93@gmail.com>
# MIT License (see LICENSE or https://opensource.org/licenses/MIT)
Function Get-SmbShareInfo {
<#
.SYNOPSIS
Enumerate shares on a remote host.
.DESCRIPTION
Enumerate shares on a remote host and returns the name, type, and special remark for those shares.
@jborean93
jborean93 / Split-ExeArgument.ps1
Last active June 4, 2024 01:24
Splits the input string using the Win32 argument splitter
# Copyright: (c) 2024, Jordan Borean (@jborean93) <jborean93@gmail.com>
# MIT License (see LICENSE or https://opensource.org/licenses/MIT)
#Requires -Module Ctypes
Function Split-ExeArgument {
[OutputType([string])]
[CmdletBinding()]
param (
[Parameter(Mandatory, ValueFromPipeline)]
@jborean93
jborean93 / libvirt-network-dns.py
Created June 3, 2024 00:34
Script that can automatically configure DNS domain resolvers for systemd-resolved on QEMU network adapters
#!/usr/bin/python
import os.path
import subprocess
import sys
import xml.etree.ElementTree as ET
def main():
iface = sys.argv[1]
hook_case = sys.argv[2]