in hexforge_modules/helper.py [0:0]
def write_bytes_to_selected(data) -> None:
"""
The function writes the given bytes data to the selected memory region in IDA. If no region is selected, it writes to the current cursor position.
:param data: The byte data to write to the selected memory region.
:return: None
"""
if data:
success, start, _ = idaapi.read_range_selection(None)
# if user did not select a memory region, get current cursor address
if not success:
start = idc.here()
if start == -1:
return None
for i, x in enumerate(data):
idaapi.patch_byte(start + i, x)