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

Gallopsled / pwntools / 8d7613a419f51385e765cb9998da65eb488faa2e

pending completion
8d7613a419f51385e765cb9998da65eb488faa2e

push

github-actions

web-flow
Merge branch 'dev' into process-env-add-2

3905 of 6422 branches covered (60.81%)

1649 of 1649 new or added lines in 79 files covered. (100.0%)

12255 of 16708 relevant lines covered (73.35%)

0.73 hits per line

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

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

5
import shutil
1✔
6
from argparse import ArgumentParser
1✔
7
from subprocess import CalledProcessError
1✔
8
from subprocess import check_output
1✔
9
from tempfile import NamedTemporaryFile
1✔
10

11
import pwnlib.args
1✔
12
pwnlib.args.free_form = False
1✔
13

14
from pwn import *
1✔
15
from pwnlib.commandline import common
1✔
16

17

18
def dump(objdump, path):
1✔
19
    n = NamedTemporaryFile(delete=False)
×
20
    o = check_output([objdump,'-d','-x','-s',path])
×
21
    n.write(o)
×
22
    n.flush()
×
23
    return n.name
×
24

25
def diff(a,b):
1✔
26
    try: return check_output(['diff',a,b], universal_newlines=True)
×
27
    except CalledProcessError as e:
×
28
        return e.output
×
29

30
p = common.parser_commands.add_parser(
1✔
31
    'elfdiff',
32
    help = 'Compare two ELF files',
33
    description = 'Compare two ELF files'
34
)
35

36
p.add_argument('a')
1✔
37
p.add_argument('b')
1✔
38

39
def main(a):
1✔
40
    with context.silent:
×
41
        x = ELF(a.a)
×
42
        y = ELF(a.b)
×
43

44
    if x.arch != y.arch:
×
45
        log.error("Architectures are not the same: %s vs %s" % (x.arch, y.arch))
×
46

47
    context.arch = x.arch
×
48

49
    objdump = pwnlib.asm.which_binutils('objdump')
×
50

51
    tmp = NamedTemporaryFile()
×
52
    name = tmp.name
×
53

54
    shutil.copy(x.path, name)
×
55
    x = dump(objdump, name)
×
56

57
    shutil.copy(y.path, name)
×
58
    y = dump(objdump, name)
×
59

60
    print(diff(x, y))
×
61

62
if __name__ == '__main__':
1!
63
    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

© 2026 Coveralls, Inc