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

Gallopsled / pwntools / 1

16 Jun 2020 04:28AM UTC coverage: 0.0% (-69.4%) from 69.405%
1

push

github

heapcrash
Re-enable UI tests in Github Actions

I suspect this will not work because of curses failing to initialize in GHA

0 of 15570 relevant lines covered (0.0%)

0.0 hits per line

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

0.0
/pwnlib/commandline/template.py
1
#!/usr/bin/env python2
2
from __future__ import absolute_import
×
3
from __future__ import division
×
4

5
import re
×
6

7
from pwn import *
×
8
from pwnlib.commandline import common
×
9

10
from mako.lookup import TemplateLookup
×
11

12
parser = common.parser_commands.add_parser(
×
13
    'template',
14
    help = 'Generate an exploit template'
15
)
16

17
parser.add_argument('exe', nargs='?', help='Target binary')
×
18
parser.add_argument('--host', help='Remote host / SSH server')
×
19
parser.add_argument('--port', help='Remote port / SSH port', type=int)
×
20
parser.add_argument('--user', help='SSH Username')
×
21
parser.add_argument('--pass', help='SSH Password', dest='password')
×
22
parser.add_argument('--path', help='Remote path of file on SSH server')
×
23
parser.add_argument('--quiet', help='Less verbose template comments', action='store_true')
×
24

25
def main(args):
×
26
    cache = None
×
27

28
    if cache:
×
29
        cache = os.path.join(context.cache_dir, 'mako')
×
30

31
    lookup = TemplateLookup(
×
32
        directories      = [os.path.join(pwnlib.data.path, 'templates')],
33
        module_directory = cache
34
    )
35

36
    # For the SSH scenario, check that the binary is at the
37
    # same path on the remote host.
38
    if args.user:
×
39
        if not (args.path or args.exe):
×
40
            log.error("Must specify --path or a exe")
×
41

42
        s = ssh(args.user, args.host, args.port or 22, args.password or None)
×
43
        s.download(args.path or args.exe)
×
44

45
        if not args.exe:
×
46
            args.exe = os.path.basename(args.path)
×
47

48
    template = lookup.get_template('pwnup.mako')
×
49
    output = template.render(args.exe,
×
50
                             args.host,
51
                             args.port,
52
                             args.user,
53
                             args.password,
54
                             args.path,
55
                             args.quiet)
56

57
    # Fix Mako formatting bs
58
    output = re.sub('\n\n\n', '\n\n', output)
×
59

60
    print(output)
×
61

62
    if not sys.stdout.isatty():
×
63
        try: os.fchmod(sys.stdout.fileno(), 0o700)
×
64
        except OSError: pass
×
65

66
if __name__ == '__main__':
×
67
    pwnlib.commandline.common.main(__file__)
×
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