Skip to content

Instantly share code, notes, and snippets.

View ivarne's full-sized avatar

Ivar Nesje ivarne

  • Oslo, Norway
  • 21:22 (UTC +02:00)
View GitHub Profile
@ihnorton
ihnorton / _pleasedontdothis_.jl
Last active January 31, 2020 21:51
Curiosity and the cat
mem_size = 64
mem_prot = 0x40 # PAGE_EXECUTE_READWRITE
mem_type = 0x00001000 # MEM_COMMIT
ex_mem = ccall(:VirtualAlloc,
Ptr{Uint8},
(Ptr{Void}, Csize_t, Uint64, Uint64),
C_NULL, mem_size, mem_type, mem_prot) # call VirtualAlloc and get executable page
exec_arr = pointer_to_array(ex_mem, (32,2)); # consider as an array so we can write to it