xyven1 / wpi-wireless-install

Install script for WPI wireless
MIT License
0 stars 0 forks source link

What is the origin (copyright) and license for this code? #1

Open yarikoptic opened 1 month ago

xyven1 commented 3 weeks ago

License is MIT and the origin is WPI. Added to license to repo.

yarikoptic commented 3 weeks ago

interesting... this is a code base I found within an install script for "enabling new eduroam" configuration we were provided at Dartmouth College. Are you or WPI is the official developer for that ????

xyven1 commented 3 weeks ago

Oh interesting, I guess I do not know the origin of this script then. This is the install script for setting up a device for WPI networks, so I guess the underlying code is the same, it probably just differs by the SecureW2.cloudconfig file.

xyven1 commented 3 weeks ago

A little more exploring reveals that this script is used across many many universities, and likely originates from SecureW2? Not sure. Anyways, since the origin of this exact code was WPI, I will leave that in the repo for now, unless I can find a more direct source...

xyven1 commented 3 weeks ago

Maybe this script can be made generic over the SecureW2.cloudconfig file, should be easy to do...

xyven1 commented 3 weeks ago

Ok, it is now generic, but I have a feeling that the SecureW2.cloudconfig is not directly accessible for most universities, but rather bundled with the script, so the utility is limited. Maybe an auto extract feature could be nice?

xyven1 commented 3 weeks ago

Also @yarikoptic can you share the source code for Dartmouth? I want to a do a quick diff and see if there any substantive changes

yarikoptic commented 3 weeks ago

well -- that was the reason for my inquiry -- can this code be shared at all? in the zip I got there were no license etc (so not sure where MIT came up here ;-) ).

here is the output of

diff -x SecureW2.cloudconfig -Naur wpi-wireless-install/eduroam_install/actions.py SecureW2_JoinNow/actions.py

--- wpi-wireless-install/eduroam_install/actions.py 2024-09-30 17:58:56.305845227 -0400
+++ SecureW2_JoinNow/actions.py 2022-11-24 08:13:50.000000000 -0500
@@ -7,16 +7,16 @@
 from textwrap import wrap
 from time import sleep

-from eduroam_install import websso
-from eduroam_install.dbusproxies import NetworkManagerProxy
-from eduroam_install.enroll import enroll, TPMRequired
-from eduroam_install.enrollapi import ConnectorError, EnrollmentException
-from eduroam_install.keystore import Certificate
-from eduroam_install.paladindefs import *
-from eduroam_install.reporter import PaladinCloudReporter
-from eduroam_install.resourcemanager import load_resources
-from eduroam_install.ui import Buttons
-from eduroam_install.xmlhelper import CloudConfigNodeWrapper
+import websso
+from dbusproxies import NetworkManagerProxy
+from enroll import enroll, TPMRequired
+from enrollapi import ConnectorError, EnrollmentException
+from keystore import Certificate
+from paladindefs import *
+from reporter import PaladinCloudReporter
+from resourcemanager import load_resources
+from ui import Buttons
+from xmlhelper import CloudConfigNodeWrapper

 MAX_FILENAME_SIZE = 127     # Based on max 255 bytes assuming worst case scenario of 2 bytes per unicode character
@@ -409,7 +409,7 @@
             raise InternalActionError(self, 'webSSOConfirmType %d not supported' % auth_type)

         # HACK: When using the console UI, have a separate 'window' for the device name prompt
-        from eduroam_install.ui import ConsoleUI
+        from ui import ConsoleUI

         if type(ui) == ConsoleUI and self.prompt_for_device_name():
             window = ui.window()
diff -x SecureW2.cloudconfig -Naur wpi-wireless-install/eduroam_install/client.py SecureW2_JoinNow/client.py
--- wpi-wireless-install/eduroam_install/client.py  2024-09-30 17:58:56.305845227 -0400
+++ SecureW2_JoinNow/client.py  2022-11-24 08:13:53.000000000 -0500
@@ -1,31 +1,32 @@
-import os
 import re
 import xml.etree.ElementTree as ET
 from locale import getdefaultlocale
 from subprocess import Popen, PIPE

-from eduroam_install.pycompat import getargspec, urlopen, URLError
+from pycompat import getargspec, urlopen, URLError

 VERSION = '3.0.2'
 NAME    = 'JoinNow for Linux'

-from eduroam_install.actions import ActionFactory, NoneAction, ActionError, InternalActionError
-from eduroam_install.logger import function_logger
-from eduroam_install.paladindefs import SW2_PALADIN_REPORT_HANDLER_CLOUD
-from eduroam_install.reporter import PaladinCloudReporter
-from eduroam_install.resourcemanager import load_resources
-from eduroam_install.ui import ui, Buttons
+from actions import ActionFactory, NoneAction, ActionError, InternalActionError
+from logger import function_logger
+from paladindefs import SW2_PALADIN_REPORT_HANDLER_CLOUD
+from reporter import PaladinCloudReporter
+from resourcemanager import load_resources
+from ui import ui, Buttons

 class PaladinLinuxClient(object):
     """SecureW2 JoinNow Linux Client Implementation"""
-    def __init__(self, config_file):
+    CONFIG_FILE = 'SecureW2.cloudconfig'
+
+    def __init__(self):
         self.devicecfg       = None
         self.organization    = None
         self.actions         = []
         self.locales         = []

-        config_file = self.decipher(config_file)
+        config_file = self.decipher(self.CONFIG_FILE)
         config_file = self.strip_namespace(config_file)
         self.load_config(config_file)

diff -x SecureW2.cloudconfig -Naur wpi-wireless-install/eduroam_install/dbusproxies.py SecureW2_JoinNow/dbusproxies.py
--- wpi-wireless-install/eduroam_install/dbusproxies.py 2024-09-30 17:58:56.305845227 -0400
+++ SecureW2_JoinNow/dbusproxies.py 2022-07-28 09:29:32.000000000 -0400
@@ -3,9 +3,9 @@
 from time import sleep
 from dbus.exceptions import DBusException

-from eduroam_install.pycompat import time, _long
+from pycompat import time, _long

-from eduroam_install.detect import wpa_supplicant_version
+from detect import wpa_supplicant_version

 def dbus_path(path):
     if path != None and len(path) > 0:
diff -x SecureW2.cloudconfig -Naur wpi-wireless-install/eduroam_install/detect.py SecureW2_JoinNow/detect.py
--- wpi-wireless-install/eduroam_install/detect.py  2024-09-30 17:58:56.305845227 -0400
+++ SecureW2_JoinNow/detect.py  2022-07-28 09:29:32.000000000 -0400
@@ -1,12 +1,12 @@
 from ctypes import CDLL
 from fnmatch import fnmatch
-from os import access, listdir, path, walk, X_OK, getenv
+from os import access, listdir, path, walk, X_OK
 from subprocess import check_call, Popen, CalledProcessError, PIPE, STDOUT

 VERBOSE_DETECT = False

-# get dirs from $PATH
-BIN_DIRS = getenv('PATH').split(":")
+BIN_DIRS = [ '/bin', '/usr/bin', '/usr/local/bin' ]
+SBIN_DIRS = BIN_DIRS + [ '/sbin', '/usr/sbin', '/usr/local/sbin' ]
 LIB_DIRS = [ '/lib', '/usr/local/lib', '/usr/lib', '/usr/lib/x86_64-pc-linux-gnu', '/usr/lib/x86_64-linux-gnu', '/usr/lib/i686-pc-linux-gnu', '/usr/lib/i686-linux-gnu', '/usr/lib/i386-pc-linux-gnu', '/usr/lib/i386-linux-gnu' ]

@@ -58,8 +58,8 @@
     def __str__(self):
         return self.path

-def detect_executable(name):
-    for dir in BIN_DIRS:
+def detect_executable(name, dirs=BIN_DIRS):
+    for dir in dirs:
         exepath = path.join(dir, name)
         if path.isfile(exepath) and access(exepath, X_OK):
             return Executable(exepath)
@@ -95,7 +95,7 @@

 def wpa_supplicant_version():
     try:
-        wpa_supplicant = detect_executable('wpa_supplicant')
+        wpa_supplicant = detect_executable('wpa_supplicant', dirs=SBIN_DIRS)
     except ExecutableNotFoundError:
         return 0.0

diff -x SecureW2.cloudconfig -Naur wpi-wireless-install/eduroam_install/enrollapi.py SecureW2_JoinNow/enrollapi.py
--- wpi-wireless-install/eduroam_install/enrollapi.py   2024-09-30 17:58:56.305845227 -0400
+++ SecureW2_JoinNow/enrollapi.py   2022-07-28 09:29:32.000000000 -0400
@@ -3,10 +3,10 @@
 from json import loads, dumps
 from os import urandom

-from eduroam_install.pycompat import urlopen, Request as HttpRequest, URLError, HTTPError
-from eduroam_install.pycompat import JSONDecodeError
+from pycompat import urlopen, Request as HttpRequest, URLError, HTTPError
+from pycompat import JSONDecodeError

-from eduroam_install.sslengine import SSLEngineError
+from sslengine import SSLEngineError

 VERSION = '1.4'
diff -x SecureW2.cloudconfig -Naur wpi-wireless-install/eduroam_install/enroll.py SecureW2_JoinNow/enroll.py
--- wpi-wireless-install/eduroam_install/enroll.py  2024-09-30 17:58:56.305845227 -0400
+++ SecureW2_JoinNow/enroll.py  2022-07-28 09:29:32.000000000 -0400
@@ -3,8 +3,8 @@
 from hashlib import sha1
 from os import getpid

-from eduroam_install.enrollapi import Connector, ChallengeRequest, EnrollmentRequest, PasswordAuthentication, EnrollmentException
-from eduroam_install.keystore import KeyStore, SoftwareStore, TPMEnhancedSoftwareStore, Certificate, PrivateKeyExists
+from enrollapi import Connector, ChallengeRequest, EnrollmentRequest, PasswordAuthentication, EnrollmentException
+from keystore import KeyStore, SoftwareStore, TPMEnhancedSoftwareStore, Certificate, PrivateKeyExists

 class TPMRequired(EnrollmentException):
     pass
diff -x SecureW2.cloudconfig -Naur wpi-wireless-install/eduroam_install/__init__.py SecureW2_JoinNow/__init__.py
--- wpi-wireless-install/eduroam_install/__init__.py    2024-09-30 17:58:56.305845227 -0400
+++ SecureW2_JoinNow/__init__.py    1969-12-31 19:00:00.000000000 -0500
@@ -1,2 +0,0 @@
-__license__ = "MIT"
-
diff -x SecureW2.cloudconfig -Naur wpi-wireless-install/eduroam_install/keystore.py SecureW2_JoinNow/keystore.py
--- wpi-wireless-install/eduroam_install/keystore.py    2024-09-30 17:58:56.305845227 -0400
+++ SecureW2_JoinNow/keystore.py    2022-07-28 09:29:32.000000000 -0400
@@ -6,10 +6,10 @@
 from textwrap import wrap
 from os import environ, makedirs, path, unlink

-from eduroam_install.pycompat import FILETYPES
+from pycompat import FILETYPES

-from eduroam_install.sslengine import generate_software_key, generate_tpm_key, key_valid, encrypt_private_key, generate_csr, sign_raw_data, detect_tpm, read_certificate, read_certificate_file, SSLEngineError
-from eduroam_install.secrets import SecretStorage, generate_temporary_secret
+from sslengine import generate_software_key, generate_tpm_key, key_valid, encrypt_private_key, generate_csr, sign_raw_data, detect_tpm, read_certificate, read_certificate_file, SSLEngineError
+from secrets import SecretStorage, generate_temporary_secret

 class PrivateKeyExists(Exception):
     pass
diff -x SecureW2.cloudconfig -Naur wpi-wireless-install/eduroam_install/main.py SecureW2_JoinNow/main.py
--- wpi-wireless-install/eduroam_install/main.py    2024-09-30 17:58:56.305845227 -0400
+++ SecureW2_JoinNow/main.py    2022-07-28 09:29:32.000000000 -0400
@@ -1,89 +1,74 @@
-#!/usr/bin/python
-
-import os
-import sys
-import subprocess
-from subprocess import Popen, PIPE, STDOUT, CalledProcessError
-
-INTERPRETER_AUTODETECTION_FLAG = '--interpreter-detect'
-INTERPRETER_AUTODETECTION_VERBOSE_FLAG = '--verbose-detect'
-EXECUTABLE_AUTODETECTION_VERSION_FLAG = '--verbose-detect-external'
-ALL_AUTODETECTION_VERSION_FLAG = '--verbose-detect-all'
-EXCEPTION_BACKTRACE_FLAG = '--backtrace'
-ALL_EXCEPTIONS_BACKTRACE_FLAG = '--backtrace-all'
-
-#
-#  Work-around for certain libraries not being available
-#  for all installed python versions on some distros
-#
-def valid_interpreter(path):
-    exebasename = os.path.basename(path)
-    return  exebasename.startswith('python') and \
-            (len(exebasename) == 6 or exebasename[6] in ['2', '3' ]) and \
-            not '-' in exebasename and \
-            os.path.isfile(path) and \
-            os.access(path, os.X_OK)
-
-def safe_listdir(path):
-    try:
-        return os.listdir(path)
-    except OSError:
-        return []
-
-def find_all_interpreters():
-    return sorted(filter(lambda e: valid_interpreter(e), [ path + os.path.sep + filename for path in os.environ['PATH'].split(os.pathsep) for filename in safe_listdir(path) ]))
-
-def run():
-    # first argument shold be path to config file
-    if len(sys.argv) < 2:
-        print('Usage: eduroam-install  <config-file>')
-        sys.exit(1)
-
-    config_file = sys.argv[1]
-
-    if not os.path.isfile(config_file):
-        print('Error: Config file not found: ' + config_file)
-        sys.exit(1)
-
-    autodetecting = INTERPRETER_AUTODETECTION_FLAG in sys.argv
-
-    try:
-        from eduroam_install import logger
-        from eduroam_install.logger import ConsoleLogger, FileLogger
-        from eduroam_install.client import PaladinLinuxClient
-
-    except ImportError as e:
-        if autodetecting:
-            raise
-        with open(os.devnull, 'w') as devnull:
-            stdout = devnull if not INTERPRETER_AUTODETECTION_VERBOSE_FLAG in sys.argv and not ALL_AUTODETECTION_VERSION_FLAG in sys.argv else None
-            for interpreter in find_all_interpreters():
-                args = [ interpreter, os.path.abspath(sys.argv[0]) ] + sys.argv[1:]
-                try:
-                    subprocess.check_call(args + [ INTERPRETER_AUTODETECTION_FLAG ], stdout=stdout, stderr=STDOUT)
-                except CalledProcessError:
-                    continue
-                if INTERPRETER_AUTODETECTION_VERBOSE_FLAG in sys.argv or ALL_AUTODETECTION_VERSION_FLAG in sys.argv:
-                    print('Re-launching using command line: ' + ' '.join(args))
-                os.execv(args[0], args)
-        print('Error: One or more required python libraries have not been installed: ' + str(e))
-        sys.exit(1)
-
-    if not autodetecting:
-        logger.register(ConsoleLogger())
-        logger.register(FileLogger())
-
-        if EXECUTABLE_AUTODETECTION_VERSION_FLAG in sys.argv or ALL_AUTODETECTION_VERSION_FLAG in sys.argv:
-            from eduroam_install import detect
-            detect.VERBOSE_DETECT = True
-
-        try:
-            PaladinLinuxClient(config_file).run(mask_exceptions=(not EXCEPTION_BACKTRACE_FLAG in sys.argv and not ALL_EXCEPTIONS_BACKTRACE_FLAG in sys.argv), handle_errors=(not ALL_EXCEPTIONS_BACKTRACE_FLAG in sys.argv))
-        except KeyboardInterrupt as e:
-            print('')
-            sys.exit(1)
-        finally:
-            logger.shutdown()
-
-if __name__ == '__main__':
-    run()
+#!/usr/bin/python
+
+import os
+import sys
+import subprocess
+from subprocess import Popen, PIPE, STDOUT, CalledProcessError
+
+INTERPRETER_AUTODETECTION_FLAG = '--interpreter-detect'
+INTERPRETER_AUTODETECTION_VERBOSE_FLAG = '--verbose-detect'
+EXECUTABLE_AUTODETECTION_VERSION_FLAG = '--verbose-detect-external'
+ALL_AUTODETECTION_VERSION_FLAG = '--verbose-detect-all'
+EXCEPTION_BACKTRACE_FLAG = '--backtrace'
+ALL_EXCEPTIONS_BACKTRACE_FLAG = '--backtrace-all'
+
+#
+#  Work-around for certain libraries not being available
+#  for all installed python versions on some distros
+#
+def valid_interpreter(path):
+    exebasename = os.path.basename(path)
+    return  exebasename.startswith('python') and \
+            (len(exebasename) == 6 or exebasename[6] in ['2', '3' ]) and \
+            not '-' in exebasename and \
+            os.path.isfile(path) and \
+            os.access(path, os.X_OK)
+
+def safe_listdir(path):
+    try:
+        return os.listdir(path)
+    except OSError:
+        return []
+
+def find_all_interpreters():
+    return sorted(filter(lambda e: valid_interpreter(e), [ path + os.path.sep + filename for path in os.environ['PATH'].split(os.pathsep) for filename in safe_listdir(path) ]))
+
+autodetecting = INTERPRETER_AUTODETECTION_FLAG in sys.argv
+
+try:
+    import logger
+    from logger import ConsoleLogger, FileLogger
+    from client import PaladinLinuxClient
+
+except ImportError as e:
+    if autodetecting:
+        raise
+    with open(os.devnull, 'w') as devnull:
+        stdout = devnull if not INTERPRETER_AUTODETECTION_VERBOSE_FLAG in sys.argv and not ALL_AUTODETECTION_VERSION_FLAG in sys.argv else None
+        for interpreter in find_all_interpreters():
+            args = [ interpreter, os.path.abspath(sys.argv[0]) ] + sys.argv[1:]
+            try:
+                subprocess.check_call(args + [ INTERPRETER_AUTODETECTION_FLAG ], stdout=stdout, stderr=STDOUT)
+            except CalledProcessError:
+                continue
+            if INTERPRETER_AUTODETECTION_VERBOSE_FLAG in sys.argv or ALL_AUTODETECTION_VERSION_FLAG in sys.argv:
+                print('Re-launching using command line: ' + ' '.join(args))
+            os.execv(args[0], args)
+    print('Error: One or more required python libraries have not been installed: ' + str(e))
+    sys.exit(1)
+
+if not autodetecting:
+    logger.register(ConsoleLogger())
+    logger.register(FileLogger())
+
+    if EXECUTABLE_AUTODETECTION_VERSION_FLAG in sys.argv or ALL_AUTODETECTION_VERSION_FLAG in sys.argv:
+        import detect
+        detect.VERBOSE_DETECT = True
+
+    try:
+        PaladinLinuxClient().run(mask_exceptions=(not EXCEPTION_BACKTRACE_FLAG in sys.argv and not ALL_EXCEPTIONS_BACKTRACE_FLAG in sys.argv), handle_errors=(not ALL_EXCEPTIONS_BACKTRACE_FLAG in sys.argv))
+    except KeyboardInterrupt as e:
+        print('')
+        sys.exit(1)
+    finally:
+        logger.shutdown()
diff -x SecureW2.cloudconfig -Naur wpi-wireless-install/eduroam_install/netdev.py SecureW2_JoinNow/netdev.py
--- wpi-wireless-install/eduroam_install/netdev.py  2024-09-30 17:58:56.305845227 -0400
+++ SecureW2_JoinNow/netdev.py  2022-07-28 09:29:32.000000000 -0400
@@ -1,6 +1,6 @@
 from socket import socket, AF_INET, SOCK_DGRAM
 from fcntl import ioctl
-from eduroam_install.memutils import int_val, ptr_val, cstr_val
+from memutils import int_val, ptr_val, cstr_val

 """

diff -x SecureW2.cloudconfig -Naur wpi-wireless-install/eduroam_install/reporter.py SecureW2_JoinNow/reporter.py
--- wpi-wireless-install/eduroam_install/reporter.py    2024-09-30 17:58:56.305845227 -0400
+++ SecureW2_JoinNow/reporter.py    2022-07-28 09:29:32.000000000 -0400
@@ -4,11 +4,11 @@
 from hashlib import sha1
 from subprocess import Popen, PIPE

-from eduroam_install.pycompat import httplib
+from pycompat import httplib

-from eduroam_install.dbusproxies import NetworkManagerProxy
-from eduroam_install.client import NAME, VERSION
-from eduroam_install.netdev import get_real_hwaddress
+from dbusproxies import NetworkManagerProxy
+from client import NAME, VERSION
+from netdev import get_real_hwaddress

 class PaladinCloudReporter(object):
diff -x SecureW2.cloudconfig -Naur wpi-wireless-install/eduroam_install/secrets.py SecureW2_JoinNow/secrets.py
--- wpi-wireless-install/eduroam_install/secrets.py 2024-09-30 17:58:56.305845227 -0400
+++ SecureW2_JoinNow/secrets.py 2022-07-28 09:29:32.000000000 -0400
@@ -42,7 +42,7 @@

 class FreeDesktopSecretStorage(object):
     def __init__(self):
-        from eduroam_install.dbusproxies import SecretsServiceProxy
+        from dbusproxies import SecretsServiceProxy
         self.service = SecretsServiceProxy()

     def generate_private_key_secret(self, certificate):
@@ -81,7 +81,7 @@
         dbuslogger.setLevel(logging.CRITICAL)

         try:
-            from eduroam_install.dbusproxies import SecretsServiceProxy
+            from dbusproxies import SecretsServiceProxy
             secrets_service = SecretsServiceProxy()
             with secrets_service.session() as session:
                 collection = secrets_service.default_collection(session)
diff -x SecureW2.cloudconfig -Naur wpi-wireless-install/eduroam_install/sslengine.py SecureW2_JoinNow/sslengine.py
--- wpi-wireless-install/eduroam_install/sslengine.py   2024-09-30 17:58:56.309845247 -0400
+++ SecureW2_JoinNow/sslengine.py   2022-11-24 08:13:53.000000000 -0500
@@ -5,7 +5,7 @@
 from subprocess import check_call, CalledProcessError
 from tempfile import TemporaryFile, NamedTemporaryFile

-from eduroam_install.detect import detect_executable, ExecutableNotFoundError, ExternalExecutionError
+from detect import detect_executable, ExecutableNotFoundError, ExternalExecutionError

 OPENSSL_CSR_CLIENT_CERT_CONFIG = """
 [req]
diff -x SecureW2.cloudconfig -Naur wpi-wireless-install/eduroam_install/ui.py SecureW2_JoinNow/ui.py
--- wpi-wireless-install/eduroam_install/ui.py  2024-09-30 17:58:56.309845247 -0400
+++ SecureW2_JoinNow/ui.py  2022-07-28 09:29:32.000000000 -0400
@@ -1,6 +1,6 @@
 from getpass import getpass as _getpass

-from eduroam_install.pycompat import _raw_input as __raw_input
+from pycompat import _raw_input as __raw_input

 _ui = None

diff -x SecureW2.cloudconfig -Naur wpi-wireless-install/eduroam_install/websso_backends.py SecureW2_JoinNow/websso_backends.py
--- wpi-wireless-install/eduroam_install/websso_backends.py 2024-09-30 17:58:56.309845247 -0400
+++ SecureW2_JoinNow/websso_backends.py 2022-07-29 07:35:05.000000000 -0400
@@ -1,9 +1,9 @@
 from os import environ, getcwd, mkdir

-from eduroam_install.pycompat import parse_qsl
+from pycompat import parse_qsl

-from eduroam_install.detect import detect_executable, ExecutableNotFoundError, ExternalExecutionError, VERBOSE_DETECT
-from eduroam_install.dbusproxies import GnomeShellProxy, GnomeShellScriptExecutionException, DBusException
+from detect import detect_executable, ExecutableNotFoundError, ExternalExecutionError, VERBOSE_DETECT
+from dbusproxies import GnomeShellProxy, GnomeShellScriptExecutionException, DBusException

 class WebSSOError(Exception):
@@ -80,7 +80,7 @@
     def __init__(self):
         super(XWinInfoWindowScanner, self).__init__()
         try:
-            from eduroam_install.x11 import WindowManager
+            from x11 import WindowManager
             self.window_manager = WindowManager()
         except ImportError:
             raise
diff -x SecureW2.cloudconfig -Naur wpi-wireless-install/eduroam_install/websso.py SecureW2_JoinNow/websso.py
--- wpi-wireless-install/eduroam_install/websso.py  2024-09-30 17:58:56.309845247 -0400
+++ SecureW2_JoinNow/websso.py  2022-11-10 07:18:40.000000000 -0500
@@ -1,8 +1,8 @@
 from time import sleep
 from uuid import uuid4

-from eduroam_install.paladindefs import *
-from eduroam_install.pycompat import parse_qsl, urlencode, urlparse, urlunparse
+from paladindefs import *
+from pycompat import parse_qsl, urlencode, urlparse, urlunparse

 OAUTH_OOB_URN = 'urn:ietf:wg:oauth:2.0:oob:auto'
@@ -35,7 +35,7 @@

 def try_find_browser():
     try:
-        from eduroam_install.websso_backends import BrowserLauncher
+        from websso_backends import BrowserLauncher
         return BrowserLauncher()
     except ImportError as e:
         raise NoBackendFoundException(e)
@@ -84,7 +84,7 @@

     if confirm_type == SW2_PALADIN_TLS_ENROLL_WEBSSO_CONFIRM_TYPE_SCAN_TBAR:
         try:
-            from eduroam_install.websso_backends import WindowScanner
+            from websso_backends import WindowScanner
         except ImportError as e:
             raise NoBackendFoundException(str(e))

@@ -128,7 +128,7 @@
                 # (Depends if a window scanner is available and the browser is running under the correct window manager/compositor)
                 # Ignore any errors.
                 #
-                from eduroam_install.websso_backends import FallbackWindowScanner
+                from websso_backends import FallbackWindowScanner
                 windows = []
                 attempts = 5
                 while len(windows) == 0 and attempts > 0:
diff -x SecureW2.cloudconfig -Naur wpi-wireless-install/eduroam_install/x11.py SecureW2_JoinNow/x11.py
--- wpi-wireless-install/eduroam_install/x11.py 2024-09-30 17:58:56.309845247 -0400
+++ SecureW2_JoinNow/x11.py 2022-07-28 09:29:32.000000000 -0400
@@ -2,8 +2,8 @@
 from ctypes import c_void_p, c_char_p, c_int, c_uint, c_long, c_ulong
 from struct import pack

-from eduroam_install.detect import detect_library, LibraryNotFoundError
-from eduroam_install.memutils import int_size, long_size, ptr_size
+from detect import detect_library, LibraryNotFoundError
+from memutils import int_size, long_size, ptr_size

 class X_Atom(c_ulong):
     pass

so seems like the addition of the eduroam_install. package in imports

xyven1 commented 2 weeks ago

Ok, I think it should work no problem. Download the zip, locate the cloud config, and then run

nix run github:xyven1/wpi-wireless-install -- ./path/to/SecureW2.cloudconfig

Also, the code in the zip that we get has the license in __init__.py

yarikoptic commented 2 weeks ago

thanks! but getting back to original question -- can this code be shared as here in this repo or someone in a dark suit would track you down with some form of the Cease and desist letter for this repo?

xyven1 commented 2 weeks ago

Not sure to be honest. I assume it would be SecureW2 who would make the claim, and I honestly don't know where the code originates from. I would replace the MIT license and with something less permissive, but I'm not sure who to put as the owner. Best thing would probably be to directly reach out to them and ask if/in what form this code can exist in the repo.

On the other hand, I could just degrade this repo to a buildFHSUserEnv shell, which would allow anyone to run their respective SecureW2 script without any risk of infringement (no more nix run ..., but a maybe a more sophisticated wrapper could be made to restore the ease of use). I did have to patch the script in a few places to get it to work at all, but that is probably fixed upstream.