Skip to content

Instantly share code, notes, and snippets.

View msmania's full-sized avatar
😎
Keep calm and attach a debugger

tokikuch msmania

😎
Keep calm and attach a debugger
View GitHub Profile
@msmania
msmania / traceTokenTransfers.js
Last active April 23, 2023 05:57
Just another Ethereum stuff
require('dotenv').config();
const { ethers, utils } = require("ethers");
const { Interface } = require('ethers/lib/utils');
const Provider = new ethers.providers.JsonRpcProvider({
url: process.env.ETHEREUM_TRACE_ENDPOINT,
user: process.env.ETHEREUM_TRACE_USER,
password: process.env.ETHEREUM_TRACE_PASSWORD,
allowInsecureAuthentication: true,
});
@msmania
msmania / pocket_client.py
Last active January 23, 2024 17:43
Pocket Light Client in Python
import base64
import requests
import sys
DefaultEndpoint = 'http://localhost:8082'
def DecodeTransfer(log):
return {
base64.b64decode(attr['key']).decode('ascii'):
base64.b64decode(attr['value']).decode('ascii')
@msmania
msmania / pagefile.cpp
Created May 5, 2021 17:06
Getting page file info in various ways
#include <cstdint>
#include <windows.h>
#include <intrin.h>
#include <pdh.h>
#include <pdhmsg.h>
#include <psapi.h>
#include <strsafe.h>
void Log(LPCWSTR format, ...) {
@msmania
msmania / main.cpp
Created April 28, 2020 15:22
SetWindowsHookEx caller
#include <stdio.h>
#include <windows.h>
void Log(LPCTSTR format, ...) {
//TCHAR linebuf[1024];
va_list v;
va_start(v, format);
vwprintf(format, v);
va_end(v);
//OutputDebugString(linebuf);
@msmania
msmania / AppInit
Created October 30, 2019 17:04
Callstack at DLL Injection
0:000> knL
# Child-SP RetAddr Call Site
00 000000c6`0c48dd08 00007ffb`eeaca233 ntdll!NtMapViewOfSection+0x14
01 000000c6`0c48dd10 00007ffb`eeac9f96 ntdll!LdrpMinimalMapModule+0x103
02 000000c6`0c48ddd0 00007ffb`eeacd5b7 ntdll!LdrpMapDllWithSectionHandle+0x1a
03 000000c6`0c48de20 00007ffb`eeace608 ntdll!LdrpMapDllNtFileName+0x183
04 000000c6`0c48df20 00007ffb`eeace360 ntdll!LdrpMapDllFullPath+0xe0
05 000000c6`0c48e0b0 00007ffb`eeac2536 ntdll!LdrpProcessWork+0x74
06 000000c6`0c48e110 00007ffb`eeac22a8 ntdll!LdrpLoadDllInternal+0x13e
07 000000c6`0c48e190 00007ffb`eeac1764 ntdll!LdrpLoadDll+0xa8
@msmania
msmania / str-pidl-bstr.cpp
Created August 13, 2019 01:28
String -> PIDL -> BSTR conversion
#include <windows.h>
#include <shlobj.h>
#include <atlbase.h>
#include <comutil.h>
#include <stdio.h>
void Log(LPCWSTR format, ...) {
WCHAR linebuf[1024];
va_list v;
va_start(v, format);
@msmania
msmania / Makefile
Last active May 16, 2022 21:38
WNF subscriber example
!IF "$(PLATFORM)"=="X64" || "$(PLATFORM)"=="x64"
ARCH=amd64
!ELSE
ARCH=x86
!ENDIF
OUTDIR=bin\$(ARCH)
OBJDIR=obj\$(ARCH)
SRCDIR=.
@msmania
msmania / pescan.cpp
Created November 6, 2017 16:34
PE image scanning tool
#include <windows.h>
#include <stdio.h>
#include <strsafe.h>
#include <atlbase.h>
#include <dia2.h>
#include <vector>
#include <algorithm>
#include <functional>
#define Log wprintf
@msmania
msmania / dd.cpp
Created October 26, 2017 02:09
Drag-n-Drop test
#include <windows.h>
#include <atlbase.h>
static WCHAR window_name[] = L"window.drag-n-drop";
const UINT WM_POPUPMSGBOX = WM_USER + 1;
class CDropTarget : public IDropTarget {
private:
const DWORD preferredEffect = DROPEFFECT_LINK;
LONG refcount;
@msmania
msmania / Makefile
Last active August 11, 2017 01:09
tracking window messages
!IF "$(PLATFORM)"=="X64" || "$(PLATFORM)"=="x64"
OUTDIR=bin64
OBJDIR=obj64
ARCH=amd64
!ELSE
OUTDIR=bin
OBJDIR=obj
ARCH=x86
!ENDIF