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

Gallopsled / pwntools / 1

29 May 2020 09:05AM UTC coverage: 0.0% (-72.4%) from 72.414%
1

push

github

layderv
__str__ to __bytes__ in python2

0 of 8 new or added lines in 2 files covered. (0.0%)

11301 existing lines in 133 files now uncovered.

0 of 15497 relevant lines covered (0.0%)

0.0 hits per line

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

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

UNCOV
5
import sys
×
6

UNCOV
7
import pwnlib
×
UNCOV
8
pwnlib.args.free_form = False
×
9

UNCOV
10
from pwn import *
×
UNCOV
11
from pwnlib.commandline import common
×
12

UNCOV
13
p = common.parser_commands.add_parser(
×
14
    'elfpatch',
15
    help = 'Patch an ELF file'
16
)
17

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

22

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

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

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

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

UNCOV
36
if __name__ == '__main__':
×
37
    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