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

Gallopsled / pwntools / 11532588290

26 Oct 2024 02:29PM CUT coverage: 73.585% (+2.1%) from 71.491%
11532588290

push

github

peace-maker
Merge branch 'dev' into interactive

3767 of 6364 branches covered (59.19%)

1463 of 2234 new or added lines in 69 files covered. (65.49%)

85 existing lines in 22 files now uncovered.

13246 of 18001 relevant lines covered (73.58%)

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