• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Gallopsled / pwntools / 5684991133

pending completion
5684991133

push

github-actions

peace-maker
Do not overwrite global `bytes` in code or examples

4556 of 7223 branches covered (63.08%)

7 of 7 new or added lines in 2 files covered. (100.0%)

12771 of 17174 relevant lines covered (74.36%)

0.74 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

50.0
/pwnlib/commandline/elfpatch.py
1
#!/usr/bin/env python2
2
from __future__ import absolute_import
1✔
3
from __future__ import division
1✔
4

5
import sys
1✔
6

7
import pwnlib.args
1✔
8
pwnlib.args.free_form = False
1✔
9

10
from pwn import *
1✔
11
from pwnlib.commandline import common
1✔
12

13
p = common.parser_commands.add_parser(
1✔
14
    'elfpatch',
15
    help = 'Patch an ELF file',
16
    description = 'Patch an ELF file'
17
)
18

19
p.add_argument('elf',help="File to patch")
1✔
20
p.add_argument('offset',help="Offset to patch in virtual address (hex encoded)")
1✔
21
p.add_argument('bytes',help='Bytes to patch (hex encoded)')
1✔
22

23

24
def main(a):
1✔
25
    if not a.offset.startswith('0x'):
×
26
        a.offset = '0x' + a.offset
×
27

28
    offset       = int(a.offset, 16)
×
29
    patch_bytes  = unhex(a.bytes)
×
30

31
    with context.silent:
×
32
        elf    = ELF(a.elf)
×
33

34
    elf.write(offset, patch_bytes)
×
35
    getattr(sys.stdout, 'buffer', sys.stdout).write(elf.get_data())
×
36

37
if __name__ == '__main__':
1!
38
    pwnlib.commandline.common.main(__file__)
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc