Skip to content

Instantly share code, notes, and snippets.

View derekxmartin's full-sized avatar

Derek Martin derekxmartin

View GitHub Profile
#!/usr/bin/env python3
"""Build a Jira v2 create-issue JSON body from createmeta.
Reads classic createmeta or /issue/createmeta/{project}/issuetypes/{id}.
Prints a usable POST /rest/api/2/issue payload to STDOUT.
Prints field id, required flag, and datatype to STDERR.
Usage:
python3 createmeta_to_payload.py createmeta.json
python3 createmeta_to_payload.py < createmeta.json
#!/usr/bin/env python3
"""Create a Jira issue with v2 API, then update it with extra custom fields.
HTTP transport matches the ssl + urllib3.PoolManager approach used internally.
"""
from __future__ import annotations
import json
import ssl
#!/usr/bin/env python3
"""Extract required fields from Jira createmeta JSON. Prints to STDOUT.
Usage:
python3 required_fields.py < createmeta.json
python3 required_fields.py createmeta.json
curl ... | python3 required_fields.py
"""
from __future__ import annotations
@derekxmartin
derekxmartin / gist:c06e3312089b0b57fe46f58fe0495c46
Created September 16, 2026 15:12
Test-OneDriveRefreshToken.ps1
<#
.SYNOPSIS
Diagnose a OneDrive refresh-token grant without uploading anything.
#>
[CmdletBinding()]
param(
[string]$ClientId = $(if ($env:OD_CLIENT_ID) { $env:OD_CLIENT_ID } else { $null }),
[string]$Tenant = $(if ($env:OD_TENANT_ID) { $env:OD_TENANT_ID } else { 'consumers' }),
[string]$RefreshToken = $(if ($env:OD_REFRESH_TOKEN) { $env:OD_REFRESH_TOKEN } else { $null }),
[string]$CachePath = (Join-Path $PSScriptRoot 'onedrive-token-cache.json')
<#
.SYNOPSIS
Upload a local file to Microsoft OneDrive using Microsoft Graph.
.DESCRIPTION
Supports:
- Delegated OAuth (device code + refresh token) — works for personal
Microsoft accounts AND work/school OneDrive
- App-only client credentials — work/school only; uploads into a
specific user's drive (requires admin-consented application permission)
#!/usr/bin/env python3
"""Find MITRE ATT&CK techniques that do not yet have Jira epics.
Python 3.9+; standard library only. Inputs: Jira CSV/TSV and local ATT&CK JSON.
python jira_attack_gap.py jira_epics.csv --stix-file enterprise-attack.json
python jira_attack_gap.py jira_epics.csv --stix-file /path/to/enterprise-attack.json --scope all
Defaults: CIBETHICAL, Enterprise ATT&CK, top-level techniques only.
MITRE IDs are read from Summary and Epic Name, or explicit --id-columns.
function ConvertTo-VectrOutcome {
param(
$StatusValue,
$Finding,
[string] $FindingName,
[string] $DetectedPath = 'Alerted.Alerted_Priority_Medium',
[string] $DetectedHighPath = 'Alerted.Alerted_Priority_High',
[string] $DetectedBlockedPath = 'Blocked.Blocked_Alerted_Yes',
[string] $NotDetectedPath = 'TBD'
)
function Get-CymulateLaunchedAssessment {
[CmdletBinding()]
param(
[Parameter(Mandatory = $true)] [string] $BaseUrl,
[Parameter(Mandatory = $true)] [string] $Token,
[Parameter(Mandatory = $true)] [string] $AssessmentId,
[string] $LaunchedAssessmentsPath = '/v2/assessments/launched',
[int] $TimeoutSec = 100,
[bool] $SkipCertificateCheck = $false
)
function Get-CymulateLaunchedAssessment {
param(
[string] $BaseUrl,
[string] $LaunchedAssessmentsPath,
[string] $Token,function Get-CymulateLaunchedAssessment {
param(
[string] $BaseUrl,
[string] $LaunchedAssessmentsPath,
[string] $Token,
[string] $AssessmentId,
$cymulateScenarioId = ''
$argsProp = $SiemFinding.PSObject.Properties['scenarioInputArguments']
if ($null -ne $argsProp -and $null -ne $argsProp.Value) {
$first = @($argsProp.Value)[0]
if ($null -ne $first) {
$sid = $first.PSObject.Properties['scenarioId']
if ($null -ne $sid -and $null -ne $sid.Value) {
$cymulateScenarioId = ([string]$sid.Value).Trim()
}
}