def main(): """ Entry point for the REST API :return: Zero if everything went well """ try: args = process_cmd_args_config(app) except argparse.ArgumentTypeError, ate: print('%s' % ate) return 1 # And finally start the app: try: if args.disable_ssl: app.run(host=app.config['HOST'], port=app.config['PORT'], debug=args.verbose, use_reloader=False, threaded=True) else: cert_key = SSLCertificate().get_cert_key(app.config['HOST']) app.run(host=app.config['HOST'], port=app.config['PORT'], debug=args.verbose, use_reloader=False, threaded=True, ssl_context=cert_key) except socket.error, se: print('Failed to start REST API server: %s' % se.strerror) return 1 return 0
Entry point for the REST API :return: Zero if everything went well """ try: args = process_cmd_args_config(app) except argparse.ArgumentTypeError, ate: print('%s' % ate) return 1 # And finally start the app: try: if args.disable_ssl: app.run(host=app.config['HOST'], port=app.config['PORT'], debug=args.verbose, use_reloader=False, threaded=True) else: cert_key = SSLCertificate().get_cert_key(app.config['HOST']) app.run(host=app.config['HOST'], port=app.config['PORT'], debug=args.verbose, use_reloader=False, threaded=True, ssl_context=cert_key) except socket.error, se: print('Failed to start REST API server: %s' % se.strerror) return 1
# Check if I have all needed dependencies dependency_check() try: args = process_cmd_args_config(app) except argparse.ArgumentTypeError, ate: print('%s' % ate) return 1 # And finally start the app: try: if args.disableSSL: app.run(host=app.config['HOST'], port=app.config['PORT'], debug=args.verbose, use_reloader=False, threaded=True) else: app.run(host=app.config['HOST'], port=app.config['PORT'], debug=args.verbose, use_reloader=False, threaded=True, ssl_context=SSLCertifiacate().get()) except socket.error, se: print('Failed to start REST API server: %s' % se.strerror) return 1 return 0
def main(): """ Entry point for the REST API :return: Zero if everything went well """ # Check if I have all needed dependencies dependency_check() try: args = process_cmd_args_config(app) except argparse.ArgumentTypeError, ate: print('%s' % ate) return 1 # And finally start the app: try: if args.disableSSL: app.run(host=app.config['HOST'], port=app.config['PORT'], debug=args.verbose, use_reloader=False, threaded=True) else: app.run(host=app.config['HOST'], port=app.config['PORT'], debug=args.verbose, use_reloader=False, threaded=True, ssl_context=SSLCertifiacate().get()) except socket.error, se: print('Failed to start REST API server: %s' % se.strerror) return 1 return 0
app.config['PORT']) except argparse.ArgumentTypeError, ate: print('%s' % ate) return 1 if (app.config['HOST'] != '127.0.0.1' and app.config['HOST'] != 'localhost'): print('') if not 'PASSWORD' in app.config: print('CAUTION! Running this API on a public IP might expose your' ' system to vulnerabilities such as arbitrary file reads' ' through file:// protocol specifications in target URLs and' ' scan profiles.\n' 'We recommend enabling HTTP basic authentication by' ' specifying a password on the command line (with' ' "-p <SHA512 hash>") or in a configuration file.\n') print('CAUTION! Traffic to this API is not encrypted and could be' ' sniffed. Please consider serving it behind an SSL-enabled' ' proxy server.\n') try: app.run(host=app.config['HOST'], port=app.config['PORT'], debug=args.verbose, use_reloader=False) except socket.error, se: print('Failed to start REST API server: %s' % se.strerror) return 1 return 0