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

Gallopsled / pwntools / b23251d05bca272f2de82cbf30e27ce6627b1166

pending completion
b23251d05bca272f2de82cbf30e27ce6627b1166

push

github-actions

web-flow
Fix Python 2 editable user install (#2224)

This appears to be fixed in setuptools 62, but Python 2 is stuck at
version 44. Use a workaround which overrides the disabled user installs
temporarily.

This fixes our develop Dockerfile too!

3770 of 6281 branches covered (60.02%)

12261 of 16706 relevant lines covered (73.39%)

1.47 hits per line

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

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

5
import argparse
2✔
6
import sys
2✔
7

8
from pwnlib.commandline import common
2✔
9
from pwnlib.util.fiddling import enhex
2✔
10
from pwnlib.util.lists import group
2✔
11

12
parser = common.parser_commands.add_parser(
2✔
13
    'hex',
14
    help = 'Hex-encodes data provided on the command line or stdin',
15
    description = 'Hex-encodes data provided on the command line or stdin')
16

17
parser.add_argument('data', nargs='*',
2✔
18
    help='Data to convert into hex')
19

20
parser.add_argument(
2✔
21
    '-p', '--prefix',
22
    metavar = 'prefix',
23
    type = str,
24
    default = '',
25
    help = 'Insert a prefix before each byte',
26
)
27

28
parser.add_argument(
2✔
29
    '-s', '--separator',
30
    metavar = 'separator',
31
    type = str,
32
    default = '',
33
    help = 'Add a separator between each byte',
34
)
35

36
def format_hex(hex_string, prefix, separator):
2✔
37
    return separator.join([prefix + x for x in group(2, hex_string)])
2✔
38

39
def main(args):
2✔
40
    if not args.data:
2✔
41
        encoded = enhex(getattr(sys.stdin, 'buffer', sys.stdin).read())
2✔
42
    else:
43
        data = ' '.join(args.data)
2✔
44
        if not hasattr(data, 'decode'):
2!
45
            data = data.encode('utf-8', 'surrogateescape')
×
46
        encoded = enhex(data)
2✔
47

48
    if args.prefix or args.separator:
2✔
49
        encoded = format_hex(encoded, args.prefix, args.separator)
2✔
50

51
    print(encoded)
2✔
52

53
if __name__ == '__main__':
2✔
54
    common.main(__file__)
2✔
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