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

Gallopsled / pwntools / 10549534825

12 Aug 2024 04:39PM UTC coverage: 74.334% (-0.04%) from 74.374%
10549534825

push

github

peace-maker
Pin colored_traceback < 0.4 for Python 2

4451 of 7185 branches covered (61.95%)

12984 of 17467 relevant lines covered (74.33%)

0.74 hits per line

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

76.19
/pwnlib/commandline/unhex.py
1
from __future__ import absolute_import
1✔
2
from __future__ import division
1✔
3

4
import argparse
1✔
5
import sys
1✔
6
from string import whitespace
1✔
7

8
from pwnlib.commandline import common
1✔
9
from pwnlib.util.fiddling import unhex
1✔
10

11
parser = common.parser_commands.add_parser(
1✔
12
    'unhex',
13
    help = 'Decodes hex-encoded data provided on the command line or via stdin.',
14
    description = 'Decodes hex-encoded data provided on the command line or via stdin.'
15
)
16

17
parser.add_argument('hex', nargs='*',
1✔
18
    help='Hex bytes to decode')
19

20
def main(args):
1✔
21
    try:
1✔
22
        o = getattr(sys.stdout, 'buffer', sys.stdout)
1✔
23
        if not args.hex:
1!
24
            s = getattr(sys.stdin, 'buffer', sys.stdin).read().translate(None, whitespace.encode('ascii'))
×
25
            o.write(unhex(s))
×
26
        else:
27
            o.write(unhex(''.join(args.hex)))
1✔
28
    except TypeError as e:
×
29
        sys.stderr.write(str(e) + '\n')
×
30
        raise
×
31

32
if __name__ == '__main__':
1✔
33
    common.main(__file__)
1✔
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