示例#1
0
    def init_argparse(cls):
        example = """Examples:
>> run forward -L 1234
Open a Socks proxy on local port 1234. Connection output from the target.
>> run forward -CL 1234
Close the local Socks proxy opened on 1234
>> run forward -R 1234
Open a Socks proxy on target (127.0.0.1:1234). Becareful with target's firewal configuration.
>> run forward -CR 1234
Stop the last proxy opened on the target
>> run forward -R 0.0.0.0:1234
Open a Socks proxy on target (0.0.0.0:1234). Need a Socks connection to target_ip:1234.
>> run forward -L 127.0.0.1:1234:192.168.0.2:8000
Local port forwarding. Listen locally on 1234 and connection establishes by the target to 192.168.0.2:8000.
        """

        parser = PupyArgumentParser(prog='forward',
                                    description=cls.__doc__,
                                    epilog=example)

        actions = parser.add_mutually_exclusive_group(required=True)
        actions.add_argument('-CL',
                             '--cancel-local',
                             help='Cancel local forwarding (LPORT/LPATH)')
        actions.add_argument('-CR',
                             '--cancel-remote',
                             help='Cancel remote forwarding (RPORT/RPATH)')

        actions.add_argument('-l',
                             '--list',
                             default=False,
                             action='store_true',
                             help='List forwardings for current client')

        actions.add_argument(
            '-L',
            '--local',
            help='Local port forwarding ([LHOST]:LPORT[:RHOST[:[BPORT=]RPORT]])'
            '; LPATH:RPATH')

        actions.add_argument(
            '-R',
            '--remote',
            help='Remote port forwarding ([RHOST:]RPORT[:LHOST[:[BPORT=]LPORT]])'
            '; RPATH:LPATH')

        actions.add_argument('-VRL',
                             '--virtual-remote-listener',
                             help='Create virtual pupy listener',
                             metavar=('PORT', 'TRANSPORT'),
                             nargs=2)

        actions.add_argument('-CVRL',
                             '--cancel-virtual-remote-listener',
                             metavar='PORT',
                             help='Disable virtual pupy listener',
                             type=int)

        cls.arg_parser = parser
示例#2
0
 def init_argparse(cls):
     arg_parser = PupyArgumentParser(prog="last", description=cls.__doc__)
     duration = arg_parser.add_mutually_exclusive_group()
     duration.add_argument('-n',
                           '--lines',
                           type=int,
                           help='Get only (n) last records')
     duration.add_argument('-d',
                           '--days',
                           type=int,
                           help='Get only records for last (n) days')
     filtering = arg_parser.add_mutually_exclusive_group()
     filtering.add_argument('-x',
                            '--exclude',
                            nargs='+',
                            help='Hide users/hosts/ips')
     filtering.add_argument('-i',
                            '--include',
                            nargs='+',
                            help='Show users/hosts/ips')
     cls.arg_parser = arg_parser
示例#3
0
# -*- encoding: utf-8 -*-

from pupylib.PupyModule import PupyArgumentParser
from pupylib.PupyOutput import Success, Color, Table

from network.conf import transports

usage = 'start/stop/show current listeners'
parser = PupyArgumentParser(prog='listen', description=usage)
group = parser.add_mutually_exclusive_group()
group.add_argument('-l',
                   '--list',
                   action='store_true',
                   help='show current listeners')
group.add_argument('-L',
                   '--list-transports',
                   action='store_true',
                   help='show available transports')
group.add_argument('-a',
                   '--add',
                   nargs='+',
                   metavar=('TRANSPORT', 'TRANSPORT_ARG1'),
                   help='start listener')
group.add_argument('-A',
                   '--add-no-pproxy',
                   nargs='+',
                   metavar=('TRANSPORT', 'TRANSPORT_ARG1'),
                   help='start listener (ignore pproxy)')
group.add_argument('-r',
                   '--remove',
                   metavar='TRANSPORT',