Example #1
0
def run(cmdargs):
    args = [
        (cmdargs.localhost, cmdargs.localport),
        (cmdargs.remotehost, cmdargs.remoteport)
    ]
    kwargs = {}

    if cmdargs.sslboth:
        kwargs['ssl'] = True
        if not cmdargs.certfile or not cmdargs.keyfile:
            print ('You need to specify a valid certificate file and a key file!')
            sys.exit(1)
        kwargs['certfile'] = cmdargs.certfile
        kwargs['keyfile'] = cmdargs.keyfile
    elif cmdargs.sslout:
        kwargs['ssl_out_only'] = True

    if not cmdargs.quiet:
        kwargs['debug'] = True

    if cmdargs.username and cmdargs.password:
        credentials = store_credentials.StoreCredentials()
        credentials.username = cmdargs.username
        credentials.password = cmdargs.password
        credentials.stored = True
    else:
        credentials = store_credentials.StoreCredentials()
        credentials.username = config.username
        credentials.password = config.password
        credentials.stored = True
    kwargs['credential_validator'] = credentials

    server = ProxyServer(*args, **kwargs)
    server.run()
Example #2
0
def run(cmdargs):
    args = [(cmdargs.localhost, cmdargs.localport),
            (cmdargs.remotehost, cmdargs.remoteport)]
    kwargs = {}

    if cmdargs.sslboth:
        kwargs['ssl'] = True
        if not cmdargs.certfile or not cmdargs.keyfile:
            print(
                'You need to specify a valid certificate file and a key file!')
            sys.exit(1)
        kwargs['certfile'] = cmdargs.certfile
        kwargs['keyfile'] = cmdargs.keyfile
    elif cmdargs.sslout:
        kwargs['ssl_out_only'] = True

    if not cmdargs.quiet:
        kwargs['debug'] = True

    if cmdargs.username and cmdargs.password:
        credentials = store_credentials.StoreCredentials()
        credentials.username = cmdargs.username
        credentials.password = cmdargs.password
        credentials.stored = True
    else:
        credentials = store_credentials.StoreCredentials()
        credentials.username = config.username
        credentials.password = config.password
        credentials.stored = True
    kwargs['credential_validator'] = credentials

    server = ProxyServer(*args, **kwargs)
    server.run()
Example #3
0
def run(cmdargs):
    args = [(cmdargs.localhost, cmdargs.localport),
            (cmdargs.remotehost, cmdargs.remoteport)]
    kwargs = {}

    if cmdargs.sslboth:
        kwargs['ssl'] = True
    elif cmdargs.sslout:
        kwargs['ssl_out_only'] = True

    if not cmdargs.quiet:
        kwargs['debug'] = True

    server = ProxyServer(*args, **kwargs)
    server.run()
Example #4
0
def run(cmdargs):
    args = [
        (cmdargs.localhost, cmdargs.localport),
        (cmdargs.remotehost, cmdargs.remoteport)
    ]
    kwargs = {}

    if cmdargs.sslboth:
        kwargs['ssl'] = True
    elif cmdargs.sslout:
        kwargs['ssl_out_only'] = True

    if not cmdargs.quiet:
        kwargs['debug'] = True

    server = ProxyServer(*args, **kwargs)
    server.run()
Example #5
0
def run(cmdargs):
    args = [(cmdargs.localhost, cmdargs.localport),
            (cmdargs.remotehost, cmdargs.remoteport)]
    kwargs = {}

    if cmdargs.sslboth:
        kwargs['ssl'] = True
        if not cmdargs.certfile or not cmdargs.keyfile:
            print(
                'You need to specify a valid certificate file and a key file!')
            sys.exit(1)
        kwargs['certfile'] = cmdargs.certfile
        kwargs['keyfile'] = cmdargs.keyfile
    elif cmdargs.sslout:
        kwargs['ssl_out_only'] = True

    if not cmdargs.quiet:
        kwargs['debug'] = True

    server = ProxyServer(*args, **kwargs)
    server.run()
Example #6
0
def run(cmdargs):
    args = [
        (cmdargs.localhost, cmdargs.localport),
        (cmdargs.remotehost, cmdargs.remoteport)
    ]
    kwargs = {}

    if cmdargs.sslboth:
        kwargs['ssl'] = True
        if not cmdargs.certfile or not cmdargs.keyfile:
            print ('You need to specify a valid certificate file and a key file!')
            sys.exit(1)
        kwargs['certfile'] = cmdargs.certfile
        kwargs['keyfile'] = cmdargs.keyfile
    elif cmdargs.sslout:
        kwargs['ssl_out_only'] = True

    if not cmdargs.quiet:
        kwargs['debug'] = True

    server = ProxyServer(*args, **kwargs)
    server.run()