Skip to content

Instantly share code, notes, and snippets.

@petergs
petergs / hugging-face-mitre-attack.md
Created September 3, 2026 20:31
Hugging Face Incident MITRE ATT&CK Mapping
@petergs
petergs / crowdstrike-nc-troubleshooting.md
Last active August 12, 2026 17:32
CrowdStrike Network Containment Troubleshooting

Troubleshooting CrowdStrike Network Containment

These commands assume MacOS, but can be adapted to other operating systems.

Issue 1 - Containment Status Not Reflected in Console

I've observed devices that do not indicate that they're network contained in the console, but when using falconctl indicate that they are (contained=1). You can check this with

$> sudo /Applications/Falcon.app/Contents/Resources/falconctl stats | grep 'contained:'
contained: 1
@petergs
petergs / pyodbc.md
Created July 15, 2026 16:43
Use pyodbc with SQL Server on MacOS via the FreeTDS Driver

Connecting pyodbc to SQL Server with a Domain Account on macOS using FreeTDS

1. Install dependencies

Assumes Homebrew is already installed.

brew install unixodbc freetds

2. Register the FreeTDS driver

@petergs
petergs / claude-artifacts.md
Created February 11, 2026 15:25
Claude Code Artifacts

Claude Code Forensics Artifacts

A few notes on investigating execution of malicious skills via Claude Code

Plugins, Marketplaces, & Skills

MacOS/Linux

# installed plugins 
$> cat ~/.claude/plugins/installed_plugins.json
{
  "version": 2,
@petergs
petergs / read-tfplan-with-less.md
Created October 23, 2025 15:36
Read tfplan with less
terraform plan -out=tfplan
terraform show tfplan | less -R
@petergs
petergs / iamlive-tf.sh
Created September 8, 2025 16:12
iamlive with terraform
# 1. install iamlive
brew install iann0036/iamlive/iamlive
# 2. run iamlive
iamlive --mode proxy --output-file readonly.json --force-wildcard-resource
# 3. in a separate terraform window
export HTTP_PROXY=http://127.0.0.1:10080
export HTTPS_PROXY=http://127.0.0.1:10080
export AWS_CA_BUNDLE=~/.iamlive/ca.pem
@petergs
petergs / Invoke-EnumerateAzureBlobs.ps1
Last active June 5, 2025 20:42
Updated Invoke-EnumerateAzureBlobs.ps1
<#
File: Invoke-EnumerateAzureBlobs.ps1
Author: Karl Fosaaen (@kfosaaen), NetSPI - 2018
Description: PowerShell function for enumerating public Azure Blob file resources.
Parts of the Permutations.txt file borrowed from - https://github.com/brianwarehime/inSp3ctor
Small updates by @petergs captured in these PRs:
- https://github.com/NetSPI/MicroBurst/pull/53
- https://github.com/NetSPI/MicroBurst/pull/54
#>
@petergs
petergs / onedrive-upload.py
Created April 25, 2025 20:51
onedrive-upload.py
import requests
import json
import pathlib
import sys
def upload(access_token: str, file_path: str, file_name: str):
headers = {
'Authorization': f'Bearer {access_token}',
'Content-Type': 'text/plain'
}
@petergs
petergs / cheatsheet.md
Last active April 25, 2025 20:31
Microsoft Graph CLI Incantations

Microsoft Graph CLI Cheatsheet

I've generally found the Microsoft Graph CLI (mgc) hard to work with. In many cases, harder than using the Graph API endpoints directly or language-specific SDKs. In general, Entra directory-related commands seem to work well, but other parts of the Graph API are rough around the edges from a usability perspective.

This doc provides some quick examples so I never have to work through the trial-and-error of figuring them out again.

OneDrive

Listing and downloading items