Skip to content

Instantly share code, notes, and snippets.

View llxiaoyuan's full-sized avatar
🚢
Where knowledge ended, speculation began.

Chase llxiaoyuan

🚢
Where knowledge ended, speculation began.
View GitHub Profile
@rsouth
rsouth / build-qt-static-with-msvc.md
Last active August 10, 2024 23:08
Build a static version of Qt 5.15.0 with MSVC 2019.
@ohnx
ohnx / Makefile
Created February 5, 2020 06:20 — forked from ilammy/Makefile
Linux kernel system call table hooking
obj-m += afw.o
afw-objs := afw_main.o locate_sct.o ttgl.o
ccflags-y := -std=gnu99 -O2
all:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules
clean:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean
@kaidokert
kaidokert / const_strcmp.h
Last active March 30, 2023 06:58
C++11 constexpr strcmp, from gcc 4.7.2+ and clang 3.5+
// https://godbolt.org/z/5G3Ah3
// API: constexpr int const_strcmp( "foo", "bar" );
// Much more readable version here: https://gist.github.com/kaidokert/dfc08be8e75a3fc650d3daf8e89c3fe9
// but that doesn't work with GCC before version 7
#include <cstddef>
#include <utility>
namespace detail {
@Barakat
Barakat / Client.c
Created December 12, 2019 10:30
Simple example of using shared memory to shared data between user and the kernel
/* Run as admin */
#include <Windows.h>
#include <stdio.h>
int main(void)
{
const HANDLE SharedSection = OpenFileMappingW(FILE_MAP_READ,
FALSE,
L"Global\\ToyDriverSharedSection");
@odzhan
odzhan / jqwerty.c
Created December 7, 2019 09:09
Jacky Qwerty/29A Compression Algorithm
//
// Jacky Qwerty/29A compression algorithm, by Matt Mahoney
// modified by odzhan
// 2019-12-07
//
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <time.h>
@GoldenOak
GoldenOak / obtain_syscall_table_by_fn.c
Created July 13, 2019 11:29
Linux Kernel Module function for obtaining the syscall table address by seeking through the memory.
/*
* run over the memory till find the sys call talbe
* doing so, by searching the sys call close.
*/
unsigned long * obtain_syscall_table_bf(void)
{
unsigned long *syscall_table;
unsigned long int i;
for (i = (unsigned long int)sys_close; i < ULONG_MAX;
@adrianyy
adrianyy / drvscan.cpp
Created May 2, 2019 16:37
vulnerable driver scanner
#include <string>
#include <vector>
#include <fstream>
#include <iostream>
#include <filesystem>
#include <Windows.h>
#include <winternl.h>
static_assert( sizeof( void* ) == 8 );
@Barakat
Barakat / kernel-shellcode.cpp
Created December 27, 2018 19:55
Windows x64 shellcode for locating the base address of ntoskrnl.exe
#include <wdm.h>
__declspec(dllexport)
__declspec(noinline)
void*
GetNtoskrnlBaseAddress()
{
//
// From Windows Internals part 1, chapter 2:
//
@bwangelme
bwangelme / dns_lookup.py
Created April 19, 2018 07:02
Python DNS 查询时指定DNS服务器
#!/usr/bin/env python3
# -*- coding: utf-8 -*-"
import dns.resolver
myResolver = dns.resolver.Resolver()
myResolver.nameservers = ['223.5.5.5', '223.6.6.6']
myAnswers = myResolver.query("www.baidu.com", "A")
for rdata in myAnswers:
@w4kfu
w4kfu / dllinjshim.cpp
Last active June 17, 2024 02:12
DLL Injection via Shim
/*
-------- dllinjshim.cpp --------
> cl /Fe:dllinjshim.exe dllinjshim.cpp
> dllinjshim.exe
> sdbinst moo.sdb
/!\ On Windows 10 there is a new function `SdbIsKnownShimDll` called
in `SdbGetDllPath` which will check the DLL name against the following list: