MCPcopy
hub / github.com/Gallopsled/pwntools / write

Method write

pwnlib/elf/elf.py:1532–1558  ·  view source on GitHub ↗

Writes data to the specified virtual address Arguments: address(int): Virtual address to write data(str): Bytes to write Note: This routine does not check the bounds on the write to ensure that it stays in the same segment. E

(self, address, data)

Source from the content-addressed store, hash-verified

1530 return b''.join(retval)
1531
1532 def write(self, address, data):
1533 """Writes data to the specified virtual address
1534
1535 Arguments:
1536 address(int): Virtual address to write
1537 data(str): Bytes to write
1538
1539 Note:
1540 This routine does not check the bounds on the write to ensure
1541 that it stays in the same segment.
1542
1543 Examples:
1544
1545 >>> bash = ELF(which('bash'))
1546 >>> bash.read(bash.address+1, 3)
1547 b'ELF'
1548 >>> bash.write(bash.address, b"HELO")
1549 >>> bash.read(bash.address, 4)
1550 b'HELO'
1551 """
1552 offset = self.vaddr_to_offset(address)
1553
1554 if offset is not None:
1555 length = len(data)
1556 self.mmap[offset:offset+length] = data
1557
1558 return None
1559
1560 def save(self, path=None):
1561 """Save the ELF to a file

Callers 15

mainFunction · 0.95
mainFunction · 0.95
asmMethod · 0.95
p64Method · 0.95
p32Method · 0.95
p16Method · 0.95
p8Method · 0.95
packMethod · 0.95
flatMethod · 0.95
fitMethod · 0.95
make_elfFunction · 0.45

Calls 1

vaddr_to_offsetMethod · 0.95

Tested by

no test coverage detected