If you have installed
gef will provide
a convenient command to assemble native instructions directly to opcodes of the
architecture you are currently debugging.
Call it via
assemble or its alias
gef➤ asm [INSTRUCTION [; INSTRUCTION ...]]
-l LOCATION option,
gef will write the assembly code generated by
keystone directly to the memory location specified. This makes it extremely
convenient to simply overwrite opcodes.