Skip to content

Instantly share code, notes, and snippets.

View martell's full-sized avatar
🏠
Working from home

martell martell

🏠
Working from home
View GitHub Profile
0009:Call advapi32.CryptAcquireContextW(0112c8a0,00000000,00000000,00000001,f0000000) ret=141781bd4
0009:Call ntdll.RtlInitUnicodeString(0112c4f8,7fd6f153a0a0 L"Software\\Microsoft\\Cryptography") ret=7fd6f151038d
0009:Ret ntdll.RtlInitUnicodeString() retval=00000040 ret=7fd6f151038d
0009:Call ntdll.NtOpenKeyEx(0112c690,000f003f,0112c508,00000000) ret=7fd6f150e34a
0009:Ret ntdll.NtOpenKeyEx() retval=c0000034 ret=7fd6f150e34a
0009:Call ntdll.RtlNtStatusToDosError(c0000034) ret=7fd6f15103a1
0009:Ret ntdll.RtlNtStatusToDosError() retval=00000002 ret=7fd6f15103a1
0009:Call KERNEL32.LocalAlloc(00000040,00000064) ret=7fd6f14ffe54
0009:Call ntdll.RtlAllocateHeap(00010000,00000008,00000064) ret=7b453b54
0009:Ret ntdll.RtlAllocateHeap() retval=000381b0 ret=7b453b54
This file has been truncated, but you can view the full file.
Sending build context to Docker daemon 275.8MB
Step 1/62 : FROM alpine:3.7
---> 3fd9065eaf02
Step 2/62 : WORKDIR /build
---> Using cache
---> cba93be3da31
Step 3/62 : RUN apk --no-cache update && apk --no-cache upgrade && apk add --no-cache git
---> Using cache
---> 9ca3a1069aee
@martell
martell / macos-syscall.c
Created September 23, 2017 02:01 — forked from michaeljclark/macos-syscall.c
simple macos process with no dependency on libsystem.dylib
/*
* cc -Wall -O3 -c macos-syscall.c -o macos-syscall.o
* ld -static -macosx_version_min 10.12 -pagezero_size 0x1000 macos-syscall.o -o macos-syscall
*/
__attribute__ ((visibility("default"))) extern void start(void) asm("start");
#define NR_exit 0x2000001
#define NR_write 0x2000004
@martell
martell / create_service_principal.sh
Last active March 15, 2017 17:47
create_service_principal.sh
#!/bin/bash
#echo "Usage:
# 1 bash create-service-principal.sh appname
# 2 bash create-service-principal.sh appname <Subscription ID>
# You need Azure CLI: https://docs.microsoft.com/azure/xplat-cli-install
APP_NAME=$1
SUBSCRIPTION_ID=$2
@martell
martell / 0001-COFF-Fix-short-import-lib-import-name-type-bitshift.patch
Created October 1, 2016 12:20
0001-COFF-Fix-short-import-lib-import-name-type-bitshift.patch
From bb716cb613551806c92d48b7a96c2cd7e76a7e06 Mon Sep 17 00:00:00 2001
From: Martell Malone <martellmalone@gmail.com>
Date: Sat, 1 Oct 2016 09:37:25 +0000
Subject: [PATCH] COFF: Fix short import lib import name type bitshift
As per the PE COFF spec (section 8.3, Import Name Type)
Offset: 18 Size 2 bits Name: Type
Offset: 20 Size 3 bits Name: Name Type
Offset: 20 added based on 18+2
#!/bin/bash
PREFIX=~/llvm
eval PREFIX=$PREFIX
#TARGET=i686-w64-mingw32
#export CC=clang CXX=clang++
tools="gendef genlib"
cd ..
../usr/bin/x86_64-w64-mingw32-clang test.c -v
clang version 3.9.0 (trunk 275826) (llvm/trunk 275825)
Target: x86_64--windows-gnu
Thread model: posix
InstalledDir: /Users/martell/llvm/usr/bin
"/Users/martell/llvm/usr/bin/clang-3.9" -cc1 -triple x86_64--windows-gnu -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -discard-value-names -main-file-name test.c -mrelocation-model pic -pic-level 2 -mthread-model posix -fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables -target-cpu x86-64 -target-linker-version 264.3.102 -momit-leaf-frame-pointer -v -dwarf-column-info -debugger-tuning=gdb -resource-dir /Users/martell/llvm/usr/bin/../lib/clang/3.9.0 -internal-isystem /Users/martell/llvm/usr/bin/../lib/clang/3.9.0/include -internal-isystem /Users/martell/llvm/usr/x86_64-w64-mingw32/include -internal-isystem /Users/martell/llvm/usr/include -fdebug-compilation-dir /Users/martell/llvm/scripts -ferror-limit 19 -fmessage-length 80 -fno-use-cxa-atexit -fobjc-runtime=gcc -fdiagnostics-show-option -fcolo
"/Users/martell/llvm/usr/bin/lld" -flavor gnu -m i386pep -Bdynamic -o a.exe /Users/martell/llvm/usr/x86_64-w64-mingw32/lib/crt2.o /Users/martell/llvm/usr/x86_64-w64-mingw32/lib/crtbegin.o -L/Users/martell/llvm/usr/x86_64-w64-mingw32/lib -L/Users/martell/llvm/usr/lib -L/Users/martell/llvm/usr/x86_64-w64-mingw32/sys-root/mingw/lib /var/folders/dm/xx2ssgf541x2f6tg8chl3wdh0000gn/T/test-0d4247.o -lmingw32 /Users/martell/llvm/usr/bin/../lib/clang/4.0.0/lib/windows/libclang_rt.builtins-x86_64.a -lmoldname -lmingwex -lmsvcrt -ladvapi32 -lshell32 -luser32 -lkernel32 /Users/martell/llvm/usr/x86_64-w64-mingw32/lib/crtend.o
#pragma data_seg(".ctors")
__declspec(allocate(".ctors")) void *__CTOR_LIST__[] = {(void*)-1};
#pragma data_seg(".ctors$zzzz")
__declspec(allocate(".ctors$zzzz")) void *__CTOR_END__[] = {(void*)0};
#pragma data_seg(".dtors")
__declspec(allocate(".dtors")) void *__DTOR_LIST__[] = {(void*)-1};
#pragma data_seg(".dtors$zzzz")
StringRef CtorHead = StringRef("__CTOR_LIST__");
auto *CtorHeadImport = new DefinedRegular(CtorHead, new Defined(lld::coff::DefinedBitcode::DefinedRegularKind));
coff_section Sec;
auto *CtorSection = new (Alloc) SectionChunk(this, &Sec);
OutputSection *Ctors = createSection(".ctors");
Ctors->addChunk(CtorSection->getChunk());