Skip to content

Instantly share code, notes, and snippets.

View BlackOfWorld's full-sized avatar
🐈‍⬛
Busy with life

BlackOfWorld

🐈‍⬛
Busy with life
View GitHub Profile
@BlackOfWorld
BlackOfWorld / SuperReturn.c
Created June 21, 2025 20:23 — forked from namazso/SuperReturn.c
SuperReturn
// Return, but across multiple frames.
//
// This function unwinds the given number of frames, then sets the return value provided, emulating as if this number
// of functions returned, with the last one returning the value provided in RetVal. Can be used to hook a callee when
// you don't have a convenient way to hook it directly and actually just want to stub it out with a return value.
//
// @param FramesToSkip The number of frames to skip, starting from the current frame.
// @param RetVal The value to return from the last frame.
// @param Context Context to start from, in case you want to SuperReturn from somewhere deeper.
DECLSPEC_NOINLINE void SuperReturn(
@BlackOfWorld
BlackOfWorld / AllTheLinks.md
Created August 27, 2023 11:12 — forked from SoSeDiK/AllTheLinks.md
Contains some links of different Minecraft server Software :o
@BlackOfWorld
BlackOfWorld / BukkitReflection.java
Last active January 25, 2023 16:49
TinyProtocol fixed for 1.17+
public class BukkitReflection {
public static ServerPlayer getServerPlayer(Player p) {
var m = Reflection.getMethodCached("{obc}.entity.CraftPlayer", "getHandle");
return invoke(m, p);
}
private static <T> T invoke(java.lang.reflect.Method m, Object instance, Object... args) {
try {
return (T) m.invoke(instance, args);
} catch (Exception e) {
throw new RuntimeException(e);
@BlackOfWorld
BlackOfWorld / Printer.cpp
Created August 25, 2022 17:58
This prints (some) struct members
#include "Printer.h"
#include <cwchar>
#define ATTR(attribute) case attribute: \
wcscpy_s(name, L#attribute); \
break
namespace Printer
@BlackOfWorld
BlackOfWorld / privileges.cpp
Last active June 10, 2022 17:03
Windows privileges
int main() {
const wchar_t* names[] = {
SE_UNSOLICITED_INPUT_NAME,
SE_CREATE_TOKEN_NAME,
SE_ASSIGNPRIMARYTOKEN_NAME,
SE_LOCK_MEMORY_NAME,
SE_INCREASE_QUOTA_NAME,
SE_MACHINE_ACCOUNT_NAME,
SE_TCB_NAME,
SE_SECURITY_NAME,
@BlackOfWorld
BlackOfWorld / SecurityDescriptor.cpp
Last active June 10, 2022 17:03
A useful wrapper for kernel mode stuff (like creating registry keys)
#include "SecurityDescriptor.h"
#include <cstdarg>
#define va_copy(a,b) (a = b)
bool SecurityDescriptor::Create(int count,...)
{
va_list list, list2;
va_start(list, count);
va_copy(list2, list);
SecurityDesc = (PSECURITY_DESCRIPTOR)ExAllocatePoolWithTag(PagedPool, sizeof(SECURITY_DESCRIPTOR), ' SeX');
size = sizeof(ACL);
@BlackOfWorld
BlackOfWorld / NtGet stuff.cpp
Last active February 26, 2023 12:59
This is just a useful meme
#define NtGetCurrentProcess() (HANDLE)-1
#define NtGetCurrentThread() (HANDLE)-2
#ifdef _WIN64
#define NtGetPeb() (PPEB)__readgsqword(0x60)
#define NtGetTeb() (PTEB)__readgsqword(0x30)
#define NtGetPid() (uint32_t)__readgsqword(0x40) /* GetCurrentProcessId() */
#define NtGetTid() (uint32_t)__readgsqword(0x48) /* GetCurrentThreadId() */
#define NtGetErr() (uint32_t)__readgsqword(0x68) /* GetLastError()*/
#define _NtGetSeh() (void**)__readgsqword(0x00)
#define _NtGetStackHigh() (void**)__readgsqword(0x08)
Open developer console (simply press CTRL + SHIFT + I on Windows, or COMMAND + SHIFT + I on Mac (at the same time)).
Then paste this into console:
```
Object.values(webpackJsonp.push([[],{['']:(_,e,r)=>{e.cache=r.c}},[['']]]).cache).find(m=>m.exports&&m.exports.default&&m.exports.default.getCurrentUser!==void 0).exports.default.getCurrentUser().flags|=1
```
Done! You now have access to custom status!
One note, you can't use global emojis sadly :(
@BlackOfWorld
BlackOfWorld / DetectASI.cpp
Last active August 17, 2019 20:09
Detects ASI loader by detecting JMP opcodes inside known function that ASI loader hooks & checks sectors that aren't writable by default (xlive.dll)
bool IsASILoaderPresent() // now it can detect xlive, but possibly broken, can't test
{
HMODULE handle = nullptr;
FARPROC pos = 0;
const char* names[16][2] = {
{"d3d9.dll","D3DPERF_BeginEvent"},
{"d3d11.dll","D3D11CoreCreateDevice"},
{"dsound.dll","DirectSoundCaptureCreate"},
{"d3d8.dll","Direct3DCreate8"},
{"ddraw.dll","DirectDrawCreate"},
@BlackOfWorld
BlackOfWorld / PebWalker.cs
Created March 30, 2019 21:32
C# Program that get's it's PEB (Process Environment Table).
public static class PebWalker
{
public static IntPtr GetPeb()
{
IntPtr handle = OpenProcess(0x1040, false, Process.GetCurrentProcess().Id);
if (handle == IntPtr.Zero) throw new Win32Exception(Marshal.GetLastWin32Error());
int hr;
if (IntPtr.Size != 8)
{
IntPtr peb32 = new IntPtr();