Skip to content

Instantly share code, notes, and snippets.

View bulk88's full-sized avatar

bulk88 bulk88

  • NYC USA
  • 06:36 (UTC -04:00)
  • Instagram bulkny
View GitHub Profile
@bulk88
bulk88 / perllib.c
Created March 19, 2025 22:20
perllib.c
This file has been truncated, but you can view the full file.
#line 1 "perllib.c"
#line 1 "C:\\sources\\perl5\\EXTERN.h"
#line 31 "C:\\sources\\perl5\\EXTERN.h"
#line 41 "C:\\sources\\perl5\\EXTERN.h"
#line 54 "C:\\sources\\perl5\\EXTERN.h"
@bulk88
bulk88 / gist:edf70092765db7b1bbc1bf5cad7c87d5
Created March 10, 2025 08:16
EXE inside another EXE/Proc
C:\sources\Win32-ExeAsDll>perl -Mblib -MWin32::ExeAsDll -e "$o=Win32::ExeAsDll::
new();$o->main('cmd.exe /?');"
The system cannot find message text for message number 0x40002399 in the message
file for Application.
The system cannot find message text for message number 0x4000239a in the message
file for Application.
The system cannot find message text for message number 0x4000239b in the message
file for Application.
The system cannot find message text for message number 0x4000239c in the message
file for Application.
@bulk88
bulk88 / wide.pl
Created March 10, 2025 04:16
Toxic UTF16
$f = Win32::API::More->new('kernel32', 'WideCharToMultiByte', 'NNPiPiNN', 'i');
$a = "\xF0\xDF\xF0\xDF\x00\x00\x00\x00";
$u = "\x00" x 20;
$r = $f->Call(65001, 0, $a, 2, $u, 20, 0 ,0);
Dump($r);
Dump($a);
Dump($u);
SV = IV(0x22c0240) at 0x22c0250
@bulk88
bulk88 / mb.pl
Created March 10, 2025 03:58
toxic UTF8
use Win32::API;
use Devel::Peek 'Dump';
$f = Win32::API::More->new('kernel32', 'MultiByteToWideChar', 'NNPiPi', 'i');
$a = "\xFE\xFB\xB1\x00";
$u = "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00";
$r = $f->Call(65001, 0, $a, 3, $u, 5);
Dump($r);
Dump($a);
Dump($u);
@bulk88
bulk88 / hv hasher fn prototype fix.diff
Created February 26, 2025 21:51
hv hasher fn prototype fix.diff
embed.fnc | 5 ++
embed.h | 2 +
hv_func.h | 32 +++++++++----
perl_siphash.h | 138 +++++++++++++++++++++++++++++++++++++++-----------------
perlstatic.h | 31 +++++++++++--
proto.h | 11 +++++
sbox32_hash.h | 16 ++++---
util.c | 22 ++++++++-
zaphod32_hash.h | 53 ++++++++++++++++++++--
9 files changed, 244 insertions(+), 66 deletions(-)
@bulk88
bulk88 / ntdllcpan.pl
Created February 26, 2025 09:42
ntdllcpan.pl
use Config;
my $cc_out = qx'cl 2>&1';
my $b = ($cc_out =~ /( for 80x86| for x86)/);
my $is_64bit_build = !scalar($b);
my $cpu = $is_64bit_build?'X64':'X86';
my $is_msvc_compiler
= index($cc_out, 'Microsoft (R) C/C++ Optimizing Compiler') != -1
|| index($cc_out, 'Microsoft (R) 32-bit C/C++ Optimizing Compiler') != -1;
@bulk88
bulk88 / ntdll.pl
Created February 26, 2025 09:39
ntdll.pl
#notes on MS usage of SSE instructions
#x64 vcruntime140.dll memchr is SSE
#x86 vcruntime140.dll memchr is no SSE, but DWORD at a time
#x64 msvcr120.dll memchr is no SSE, U8 at a time BADDDD!!!
#x64 msvcrt.dll Win7 memchr is no SSE, U8 at a time BADDDD!!!
#x86 msvcrt.dll Win7 memchr is no SSE, but DWORD at a time
#x64 ntdll.dll Win Built 1903 memchr is no SSE, U8 at a time BADDDD!!!
#x64 ntdll.dll Win7 memchr is no SSE, U8 at a time BADDDD!!!
#x86 ntdll.dll Win7 memchr is no SSE, but DWORD at a time
win32/win32thread.c | 363 +++++++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 357 insertions(+), 6 deletions(-)
diff --git a/win32/win32thread.c b/win32/win32thread.c
index 023f3a5aa9..dfb75af95a 100644
--- a/win32/win32thread.c
+++ b/win32/win32thread.c
@@ -1,12 +1,101 @@
+#define PERL_IN_WIN32THREAD_C
#include "EXTERN.h"
> KernelBase.dll!GetNamedLocaleHashNode() Unknown
KernelBase.dll!SortChangeCase() Unknown
KernelBase.dll!LCMapStringEx() Unknown
kernel32.dll!LCMapStringExStub() Unknown
ucrtbase.dll!__acrt_LCMapStringA_stat() Unknown
ucrtbase.dll!__acrt_LCMapStringA() Unknown
ucrtbase.dll!toupper() Unknown
00000000000b8f38() Unknown
@bulk88
bulk88 / cppinl.pl
Created January 23, 2025 12:18
cppinl.pl
use Inline 'noclean';
use Inline C => Config =>
PRE_HEAD => '#define PERL_NO_GET_CONTEXT 1',
;
use Inline C => Config => BUILD_NOISY => 1;
use Inline C => <<'END_OF_C_CODE';