From 00e238384b23fb1f79a8273626b3e4bf42859bf5 Mon Sep 17 00:00:00 2001 From: boyska Date: Sat, 9 Oct 2021 20:36:14 +0200 Subject: [PATCH] wsclient: add --no-ssl-verify --- utils/wsclient.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/utils/wsclient.py b/utils/wsclient.py index 59ff065..e6ea682 100755 --- a/utils/wsclient.py +++ b/utils/wsclient.py @@ -1,11 +1,20 @@ #!/usr/bin/python3 -u import argparse +import ssl import websocket def get_parser(): p = argparse.ArgumentParser() + p.add_argument( + "-k", + "--no-ssl-verify", + action="store_false", + default=True, + dest="ssl_verify", + help="Disable SSL verify", + ) p.add_argument( "--trace", action="store_true", default=False, help="Extra debugging" ) @@ -22,7 +31,10 @@ def main(): websocket.enableTrace(args.trace) wsapp = websocket.WebSocketApp(args.url, on_message=on_message) - wsapp.run_forever() + run_opts = {} + if not args.ssl_verify: + run_opts = {"sslopt": {"cert_reqs": ssl.CERT_NONE}} + wsapp.run_forever(**run_opts) if __name__ == "__main__":