Another poorly implemented virtual machine for C#. Good for crackme obfuscation to show how good you are.
Can add two times two and coolly call a virtual method that no one will know about it.
Not all opcodes work correctly.
Made for fun.
Slower than the Yandere-dev code
Download latest sources, open Program.cs, change it for yourself and compile it in Release (because of the #!DEBUG directive, which turns off part of the protection in the debug release to make debugging easier for me) mode.
IMPORTANT!!! Any Net7 files must be obfuscated by a compiled BaddyVM targetting Net7.0. Any Net6 files must be obfuscated by a compiled BaddyVM targetting Net6.0.
publicunsafestaticvoidMain(string[]args){int*ptr=Marshal.AllocHGlobal(64);int*ptr2=Marshal.AllocHGlobal(120);*(IntPtr*)(ptr2+0)= ptr;*(IntPtr*)(ptr2+12)= args;*(IntPtr*)(ptr2+10)=1;*(IntPtr*)(ptr2+4)= VMRunner.VMTable;
VMRunner.a(<Module>.Main(),ptr2);
Marshal.FreeHGlobal(ptr);
Marshal.FreeHGlobal(ptr2);}The VM instructions look like this
internalunsafestaticint*Store(int*A_0,int*A_1){intnum=(int)(*(ushort*)A_0);
A_0 =(int*)((byte*)A_0+2);refIntPtr ptr =ref*(IntPtr*)(A_1+num/4);int* ptr2 =*(long*)(A_1+0);
IntPtr intPtr =(IntPtr)(*(long*)ptr2);
ptr2 -=2;*(IntPtr*)(A_1+0)=ptr2;
ptr =intPtr;
jmp(Router());}