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

Gallopsled / pwntools / 1

07 May 2021 03:17PM UTC coverage: 0.0% (-67.5%) from 67.474%
1

push

github

web-flow
Update dietlibc headers and all that jazz (#1733)

* Update dietlibc headers

Closes #691

* Generated files

* Enable easy updating of syscall numbers

* Generated files

* Generate new syscalls

* Update CHANGELOG.md

* Workaround for py2

* Revert CGC deletion

0 of 16472 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/elfdiff.py
1
#!/usr/bin/env python2
2
from __future__ import absolute_import
×
3
from __future__ import division
×
4

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

11
import pwnlib.args
×
12
pwnlib.args.free_form = False
×
13

14
from pwn import *
×
15
from pwnlib.commandline import common
×
16

17

18
def dump(objdump, path):
×
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):
×
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(
×
31
    'elfdiff',
32
    help = 'Compare two ELF files',
33
    description = 'Compare two ELF files'
34
)
35

36
p.add_argument('a')
×
37
p.add_argument('b')
×
38

39
def main(a):
×
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__':
×
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

© 2025 Coveralls, Inc