Skip to content

Instantly share code, notes, and snippets.

@adaskar
adaskar / main.cpp
Created Aug 9, 2019
APIHookInjectDLL
View main.cpp
#include <Windows.h>
#include <Psapi.h>
HANDLE OpenProcessInject(const wchar_t *procname)
{
DWORD need;
DWORD pids[2048] = { 0 };
if (!EnumProcesses(pids, sizeof(pids), &need))
return NULL;
View dll.cpp
#include <windows.h>
#include "include/detours.h"
#pragma comment(lib, "detours.lib")
#define KEYWORD L"APIHook"
/*
MS_ ile baslayan fonksiyonlar,
Microsoft'un kendi API cagrilarina gosterici
View dll.high.cpp
#define KEYWORD L"APIHook"
static BOOL WINAPI MY_DeleteFileW(_In_ LPCWSTR lpFileName)
{
// Dosya isminde KEYWORD(L"APIHook") var mi?
// Var ise, LastError'u ERROR_ACCESS_DENIED yap ve hata don.
if (wcsstr(lpFileName, KEYWORD)) {
SetLastError(ERROR_ACCESS_DENIED);
return FALSE;
}
View lkm.c
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/init.h>
#define DEVICENAME "LKMDevice"
#define bail_assert(s, label, fmt, ...) \
do { \
if (!(s)) { \
printk(KERN_ALERT DEVICENAME " " fmt "\n", ##__VA_ARGS__); \
View Makefile
obj-m += lkm.o
all:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules
clean:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean
View makeout.txt
make -C /lib/modules/5.3.0-29-generic/build M=/home/guru/Desktop/lkm modules
make[1]: Entering directory '/usr/src/linux-headers-5.3.0-29-generic'
test -e include/generated/autoconf.h -a -e include/config/auto.conf || ( \
echo >&2; \
echo >&2 " ERROR: Kernel configuration is invalid."; \
echo >&2 " include/generated/autoconf.h or include/config/auto.conf are missing.";\
echo >&2 " Run 'make oldconfig && make prepare' on kernel src to fix it."; \
echo >&2 ; \
/bin/false)
make -f ./scripts/Makefile.build obj=/home/guru/Desktop/lkm need-modorder=1
View makeout.txt.gcc
gcc
-nostdinc
-isystem
/usr/lib/gcc/x86_64-linux-gnu/9/include
-I./arch/x86/include
-I./arch/x86/include/generated
-I./include
-I./arch/x86/include/uapi
View c_cpp_properties.json
{
"configurations": [
{
"name": "Linux",
"includePath": [
"${workspaceFolder}/**",
"/usr/lib/gcc/x86_64-linux-gnu/9/include",
"/lib/modules/5.3.0-29-generic/build/arch/x86/include",
"/lib/modules/5.3.0-29-generic/build/arch/x86/include/generated",
"/lib/modules/5.3.0-29-generic/build/include",
View main.swift
//
// main.swift
// AggregateAudioVolumeControl
//
// Created by Gurhan Polat on 20.12.2020.
//
import Foundation
import Cocoa
import AVFoundation