# uncompyle6 version 3.9.3 # Python bytecode version base 2.6 (62161) # Decompiled from: Python 3.9.25 (main, Oct 31 2025, 23:16:49) # [GCC 14.2.0] # Embedded file name: user_config_network.pyc # Compiled at: 2025-05-07 14:29:41 import wx, os, data_model, traceback, one_unit, ConfigParser, protocol, sys, select_keys, select_units, d_protocol, mytime from user_config_helpers import * inactivityChoices = [ 3, 4, 5, 6, 7, 8, 9, 10] class networkConfiguration(wx.Panel): def __init__(self, parent, frame, uiNumber, panelName): self.frame = frame self.name = panelName self.uiNumber = uiNumber self.parent = parent wx.Panel.__init__(self, parent, size=(964, 600)) self.Show(True) self.lines = {} self.initFinished = False return def initMe(self, force=False): if self.IsShown() == False: return if self.initFinished == True: return 0 print mytime.displayTime(), 'ucn.initMe networkConfiguration', self.name frame = self.frame uiNumber = self.uiNumber self.lines = {0: (self.createLine(0)), 1: (self.createLine(1)), 2: (self.createLine(2)), 3: (self.createLine(3)), 4: (self.createLine(4))} optkey = data_model.Key(protocol.STRUCT_ID_GLOBAL, protocol.MEMBER_ID_HARDWARE_STATUS_FLAGS, 0, 0) try: hardwareStatusFlags = int(self.frame.frame.parent.model.get(optkey)) if hardwareStatusFlags & protocol.confTelnetEnabled == protocol.confTelnetEnabled: self.lines[0].enableTelnet.SetValue(1) else: self.lines[0].enableTelnet.SetValue(0) except: pass self.checkBoxes = {} self.uiKeys = getKeys(frame, uiNumber) self.encryptionKey = '' self.milanKey = '' for uiIndex in self.uiKeys: (key, val) = self.uiKeys[uiIndex] if val[1] == 0: line = self.lines[0] line.key = key flags = val[2] if flags & 1 == 1: line.enableTEA.SetValue(1) else: line.enableTEA.SetValue(0) if flags & 2 == 2: line.enableBroadcast.SetValue(1) else: line.enableBroadcast.SetValue(0) if flags & 4 == 4: line.stopWhenMFPActive.SetValue(1) else: line.stopWhenMFPActive.SetValue(0) if flags & 8 == 8: line.stopWhenTelnetActive.SetValue(1) else: line.stopWhenTelnetActive.SetValue(0) if flags & 16 == 16: line.enableBasicTelnet.SetValue(0) else: line.enableBasicTelnet.SetValue(1) if flags & 96 == 32: line.switchInput.SetStringSelection(getString('installed')) if flags & 96 == 64: line.switchInput.SetStringSelection(getString('notInstalled')) timeoutValue = val[3] line.timeoutInput.SetStringSelection(inactivityChoices[timeoutValue]) nibble = '' + chr(val[4]) + chr(val[5]) + chr(val[6]) + chr(val[7]) self.encryptionKey = nibble + self.encryptionKey[4:] if val[1] == 1: line = self.lines[1] line.key = key nibble = '' + chr(val[2]) + chr(val[3]) + chr(val[4]) + chr(val[5]) + chr(val[6]) + chr(val[7]) self.encryptionKey = self.encryptionKey[:4] + nibble + self.encryptionKey[10:] if val[1] == 2: line = self.lines[2] line.key = key nibble = '' + chr(val[2]) + chr(val[3]) + chr(val[4]) + chr(val[5]) + chr(val[6]) + chr(val[7]) self.encryptionKey = self.encryptionKey[:10] + nibble if val[1] == 3: line = self.lines[3] line.key = key flags = val[2] if flags & 1 == 1: self.lines[0].avbMode.SetStringSelection('MILAN') else: self.lines[0].avbMode.SetStringSelection('Disabled') nibble = '' + chr(val[4]) + chr(val[5]) + chr(val[6]) + chr(val[7]) self.milanKey = nibble + self.milanKey[4:] if val[1] == 4: line = self.lines[4] line.key = key nibble = '' + chr(val[2]) + chr(val[3]) + chr(val[4]) + chr(val[5]) self.milanKey = self.milanKey[:4] + nibble if self.encryptionKey.strip() == '': self.encryptionKey = '' if self.milanKey.strip() == '': self.milanKey = '' self.lines[0].keyInput.SetValue(self.encryptionKey) self.lines[0].milanKey.SetValue(self.milanKey) self.enable(self.lines[0]) self.initFinished = True self.Show(True) return def createLine(self, lineNumber): p = wx.Panel(self, size=(924, 440)) p.Show(False) networkPanel = wx.Panel(p, size=(884, 100), pos=(10, 10)) telnetPanel = wx.Panel(p, size=(884, 110), pos=(10, 120)) switchPanel = wx.Panel(p, size=(884, 60), pos=(10, 240)) milanPanel = wx.Panel(p, size=(884, 60), pos=(10, 320)) if lineNumber == 0: p.enableBroadcast = wx.CheckBox(networkPanel, 0, 'Enable Device Discovery Broadcast', pos=(13, 10)) p.enableBroadcast.SetValue(True) p.stopWhenMFPActive = wx.CheckBox(networkPanel, 3, 'Stop when AllControl is connected', pos=(33, 40)) p.stopWhenMFPActive.SetValue(False) p.stopWhenTelnetActive = wx.CheckBox(networkPanel, 4, 'Stop when Open Interface (Telnet) is connected', pos=(33, 70)) p.stopWhenTelnetActive.SetValue(False) p.telnetLabel = wx.StaticText(telnetPanel, -1, '3rd Party Control (Telnet)', pos=(10, 10)) p.enableTelnet = wx.CheckBox(telnetPanel, 1, 'Enable', pos=(170, 10)) p.enableTelnet.SetValue(False) p.enableBasicTelnet = wx.CheckBox(telnetPanel, 1, 'Enable Text Commands', pos=(400, 10)) p.enableBasicTelnet.SetValue(True) p.enableTEA = wx.CheckBox(telnetPanel, 2, 'Use encryption', pos=(170, 40)) p.enableTEA.SetValue(False) p.encryptionKeyLabel = wx.StaticText(telnetPanel, -1, 'Key:', pos=(350, 42)) p.keyInput = wx.TextCtrl(telnetPanel, -1, pos=(400, 40), size=(200, 24)) p.timeoutLabel = wx.StaticText(telnetPanel, -1, 'Time to automatically disconnect after inactivity', pos=(10, 72)) p.timeoutInput = wx.Choice(telnetPanel, -1, choices=inactivityChoices, style=wx.BORDER_NONE, pos=(400, 70), size=(200, 24)) p.timeoutInput.SetStringSelection(inactivityChoices[0]) p.switchLabel = wx.StaticText(switchPanel, -1, 'Hardware Network Switch', pos=(10, 10)) p.switchInput = wx.Choice(switchPanel, -1, choices=[getString('auto'), getString('installed'), getString('notInstalled')], style=wx.BORDER_NONE, pos=(400, 10), size=(200, 24)) p.switchInput.SetStringSelection(getString('auto')) p.milanLabel = wx.StaticText(milanPanel, -1, 'AVB Options', pos=(10, 10)) p.avbMode = wx.Choice(milanPanel, -1, choices=['Disabled', 'MILAN'], style=wx.BORDER_NONE, pos=(400, 10), size=(150, 24)) p.avbMode.SetStringSelection('Disabled') p.keyLabel = wx.StaticText(milanPanel, -1, 'Key:', pos=(600, 10)) p.milanKey = wx.TextCtrl(milanPanel, -1, pos=(650, 10), size=(200, 24), style=wx.TE_PASSWORD) self.Bind(wx.EVT_CHECKBOX, self.OnTEAEnabled, id=2) self.Bind(wx.EVT_CHECKBOX, self.OnBroadcastEnabled, id=0) self.Bind(wx.EVT_CHECKBOX, self.OnTelnetEnabled, id=1) p.Show(True) networkPanel.SetBackgroundColour((200, 200, 200)) networkPanel.Show(True) telnetPanel.SetBackgroundColour((200, 200, 200)) telnetPanel.Show(True) switchPanel.SetBackgroundColour((200, 200, 200)) switchPanel.Show(True) milanPanel.SetBackgroundColour((200, 200, 200)) milanPanel.Show(True) p.SetPosition((0, 0)) p.key = None p.lineNumber = lineNumber return p def OnBroadcastEnabled(self, e): self.enable(self.lines[0]) return def OnTelnetEnabled(self, e): self.enable(self.lines[0]) return def OnTEAEnabled(self, e): self.enable(self.lines[0]) return def enable(self, line): val = line.enableBroadcast.GetValue() line.stopWhenMFPActive.Enable(val) line.stopWhenTelnetActive.Enable(val) val = line.enableTelnet.GetValue() line.enableTEA.Enable(val) line.timeoutInput.Enable(val) line.timeoutLabel.Enable(val) line.enableBasicTelnet.Enable(val) val = line.enableTEA.GetValue() line.keyInput.Enable(val) line.encryptionKeyLabel.Enable(val) if val == True: line.enableBasicTelnet.SetValue(False) line.enableBasicTelnet.Enable(False) return def evaluateLine(self, line): try: encryptionKey = self.lines[0].keyInput.GetValue() + ' ' print mytime.displayTime(), 'ucn. TEA Key:', encryptionKey encryptionKey = data_model.safeName(encryptionKey)[:16] print mytime.displayTime(), 'set to', encryptionKey encryptionAllowed = True self.lines[0].keyInput.SetValue(encryptionKey) except: encryptionKey = ' ' encryptionAllowed = False try: milanKey = self.lines[0].milanKey.GetValue() + ' ' print mytime.displayTime(), 'ucn. MILAN Key:', milanKey milanKey = data_model.safeName(milanKey)[:8] print mytime.displayTime(), 'set to', milanKey self.lines[0].milanKey.SetValue(milanKey) except: milanKey = ' ' if line.lineNumber == 0: flags = 0 if self.lines[0].enableTEA.GetValue() == True and encryptionAllowed: flags |= 1 timeoutString = line.timeoutInput.GetStringSelection() timeoutValue = 0 for i in range(len(inactivityChoices)): if inactivityChoices[i] == timeoutString: timeoutValue = i break if self.lines[0].enableBroadcast.GetValue() == True: flags |= 2 if self.lines[0].stopWhenMFPActive.GetValue() == True: flags |= 4 if self.lines[0].stopWhenTelnetActive.GetValue() == True: flags |= 8 if self.lines[0].enableBasicTelnet.GetValue() == False: flags |= 16 if self.lines[0].switchInput.GetStringSelection() == getString('installed'): flags |= 32 if self.lines[0].switchInput.GetStringSelection() == getString('notInstalled'): flags |= 64 optkey = data_model.Key(protocol.STRUCT_ID_GLOBAL, protocol.MEMBER_ID_HARDWARE_STATUS_FLAGS, 0, 0) try: hardwareStatusFlags = int(self.frame.frame.parent.model.get(optkey)) if line.enableTelnet.GetValue() == True: hardwareStatusFlags |= protocol.confTelnetEnabled else: hardwareStatusFlags &= 4294967295L ^ protocol.confTelnetEnabled self.frame.frame.parent.set_value(optkey, hardwareStatusFlags) except: traceback.print_exc(file=sys.stdout) else: try: encryptionKey = encryptionKey[:4] print mytime.displayTime(), 'ucn.1', encryptionKey sendString = '' + chr(self.uiNumber) sendString += chr(line.lineNumber) sendString += chr(flags) sendString += chr(timeoutValue) sendString += encryptionKey mys = 'String: ' for c in sendString: mys += hex(ord(c)) + ':' print mys return sendString except: print mytime.displayTime(), 'uca.ec.eL.failed to build string' traceback.print_exc(file=sys.stdout) return elif line.lineNumber == 1: try: encryptionKey = encryptionKey[4:10] print mytime.displayTime(), 'ucn.2', encryptionKey sendString = '' + chr(self.uiNumber) sendString += chr(line.lineNumber) sendString += encryptionKey mys = 'String: ' for c in sendString: mys += hex(ord(c)) + ':' print mys return sendString except: print mytime.displayTime(), 'uca.ec.eL.failed to build string' traceback.print_exc(file=sys.stdout) return elif line.lineNumber == 2: try: encryptionKey = encryptionKey[10:16] sendString = '' + chr(self.uiNumber) sendString += chr(line.lineNumber) sendString += encryptionKey return sendString except: print mytime.displayTime(), 'uca.ec.eL.failed to build string' traceback.print_exc(file=sys.stdout) return elif line.lineNumber == 3: flags = 0 avbMode = self.lines[0].avbMode.GetStringSelection() if avbMode == 'MILAN': flags |= 1 try: milanKey = milanKey[:4] print mytime.displayTime(), 'ucn.1b', milanKey sendString = '' + chr(self.uiNumber) sendString += chr(line.lineNumber) sendString += chr(flags) sendString += chr(0) sendString += milanKey mys = 'String: ' for c in sendString: mys += hex(ord(c)) + ':' print mys return sendString except: print mytime.displayTime(), 'uca.ec.eL.failed to build string' traceback.print_exc(file=sys.stdout) return elif line.lineNumber == 4: try: milanKey = milanKey[4:8] print mytime.displayTime(), 'ucn.2b', milanKey sendString = '' + chr(self.uiNumber) sendString += chr(line.lineNumber) sendString += milanKey sendString += chr(0) sendString += chr(0) mys = 'String: ' for c in sendString: mys += hex(ord(c)) + ':' print mys return sendString except: print mytime.displayTime(), 'uca.ec.eL.failed to build string' traceback.print_exc(file=sys.stdout) return return # okay decompiling pycode/user_config_network.pyc