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

Gallopsled / pwntools / 39eb5b9f9fc3ac2301be5a7a982096b3568d76e1

01 Nov 2023 10:20PM UTC coverage: 73.405% (+1.9%) from 71.525%
39eb5b9f9fc3ac2301be5a7a982096b3568d76e1

push

github-actions

Arusekk
Update CHANGELOG.md

3902 of 6416 branches covered (0.0%)

12255 of 16695 relevant lines covered (73.41%)

0.73 hits per line

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

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

5
import argparse
1✔
6
import sys
1✔
7

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

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

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

19
def main(args):
1✔
20
    if not args.data:
1✔
21
        print(enhex(getattr(sys.stdin, 'buffer', sys.stdin).read()))
1✔
22
    else:
23
        data = ' '.join(args.data)
1✔
24
        if not hasattr(data, 'decode'):
1!
25
            data = data.encode('utf-8', 'surrogateescape')
×
26
        print(enhex(data))
1✔
27

28
if __name__ == '__main__':
1✔
29
    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