Skip to content

Instantly share code, notes, and snippets.

@p4yl0ad
p4yl0ad / how_to_gitlab_git.md
Last active January 31, 2022 10:48
Git example example using a project as a base for another project, e.g. a visual studio folder which has annoying to setup linker/crt options.

#example using a project as a base for another project, e.g. a visual studio folder which has annoying to setup linker/crt options

#run this to setup existing key as auth to gitlab

eval `ssh-agent -s`
ssh-add.exe /c/Users/username/.ssh/gitlab_key

#clone existing repo

@p4yl0ad
p4yl0ad / LdrLoadDll_LdrGetProcedureAddress.c
Created January 31, 2022 13:27
Snippet which uses LdrLoadDll to force load a DLL and use handle returned to get a pointer to a function.
#include <windows.h>
#pragma comment(lib, "ntdll.lib")
//#pragma comment(lib, "ntdllp.lib")
#define NT_SUCCESS(Status) (((NTSTATUS)(Status)) >= 0)
/*
* Author : p4yl0ad
* Date : 31/01/2022
*
* Resources:
#include <stdio.h>
#include <windows.h>
/*
* Fuction to take char * & ULONGLONG and append to a linked list :3
* The reason why Ive posted this will reveal itself :3
*/
// linked list node to hold a function name and a ULONGLONG value holding the RVA to a function
struct node
@p4yl0ad
p4yl0ad / parse_PE_gen_ordered_RVA.c
Last active February 11, 2022 14:52
Load kernelbase.dll. parse PE structure, Iterate over exports and add FunctionName:RVA to a single linked list, sort linked list by RVA and prints
#include <stdio.h>
#include <windows.h>
/*
resources:
sektor7 for basic PE parse structure
https://www.techiedelight.com/given-linked-list-change-sorted-order/
And thanks to people in secret club for being smart as fuck & helpful lul
*/
SE_ASSIGNPRIMARYTOKEN_NAME "SeAssignPrimaryTokenPrivilege" {0, 3}
SE_AUDIT_NAME "SeAuditPrivilege" {0, 21}
SE_BACKUP_NAME "SeBackupPrivilege" {0, 17}
SE_CHANGE_NOTIFY_NAME "SeChangeNotifyPrivilege" {0, 23}
SE_CREATE_GLOBAL_NAME "SeCreateGlobalPrivilege" {0, 30}
SE_CREATE_PAGEFILE_NAME "SeCreatePagefilePrivilege" {0, 15}
SE_CREATE_PERMANENT_NAME "SeCreatePermanentPrivilege" {0, 16}
SE_CREATE_TOKEN_NAME "SeCreateTokenPrivilege" {0, 2}
SE_DEBUG_NAME "SeDebugPrivilege" {0, 20}
SE_ENABLE_DELEGATION_NAME "SeEnableDelegationPrivilege" {0, 27}
@p4yl0ad
p4yl0ad / dir2.c
Last active November 29, 2022 23:21
Implementation of dir.exe
#include <windows.h>
#include <tchar.h>
#include <stdio.h>
#include <strsafe.h>
#include <locale.h>
#pragma comment(lib, "User32.lib")
int _tmain(int argc, TCHAR* argv[])
{
WIN32_FIND_DATA ffd;
@p4yl0ad
p4yl0ad / mbrpart.c
Created December 25, 2022 20:00 — forked from namazso/mbrpart.c
quick raw mbr partition editor
#define _CRT_SECURE_NO_WARNINGS
#define _FILE_OFFSET_BITS 64
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <stdbool.h>
#include <stdio.h>
enum { kSectorSize = 512 };
@p4yl0ad
p4yl0ad / crt.sh.sh
Last active February 24, 2023 23:26
most crt.sh scripts on github are shit
target='target.tld'; wget "https://crt.sh/?q=$target"; cat index.html\?q=$target | grep -i "<td>" | grep -i $target | sed 's/<br>/\n/g' | sed 's/<BR>/\n/g' | sed 's/<td>/\n/g'| sed 's/<\/td>/\n/g' | sed 's/<TD>/\n/g'| sed 's/<\/TD>/\n/g'| grep -v "*" | sort -u
# Generated by Cargo
# will have compiled files and executables
debug/
target/
# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
Cargo.lock
# These are backup files generated by rustfmt
"Win32_System_AddressBook",
"Win32_System_Antimalware",
"Win32_System_ApplicationInstallationAndServicing",
"Win32_System_ApplicationVerifier",
"Win32_System_AssessmentTool",
"Win32_System_Com",
"Win32_System_Com_CallObj",
"Win32_System_Com_ChannelCredentials",
"Win32_System_Com_Events",
"Win32_System_Com_Marshal",