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

Gallopsled / pwntools / 11306103413

12 Oct 2024 01:37PM CUT coverage: 74.245%. First build
11306103413

Pull #2486

github

web-flow
Merge ebc37cbe2 into 78dd77773
Pull Request #2486: Test Python version >= 3.10 in CI and fix tests on Python 3.12

3678 of 6140 branches covered (59.9%)

20 of 34 new or added lines in 22 files covered. (58.82%)

12972 of 17472 relevant lines covered (74.24%)

0.74 hits per line

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

88.57
/pwnlib/commandline/common.py
1
import argparse
1✔
2
import os
1✔
3
import sys
1✔
4

5
import pwnlib
1✔
6
from pwnlib.context import context
1✔
7

8
choices = list(map(str, [16,32,64]))
1✔
9
choices += list(context.oses)
1✔
10
choices += list(context.architectures)
1✔
11
choices += list(context.endiannesses)
1✔
12

13
def context_arg(arg):
1✔
14
    try: context.arch = arg
1✔
15
    except Exception: pass
1✔
16
    try: context.os = arg
1✔
17
    except Exception: pass
1✔
18
    try: context.bits = int(arg)
1✔
19
    except Exception: arg
1✔
20
    try: context.endian = arg
1✔
21
    except Exception: pass
1✔
22
    return arg
1✔
23

24
parser = argparse.ArgumentParser(description='Pwntools Command-line Interface',
1✔
25
                                 prog='pwn')
26
parser_commands = parser.add_subparsers(dest='command')
1✔
27

28
def main(file=sys.argv[0], command_main=None):
1✔
29
    name = os.path.splitext(os.path.basename(file))[0]
1✔
30
    if command_main is None:
1!
NEW
31
        import importlib
×
NEW
32
        command_main = importlib.import_module('pwnlib.commandline.%s' % name).main
×
33
    sys.argv.insert(1, name)
1✔
34
    entrypoint({name: command_main})
1✔
35

36
def entrypoint(commands):
1✔
37
    if len(sys.argv) < 2:
1!
NEW
38
        parser.print_usage()
×
NEW
39
        sys.exit()
×
40
    args = parser.parse_args()
1✔
41
    with context.local(log_console = sys.stderr):
1✔
42
        commands[args.command](args)
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