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

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

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

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

17

UNCOV
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

UNCOV
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

UNCOV
30
p = common.parser_commands.add_parser(
×
31
    'elfdiff',
32
    help = 'Compare two ELF files'
33
)
34

UNCOV
35
p.add_argument('a')
×
UNCOV
36
p.add_argument('b')
×
37

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

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

46
    context.arch = x.arch
×
47

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

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

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

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

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

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