From 2665445dd8562b1f65ab57705cd540ad4806fa12 Mon Sep 17 00:00:00 2001 From: Mikaela Suomalainen Date: Mon, 11 Oct 2021 10:39:36 +0300 Subject: [PATCH] python/ssid-valid-len.py: initial commit Ref: #31 --- python/ssid-valid-len.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100755 python/ssid-valid-len.py diff --git a/python/ssid-valid-len.py b/python/ssid-valid-len.py new file mode 100755 index 0000000..b484ecb --- /dev/null +++ b/python/ssid-valid-len.py @@ -0,0 +1,19 @@ +#!/usr/bin/env python3 + +''' +This script asks for a SSID name, counts it and tells whether it's of valid +length +''' + +# Request input +givenssid = input("Please enter the SSID you are thinking of: ") +#givenssid = "test_nomap" + +# Ensure it's UTF-8 and store the size. E.g. åäö are longer than oao +givenssidlen = len(givenssid.encode("utf8")) + +# 32 bytes should be the maximum SSID length +if givenssidlen <= 32: + print(givenssid, "is", givenssidlen, "long and thus valid length") +else: + print("Too long, try again")