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

Gallopsled / pwntools / 23376593730

21 Mar 2026 09:19AM UTC coverage: 73.671% (-0.2%) from 73.904%
23376593730

push

github

Arusekk
doctests

3880 of 6530 branches covered (59.42%)

0 of 1 new or added line in 1 file covered. (0.0%)

2802 existing lines in 106 files now uncovered.

13386 of 18170 relevant lines covered (73.67%)

0.74 hits per line

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

41.03
/pwnlib/commandline/elfdiff.py
1
import shutil
1✔
2
from argparse import ArgumentParser
1✔
3
from subprocess import CalledProcessError
1✔
4
from subprocess import check_output
1✔
5
from tempfile import NamedTemporaryFile
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

14
def dump(objdump, path):
1✔
UNCOV
15
    n = NamedTemporaryFile(delete=False)
×
UNCOV
16
    o = check_output([objdump,'-d','-x','-s',path])
×
UNCOV
17
    n.write(o)
×
18
    n.flush()
×
19
    return n.name
×
20

21
def diff(a,b):
1✔
22
    try: return check_output(['diff',a,b], universal_newlines=True)
×
UNCOV
23
    except CalledProcessError as e:
×
UNCOV
24
        return e.output
×
25

26
p = common.parser_commands.add_parser(
1✔
27
    'elfdiff',
28
    help = 'Compare two ELF files',
29
    description = 'Compare two ELF files'
30
)
31

32
p.add_argument('a')
1✔
33
p.add_argument('b')
1✔
34

35
def main(a):
1✔
UNCOV
36
    with context.silent:
×
UNCOV
37
        x = ELF(a.a)
×
UNCOV
38
        y = ELF(a.b)
×
39

40
    if x.arch != y.arch:
×
41
        log.error("Architectures are not the same: %s vs %s" % (x.arch, y.arch))
×
42

43
    context.arch = x.arch
×
44

UNCOV
45
    objdump = pwnlib.asm.which_binutils('objdump')
×
46

UNCOV
47
    tmp = NamedTemporaryFile()
×
48
    name = tmp.name
×
49

50
    shutil.copy(x.path, name)
×
51
    x = dump(objdump, name)
×
52

53
    shutil.copy(y.path, name)
×
54
    y = dump(objdump, name)
×
55

56
    print(diff(x, y))
×
57

58
if __name__ == '__main__':
1!
59
    pwnlib.commandline.common.main(__file__, main)
×
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

© 2026 Coveralls, Inc