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

Gallopsled / pwntools / 14039045247

24 Mar 2025 03:20PM UTC coverage: 74.175% (+0.3%) from 73.909%
14039045247

push

github

web-flow
Merge branch 'dev' into riscv-avoid-compressed

3809 of 6382 branches covered (59.68%)

197 of 251 new or added lines in 45 files covered. (78.49%)

1506 existing lines in 40 files now uncovered.

13347 of 17994 relevant lines covered (74.17%)

0.74 hits per line

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

78.05
/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!
UNCOV
31
        import importlib
×
UNCOV
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 deprecated_main():
1✔
UNCOV
37
    file=sys.argv[0]
×
UNCOV
38
    name = os.path.splitext(os.path.basename(file))[0]
×
UNCOV
39
    import warnings
×
UNCOV
40
    warnings.warn("The '%s' command is deprecated and will be removed in a future version. Please use 'pwn %s' instead." % (name, name), DeprecationWarning, stacklevel=2)
×
UNCOV
41
    main(file)
×
42

43
def entrypoint(commands):
1✔
44
    if len(sys.argv) < 2:
1!
UNCOV
45
        parser.print_usage()
×
UNCOV
46
        sys.exit()
×
47
    args = parser.parse_args()
1✔
48
    with context.local(log_console = sys.stderr):
1✔
49
        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

© 2026 Coveralls, Inc