├── .gitignore ├── CECSTeR.py ├── HDMI_Ethernet_Channel_whitepaper.pdf ├── LICENSE.txt ├── README.md └── images ├── cecster_logo.png ├── cecster_splash.png ├── ncc_logo.png └── underline.png /.gitignore: -------------------------------------------------------------------------------- 1 | *.py[cod] 2 | 3 | # C extensions 4 | *.so 5 | 6 | # Packages 7 | *.egg 8 | *.egg-info 9 | dist 10 | build 11 | eggs 12 | parts 13 | bin 14 | var 15 | sdist 16 | develop-eggs 17 | .installed.cfg 18 | lib 19 | lib64 20 | __pycache__ 21 | 22 | # Installer logs 23 | pip-log.txt 24 | 25 | # Unit test / coverage reports 26 | .coverage 27 | .tox 28 | nosetests.xml 29 | 30 | # Translations 31 | *.mo 32 | 33 | # Mr Developer 34 | .mr.developer.cfg 35 | .project 36 | .pydevproject 37 | -------------------------------------------------------------------------------- /CECSTeR.py: -------------------------------------------------------------------------------- 1 | # CECSTeR - Consumer Electronics Control Security Testing Resource 2 | # 3 | # by Andy Davis (andy.davis@nccgroup.com) 4 | # 5 | # Release History: 6 | # 7 | # 18 April 2012 - v0.1 - First alpha release 8 | # 02 May 2012 - v0.1b - First internal release 9 | # 07 September 2012 - v1.0 - First public release 10 | 11 | 12 | #!/usr/bin/python 13 | import wx 14 | import usb.core 15 | import usb.util 16 | import sys 17 | import time 18 | import string 19 | import serial 20 | import time 21 | import os 22 | from random import randint 23 | import wx.lib.agw.advancedsplash as AS 24 | 25 | USE_GENERIC = 0 26 | 27 | if USE_GENERIC: 28 | from wx.lib.stattext import GenStaticText as StaticText 29 | else: 30 | StaticText = wx.StaticText 31 | 32 | class MainPanel(wx.Panel): 33 | def __init__(self, parent, frame=None): 34 | wx.Panel.__init__( 35 | self, parent, -1, 36 | style=wx.TAB_TRAVERSAL|wx.CLIP_CHILDREN|wx.NO_FULL_REPAINT_ON_RESIZE 37 | ) 38 | 39 | 40 | if (len(sys.argv)!=2): 41 | print "\n-----------------------------------------------" 42 | print "Usage: CECSTeR " 43 | print "-----------------------------------------------\n" 44 | self.Close(True) 45 | sys.exit(0) 46 | 47 | self.serialport = int(sys.argv[1]) -1 48 | 49 | self.parent = parent 50 | self.frame = frame 51 | 52 | self.SetBackgroundColour("White") 53 | self.Refresh() 54 | 55 | self.inputbufferlist = [] 56 | 57 | self.dataview = True 58 | self.fuzzing = False 59 | self.capture = False 60 | self.opcode = "" 61 | self.source = "4" 62 | self.sourcename = "4 - Playback 1" 63 | self.target = "0" 64 | self.targetname = "0 - TV" 65 | self.physical = "" 66 | self.command_data = "" 67 | self.CurrentCommand = "" 68 | self.CurrentOpcode = "" 69 | self.parameters_required = "" 70 | 71 | self.cdc_opcode = "" 72 | self.cdc_parameters_required = "" 73 | self.cdc_commandmode = False 74 | 75 | self.commandmode = False 76 | self.enumerating = False 77 | self.current_font_size = 12 78 | self.suppress_polling_messages = True 79 | self.fuzz_long_strings = False 80 | self.fuzz_format_strings = False 81 | self.fuzz_bit_flipping = False 82 | 83 | # create IDs 84 | 85 | self.ID_About = wx.NewId() 86 | 87 | self.ID_Enumerate_Devices = wx.NewId() 88 | 89 | self.ID_Select_Device_Menu = wx.NewId() 90 | self.ID_0_TV = wx.NewId() 91 | self.ID_Recorder_1 = wx.NewId() 92 | self.ID_Recorder_2 = wx.NewId() 93 | self.ID_Tuner_1 = wx.NewId() 94 | self.ID_Playback_1 = wx.NewId() 95 | self.ID_Audio_System = wx.NewId() 96 | self.ID_Tuner_2 = wx.NewId() 97 | self.ID_Tuner_3 = wx.NewId() 98 | self.ID_Playback_2 = wx.NewId() 99 | self.ID_Recorder_3 = wx.NewId() 100 | self.ID_Tuner_4 = wx.NewId() 101 | self.ID_Playback_3 = wx.NewId() 102 | self.ID_Reserved_1 = wx.NewId() 103 | self.ID_Reserved_2 = wx.NewId() 104 | self.ID_Free_use = wx.NewId() 105 | self.ID_Broadcast = wx.NewId() 106 | 107 | self.ID_S_Select_Device_Menu = wx.NewId() 108 | self.ID_S_0_TV = wx.NewId() 109 | self.ID_S_Recorder_1 = wx.NewId() 110 | self.ID_S_Recorder_2 = wx.NewId() 111 | self.ID_S_Tuner_1 = wx.NewId() 112 | self.ID_S_Playback_1 = wx.NewId() 113 | self.ID_S_Audio_System = wx.NewId() 114 | self.ID_S_Tuner_2 = wx.NewId() 115 | self.ID_S_Tuner_3 = wx.NewId() 116 | self.ID_S_Playback_2 = wx.NewId() 117 | self.ID_S_Recorder_3 = wx.NewId() 118 | self.ID_S_Tuner_4 = wx.NewId() 119 | self.ID_S_Playback_3 = wx.NewId() 120 | self.ID_S_Reserved_1 = wx.NewId() 121 | self.ID_S_Reserved_2 = wx.NewId() 122 | self.ID_S_Free_use = wx.NewId() 123 | self.ID_S_Broadcast = wx.NewId() 124 | 125 | self.ID_One_Touch_Play_Menu = wx.NewId() 126 | self.ID_Active_Source = wx.NewId() 127 | self.ID_Image_View_On = wx.NewId() 128 | self.ID_Text_View_On = wx.NewId() 129 | 130 | self.ID_Routing_Control_Menu = wx.NewId() 131 | self.ID_Inactive_Source = wx.NewId() 132 | self.ID_Request_Active_Source = wx.NewId() 133 | self.ID_Routing_Change = wx.NewId() 134 | self.ID_Routing_Information = wx.NewId() 135 | self.ID_Set_Stream_Path = wx.NewId() 136 | 137 | self.ID_Standby_Menu = wx.NewId() 138 | self.ID_Standby = wx.NewId() 139 | 140 | self.ID_One_Touch_Record_Menu = wx.NewId() 141 | self.ID_Record_Off = wx.NewId() 142 | self.ID_Record_On = wx.NewId() 143 | self.ID_Record_Status = wx.NewId() 144 | self.ID_Record_TV_Screen = wx.NewId() 145 | 146 | self.ID_Timer_Programming_Menu = wx.NewId() 147 | self.ID_Clear_Analogue_Timer = wx.NewId() 148 | self.ID_Clear_Digital_Timer = wx.NewId() 149 | self.ID_Clear_External_Timer = wx.NewId() 150 | self.ID_Set_Analogue_Timer = wx.NewId() 151 | self.ID_Set_Digital_Timer = wx.NewId() 152 | self.ID_Set_External_Timer = wx.NewId() 153 | self.ID_Set_Timer_Programme_Title = wx.NewId() 154 | self.ID_Timer_Cleared_Status = wx.NewId() 155 | self.ID_Timer_Status = wx.NewId() 156 | 157 | self.ID_System_Information_Menu = wx.NewId() 158 | self.ID_CEC_Version = wx.NewId() 159 | self.ID_Get_CEC_Version = wx.NewId() 160 | self.ID_Give_Physical_Address = wx.NewId() 161 | self.ID_Get_Menu_Language = wx.NewId() 162 | self.ID_Report_Physical_Address = wx.NewId() 163 | self.ID_Set_Menu_Language = wx.NewId() 164 | 165 | self.ID_Deck_Control_Menu = wx.NewId() 166 | self.ID_Deck_Control = wx.NewId() 167 | self.ID_Deck_Status = wx.NewId() 168 | self.ID_Give_Deck_Status = wx.NewId() 169 | self.ID_Play = wx.NewId() 170 | 171 | self.ID_Tuner_Control_Menu = wx.NewId() 172 | self.ID_Give_Tuner_Device_Status = wx.NewId() 173 | self.ID_Select_Analogue_Service = wx.NewId() 174 | self.ID_Select_Digital_Service = wx.NewId() 175 | self.ID_Tuner_Device_Status = wx.NewId() 176 | self.ID_Tuner_Step_Decrement = wx.NewId() 177 | self.ID_Tuner_Step_Increment = wx.NewId() 178 | 179 | self.ID_Vendor_Specific_Commands_Menu = wx.NewId() 180 | self.ID_Device_Vendor_ID = wx.NewId() 181 | self.ID_Give_Device_Vendor_ID = wx.NewId() 182 | self.ID_Vendor_Command = wx.NewId() 183 | self.ID_Vendor_Command_With_ID = wx.NewId() 184 | self.ID_Vendor_Remote_Button_Down = wx.NewId() 185 | self.ID_Vendor_Remote_Button_Up = wx.NewId() 186 | 187 | self.ID_OSD_Display_Menu = wx.NewId() 188 | self.ID_Set_OSD_String = wx.NewId() 189 | 190 | self.ID_Device_OSD_Transfer_Menu = wx.NewId() 191 | self.ID_Give_OSD_Name = wx.NewId() 192 | self.ID_Set_OSD_Name = wx.NewId() 193 | 194 | self.ID_Device_Menu_Control_Menu = wx.NewId() 195 | self.ID_Menu_Request = wx.NewId() 196 | self.ID_Menu_Status = wx.NewId() 197 | self.ID_User_Control_Pressed = wx.NewId() 198 | self.ID_User_Control_Released = wx.NewId() 199 | 200 | self.ID_Remote_Control_Passthrough_Menu = wx.NewId() 201 | 202 | self.ID_Power_Status_Menu = wx.NewId() 203 | self.ID_Give_Device_Power_Status = wx.NewId() 204 | self.ID_Report_Power_Status = wx.NewId() 205 | 206 | self.ID_General_Protocol_Messages_Menu = wx.NewId() 207 | self.ID_Feature_Abort = wx.NewId() 208 | self.ID_Abort = wx.NewId() 209 | 210 | self.ID_System_Audio_Control_Menu = wx.NewId() 211 | self.ID_Give_Audio_Status = wx.NewId() 212 | self.ID_Give_System_Audio_Mode_Status = wx.NewId() 213 | self.ID_Report_Audio_Status = wx.NewId() 214 | self.ID_Report_Short_Audio_Descriptor = wx.NewId() 215 | self.ID_Request_Short_Audio_Descriptor = wx.NewId() 216 | self.ID_Set_System_Audio_Mode = wx.NewId() 217 | self.ID_System_Audio_Mode_Request = wx.NewId() 218 | self.ID_System_Audio_Mode_Status = wx.NewId() 219 | 220 | self.ID_Audio_Rate_Control_Menu = wx.NewId() 221 | self.ID_Set_Audio_Rate = wx.NewId() 222 | 223 | self.ID_Audio_Return_Channel_Control_Menu = wx.NewId() 224 | self.ID_Initiate_ARC = wx.NewId() 225 | self.ID_Report_ARC_Initiated = wx.NewId() 226 | self.ID_Report_ARC_Terminated = wx.NewId() 227 | self.ID_Request_ARC_Initiation = wx.NewId() 228 | self.ID_Request_ARC_Termination = wx.NewId() 229 | self.ID_Terminate_ARC = wx.NewId() 230 | 231 | self.ID_Capability_Discovery_And_Control_Menu = wx.NewId() 232 | self.ID_CDC_Message = wx.NewId() 233 | 234 | self.ID_HDMI_Ethernet_Channel_Menu = wx.NewId() 235 | self.ID_CDC_HEC_InquireState = wx.NewId() 236 | self.ID_CDC_HEC_ReportState = wx.NewId() 237 | self.ID_CDC_HEC_SetStateAdjacent = wx.NewId() 238 | self.ID_CDC_HEC_SetState = wx.NewId() 239 | self.ID_CDC_HEC_RequestDeactivation = wx.NewId() 240 | self.ID_CDC_HEC_NotifyAlive = wx.NewId() 241 | self.ID_CDC_HEC_Discover = wx.NewId() 242 | 243 | self.ID_CDC_HPD_Menu = wx.NewId() 244 | self.ID_CDC_HPD_SetState = wx.NewId() 245 | self.ID_CDC_HPD_ReportState = wx.NewId() 246 | 247 | self.ID_Fuzz_CEC = wx.NewId() 248 | self.ID_Fuzz_CDC = wx.NewId() 249 | self.ID_stop_fuzzing = wx.NewId() 250 | 251 | self.ID_Fuzzing_Config_Menu = wx.NewId() 252 | 253 | self.ID_Long_Strings = wx.NewId() 254 | self.ID_Format_Strings = wx.NewId() 255 | self.ID_Bit_Flipping = wx.NewId() 256 | 257 | self.ID_startcapture = wx.NewId() 258 | self.ID_stopcapture = wx.NewId() 259 | 260 | self.ID_showpollingmessages = wx.NewId() 261 | self.ID_showrawdata = wx.NewId() 262 | 263 | 264 | # Splash screen 265 | 266 | pn = os.path.normpath(os.path.join(".", "images/cecster_splash.png")) 267 | bitmap = wx.Bitmap(pn, wx.BITMAP_TYPE_PNG) 268 | shadow = wx.WHITE 269 | frame = AS.AdvancedSplash(self, bitmap=bitmap, timeout=4000) 270 | 271 | # create menu 272 | 273 | self.mb = wx.MenuBar() 274 | 275 | file_menu = wx.Menu() 276 | file_menu.Append(self.ID_About, "&About") 277 | 278 | file_menu.AppendSeparator() 279 | file_menu.Append(wx.ID_EXIT, "Exit") 280 | 281 | self.mb.Append(file_menu, "File") 282 | 283 | #------------------------------------------------------------------------------------------------------------- 284 | 285 | device_menu = wx.Menu() 286 | 287 | device_menu.Append(self.ID_Enumerate_Devices, "Enumerate Devices") 288 | 289 | 290 | select_source_device_menu = wx.Menu() 291 | 292 | select_source_device_menu.Append(self.ID_S_0_TV, "0 - TV", "0 - TV", wx.ITEM_RADIO) 293 | select_source_device_menu.Append(self.ID_S_Recorder_1, "1 - Recorder 1", "1 - Recorder 1", wx.ITEM_RADIO) 294 | select_source_device_menu.Append(self.ID_S_Recorder_2, "2 - Recorder 2", "2 - Recorder 2", wx.ITEM_RADIO) 295 | select_source_device_menu.Append(self.ID_S_Tuner_1, "3 - Tuner 1", "3 - Tuner 1", wx.ITEM_RADIO) 296 | select_source_device_menu.Append(self.ID_S_Playback_1, "4 - Playback 1", "4 - Playback 1", wx.ITEM_RADIO) 297 | select_source_device_menu.Append(self.ID_S_Audio_System, "5 - Audio System", "5 - Audio System", wx.ITEM_RADIO) 298 | select_source_device_menu.Append(self.ID_S_Tuner_2, "6 - Tuner 2", "6 - Tuner 2", wx.ITEM_RADIO) 299 | select_source_device_menu.Append(self.ID_S_Tuner_3, "7 - Tuner 3", "7 - Tuner 3", wx.ITEM_RADIO) 300 | select_source_device_menu.Append(self.ID_S_Playback_2, "8 - Playback 2", "8 - Playback 2", wx.ITEM_RADIO) 301 | select_source_device_menu.Append(self.ID_S_Recorder_3, "9 - Recorder 3", "9 - Recorder 3", wx.ITEM_RADIO) 302 | select_source_device_menu.Append(self.ID_S_Tuner_4, "A - Tuner 4", "A - Tuner 4", wx.ITEM_RADIO) 303 | select_source_device_menu.Append(self.ID_S_Playback_3, "B - Playback 3", "B - Playback 3", wx.ITEM_RADIO) 304 | select_source_device_menu.Append(self.ID_S_Reserved_1, "C - Reserved 1", "C - Reserved 1", wx.ITEM_RADIO) 305 | select_source_device_menu.Append(self.ID_S_Reserved_2, "D - Reserved 2", "D - Reserved 2", wx.ITEM_RADIO) 306 | select_source_device_menu.Append(self.ID_S_Free_use, "E - Free use", "E - Free use", wx.ITEM_RADIO) 307 | select_source_device_menu.Append(self.ID_S_Broadcast, "F - Broadcast", "F - Broadcast", wx.ITEM_RADIO) 308 | 309 | device_menu.AppendMenu(self.ID_S_Select_Device_Menu, "Select Source Device", select_source_device_menu) 310 | 311 | select_device_menu = wx.Menu() 312 | 313 | select_device_menu.Append(self.ID_0_TV, "0 - TV", "0 - TV", wx.ITEM_RADIO) 314 | select_device_menu.Append(self.ID_Recorder_1, "1 - Recorder 1", "1 - Recorder 1", wx.ITEM_RADIO) 315 | select_device_menu.Append(self.ID_Recorder_2, "2 - Recorder 2", "2 - Recorder 2", wx.ITEM_RADIO) 316 | select_device_menu.Append(self.ID_Tuner_1, "3 - Tuner 1", "3 - Tuner 1", wx.ITEM_RADIO) 317 | select_device_menu.Append(self.ID_Playback_1, "4 - Playback 1", "4 - Playback 1", wx.ITEM_RADIO) 318 | select_device_menu.Append(self.ID_Audio_System, "5 - Audio System", "5 - Audio System", wx.ITEM_RADIO) 319 | select_device_menu.Append(self.ID_Tuner_2, "6 - Tuner 2", "6 - Tuner 2", wx.ITEM_RADIO) 320 | select_device_menu.Append(self.ID_Tuner_3, "7 - Tuner 3", "7 - Tuner 3", wx.ITEM_RADIO) 321 | select_device_menu.Append(self.ID_Playback_2, "8 - Playback 2", "8 - Playback 2", wx.ITEM_RADIO) 322 | select_device_menu.Append(self.ID_Recorder_3, "9 - Recorder 3", "9 - Recorder 3", wx.ITEM_RADIO) 323 | select_device_menu.Append(self.ID_Tuner_4, "A - Tuner 4", "A - Tuner 4", wx.ITEM_RADIO) 324 | select_device_menu.Append(self.ID_Playback_3, "B - Playback 3", "B - Playback 3", wx.ITEM_RADIO) 325 | select_device_menu.Append(self.ID_Reserved_1, "C - Reserved 1", "C - Reserved 1", wx.ITEM_RADIO) 326 | select_device_menu.Append(self.ID_Reserved_2, "D - Reserved 2", "D - Reserved 2", wx.ITEM_RADIO) 327 | select_device_menu.Append(self.ID_Free_use, "E - Free use", "E - Free use", wx.ITEM_RADIO) 328 | select_device_menu.Append(self.ID_Broadcast, "F - Broadcast", "F - Broadcast", wx.ITEM_RADIO) 329 | 330 | device_menu.AppendMenu(self.ID_Select_Device_Menu, "Select Target Device", select_device_menu) 331 | 332 | self.mb.Append(device_menu, "Device") 333 | 334 | #------------------------------------------------------------------------------------------------------------- 335 | 336 | command_menu = wx.Menu() 337 | 338 | one_touch_play_menu = wx.Menu() 339 | 340 | one_touch_play_menu.Append(self.ID_Active_Source, "Active Source") 341 | one_touch_play_menu.Append(self.ID_Image_View_On, "Image View On") 342 | one_touch_play_menu.Append(self.ID_Text_View_On, "Text View On") 343 | 344 | command_menu.AppendMenu(self.ID_One_Touch_Play_Menu, "One Touch Play", one_touch_play_menu) 345 | 346 | #------------------------------------------------------------------------------------------------------------- 347 | 348 | routing_control_menu = wx.Menu() 349 | 350 | 351 | routing_control_menu.Append(self.ID_Active_Source, "Active Source") 352 | routing_control_menu.Append(self.ID_Inactive_Source, "Inactive Source") 353 | routing_control_menu.Append(self.ID_Request_Active_Source, "Request Active Source") 354 | routing_control_menu.Append(self.ID_Routing_Change, "Routing Change") 355 | routing_control_menu.Append(self.ID_Routing_Information, "Routing Information") 356 | routing_control_menu.Append(self.ID_Set_Stream_Path, "Set Stream Path") 357 | 358 | command_menu.AppendMenu(self.ID_Routing_Control_Menu, "Routing Control", routing_control_menu) 359 | 360 | #------------------------------------------------------------------------------------------------------------- 361 | 362 | standby_menu = wx.Menu() 363 | 364 | standby_menu.Append(self.ID_Standby, "Standby") 365 | 366 | command_menu.AppendMenu(self.ID_Standby_Menu, "Standby", standby_menu) 367 | 368 | #------------------------------------------------------------------------------------------------------------- 369 | 370 | one_touch_record_menu = wx.Menu() 371 | 372 | one_touch_record_menu.Append(self.ID_Record_Off, "Record Off") 373 | one_touch_record_menu.Append(self.ID_Record_On, "Record On") 374 | one_touch_record_menu.Append(self.ID_Record_Status, "Record Status") 375 | one_touch_record_menu.Append(self.ID_Record_TV_Screen, "Record TV Screen") 376 | 377 | command_menu.AppendMenu(self.ID_One_Touch_Record_Menu, "One Touch Record", one_touch_record_menu) 378 | 379 | #------------------------------------------------------------------------------------------------------------- 380 | 381 | timer_programming_menu = wx.Menu() 382 | 383 | timer_programming_menu.Append(self.ID_Clear_Analogue_Timer, "Clear Analogue Timer") 384 | timer_programming_menu.Append(self.ID_Clear_Digital_Timer, "Clear Digital Timer") 385 | timer_programming_menu.Append(self.ID_Clear_External_Timer, "Clear External Timer") 386 | timer_programming_menu.Append(self.ID_Set_Analogue_Timer, "Set Analogue Timer") 387 | timer_programming_menu.Append(self.ID_Set_Digital_Timer, "Set Digital Timer") 388 | timer_programming_menu.Append(self.ID_Set_External_Timer, "Set External Timer") 389 | timer_programming_menu.Append(self.ID_Set_Timer_Programme_Title, "Set Timer Programme Title") 390 | timer_programming_menu.Append(self.ID_Timer_Cleared_Status, "Timer Cleared Status") 391 | timer_programming_menu.Append(self.ID_Timer_Status, "Timer Status") 392 | 393 | 394 | command_menu.AppendMenu(self.ID_Timer_Programming_Menu, "Timer Programming", timer_programming_menu) 395 | 396 | #------------------------------------------------------------------------------------------------------------- 397 | 398 | system_information_menu = wx.Menu() 399 | 400 | system_information_menu.Append(self.ID_CEC_Version, "CEC Version") 401 | system_information_menu.Append(self.ID_Get_CEC_Version, "Get CEC Version") 402 | system_information_menu.Append(self.ID_Give_Physical_Address, "Give Physical Address") 403 | system_information_menu.Append(self.ID_Get_Menu_Language, "Get Menu Language") 404 | system_information_menu.Append(self.ID_Report_Physical_Address, "Report Physical Address") 405 | system_information_menu.Append(self.ID_Set_Menu_Language, "Set Menu Language") 406 | 407 | command_menu.AppendMenu(self.ID_System_Information_Menu, "System Information", system_information_menu) 408 | 409 | #------------------------------------------------------------------------------------------------------------- 410 | 411 | deck_control_menu = wx.Menu() 412 | 413 | deck_control_menu.Append(self.ID_Deck_Control, "Deck Control") 414 | deck_control_menu.Append(self.ID_Deck_Status, "Deck Status") 415 | deck_control_menu.Append(self.ID_Give_Deck_Status, "Give Deck Status") 416 | deck_control_menu.Append(self.ID_Play, "Play") 417 | 418 | command_menu.AppendMenu(self.ID_Deck_Control_Menu, "Deck Control", deck_control_menu) 419 | 420 | #------------------------------------------------------------------------------------------------------------- 421 | 422 | tuner_control_menu = wx.Menu() 423 | 424 | tuner_control_menu.Append(self.ID_Give_Tuner_Device_Status, "Give Tuner Device Status") 425 | tuner_control_menu.Append(self.ID_Select_Analogue_Service, "Select Analogue Service") 426 | tuner_control_menu.Append(self.ID_Select_Digital_Service, "Select Digital Service") 427 | tuner_control_menu.Append(self.ID_Tuner_Device_Status, "Tuner Device Status") 428 | tuner_control_menu.Append(self.ID_Tuner_Step_Decrement, "Tuner Step Decrement") 429 | tuner_control_menu.Append(self.ID_Tuner_Step_Increment, "Tuner Step Increment") 430 | 431 | command_menu.AppendMenu(self.ID_Tuner_Control_Menu, "Tuner Control", tuner_control_menu) 432 | 433 | #------------------------------------------------------------------------------------------------------------- 434 | 435 | vendor_specific_commands_menu = wx.Menu() 436 | 437 | vendor_specific_commands_menu.Append(self.ID_CEC_Version, "CEC Version") 438 | vendor_specific_commands_menu.Append(self.ID_Device_Vendor_ID, "Device Vendor ID") 439 | vendor_specific_commands_menu.Append(self.ID_Get_CEC_Version, "Get CEC Version") 440 | vendor_specific_commands_menu.Append(self.ID_Give_Device_Vendor_ID, "Give Device Vendor ID") 441 | vendor_specific_commands_menu.Append(self.ID_Vendor_Command, "Vendor Command") 442 | vendor_specific_commands_menu.Append(self.ID_Vendor_Command_With_ID, "Vendor Command With ID") 443 | vendor_specific_commands_menu.Append(self.ID_Vendor_Remote_Button_Down, "Vendor Remote Button Down") 444 | vendor_specific_commands_menu.Append(self.ID_Vendor_Remote_Button_Up, "Vendor Remote Button Up") 445 | 446 | command_menu.AppendMenu(self.ID_Vendor_Specific_Commands_Menu, "Vendor Specific Commands", vendor_specific_commands_menu) 447 | 448 | #------------------------------------------------------------------------------------------------------------- 449 | 450 | OSD_display_menu = wx.Menu() 451 | 452 | OSD_display_menu.Append(self.ID_Set_OSD_String, "Set OSD String") 453 | 454 | command_menu.AppendMenu(self.ID_OSD_Display_Menu, "OSD Display", OSD_display_menu) 455 | 456 | #------------------------------------------------------------------------------------------------------------- 457 | 458 | device_OSD_transfer_menu = wx.Menu() 459 | 460 | device_OSD_transfer_menu.Append(self.ID_Give_OSD_Name, "Give OSD Name") 461 | device_OSD_transfer_menu.Append(self.ID_Set_OSD_Name, "Set OSD Name") 462 | 463 | command_menu.AppendMenu(self.ID_Device_OSD_Transfer_Menu, "Device OSD Transfer", device_OSD_transfer_menu) 464 | 465 | #------------------------------------------------------------------------------------------------------------- 466 | 467 | device_menu_control_menu = wx.Menu() 468 | 469 | device_menu_control_menu.Append(self.ID_Menu_Request, "Menu Request") 470 | device_menu_control_menu.Append(self.ID_Menu_Status, "Menu Status") 471 | device_menu_control_menu.Append(self.ID_User_Control_Pressed, "User Control Pressed") 472 | device_menu_control_menu.Append(self.ID_User_Control_Released, "User Control Released") 473 | 474 | command_menu.AppendMenu(self.ID_Device_Menu_Control_Menu, "Device Menu Control", device_menu_control_menu) 475 | 476 | #------------------------------------------------------------------------------------------------------------- 477 | 478 | remote_control_passthrough_menu = wx.Menu() 479 | 480 | remote_control_passthrough_menu.Append(self.ID_User_Control_Pressed, "User Control Pressed") 481 | remote_control_passthrough_menu.Append(self.ID_User_Control_Released, "User Control Released") 482 | 483 | command_menu.AppendMenu(self.ID_Remote_Control_Passthrough_Menu, "Remote Control Passthrough", remote_control_passthrough_menu) 484 | 485 | #------------------------------------------------------------------------------------------------------------- 486 | 487 | power_status_menu = wx.Menu() 488 | 489 | power_status_menu.Append(self.ID_Give_Device_Power_Status, "Give Device Power Status") 490 | power_status_menu.Append(self.ID_Report_Power_Status, "Report Power Status") 491 | 492 | command_menu.AppendMenu(self.ID_Power_Status_Menu, "Power Status", power_status_menu) 493 | 494 | #------------------------------------------------------------------------------------------------------------- 495 | 496 | general_protocol_messages_menu = wx.Menu() 497 | 498 | general_protocol_messages_menu.Append(self.ID_Feature_Abort, "Feature Abort") 499 | general_protocol_messages_menu.Append(self.ID_Abort, "Abort") 500 | 501 | command_menu.AppendMenu(self.ID_General_Protocol_Messages_Menu, "General Protocol Messages", general_protocol_messages_menu) 502 | 503 | #------------------------------------------------------------------------------------------------------------- 504 | 505 | system_audio_control_menu = wx.Menu() 506 | 507 | system_audio_control_menu.Append(self.ID_Give_Audio_Status, "Give Audio Status") 508 | system_audio_control_menu.Append(self.ID_Give_System_Audio_Mode_Status, "Give System Audio Mode Status") 509 | system_audio_control_menu.Append(self.ID_Report_Audio_Status, "Report Audio Status") 510 | system_audio_control_menu.Append(self.ID_Report_Short_Audio_Descriptor, "Report Short Audio Descriptor") 511 | system_audio_control_menu.Append(self.ID_Request_Short_Audio_Descriptor, "Request Short Audio Descriptor") 512 | system_audio_control_menu.Append(self.ID_Set_System_Audio_Mode, "Set System Audio Mode") 513 | system_audio_control_menu.Append(self.ID_System_Audio_Mode_Request, "System Audio Mode Request") 514 | system_audio_control_menu.Append(self.ID_System_Audio_Mode_Status, "System Audio Mode Status") 515 | system_audio_control_menu.Append(self.ID_User_Control_Pressed, "User Control Pressed") 516 | system_audio_control_menu.Append(self.ID_User_Control_Released, "User Control Released") 517 | 518 | command_menu.AppendMenu(self.ID_System_Audio_Control_Menu, "System Audio Control", system_audio_control_menu) 519 | 520 | #------------------------------------------------------------------------------------------------------------- 521 | 522 | audio_rate_control_menu = wx.Menu() 523 | 524 | audio_rate_control_menu.Append(self.ID_Set_Audio_Rate, "Set Audio Rate") 525 | 526 | command_menu.AppendMenu(self.ID_Audio_Rate_Control_Menu, "Audio Rate Control", audio_rate_control_menu) 527 | 528 | #------------------------------------------------------------------------------------------------------------- 529 | 530 | audio_return_channel_control_menu = wx.Menu() 531 | 532 | audio_return_channel_control_menu.Append(self.ID_Initiate_ARC, "Initiate ARC") 533 | audio_return_channel_control_menu.Append(self.ID_Report_ARC_Initiated, "Report ARC Initiated") 534 | audio_return_channel_control_menu.Append(self.ID_Report_ARC_Terminated, "Report ARC Terminated") 535 | audio_return_channel_control_menu.Append(self.ID_Request_ARC_Initiation, "Request ARC Initiation") 536 | audio_return_channel_control_menu.Append(self.ID_Request_ARC_Termination, "Request ARC Termination") 537 | audio_return_channel_control_menu.Append(self.ID_Terminate_ARC, "Terminate ARC") 538 | 539 | command_menu.AppendMenu(self.ID_Audio_Return_Channel_Control_Menu, "Audio Return Channel Control", audio_return_channel_control_menu) 540 | 541 | #------------------------------------------------------------------------------------------------------------- 542 | 543 | capability_discovery_and_control_menu = wx.Menu() 544 | 545 | capability_discovery_and_control_menu.Append(self.ID_CDC_Message, "CDC Message") 546 | 547 | command_menu.AppendMenu(self.ID_Capability_Discovery_And_Control_Menu, "Capability Discovery and Control", capability_discovery_and_control_menu) 548 | 549 | #------------------------------------------------------------------------------------------------------------- 550 | 551 | self.mb.Append(command_menu, "CEC Features") 552 | 553 | #------------------------------------------------------------------------------------------------------------- 554 | 555 | cdc_command_menu = wx.Menu() 556 | 557 | hdmi_ethernet_channel_menu = wx.Menu() 558 | 559 | hdmi_ethernet_channel_menu.Append(self.ID_CDC_HEC_InquireState, "CDC HEC InquireState") 560 | hdmi_ethernet_channel_menu.Append(self.ID_CDC_HEC_ReportState, "CDC HEC ReportState") 561 | hdmi_ethernet_channel_menu.Append(self.ID_CDC_HEC_SetStateAdjacent, "CDC HEC SetStateAdjacent") 562 | hdmi_ethernet_channel_menu.Append(self.ID_CDC_HEC_SetState, "CDC HEC SetState") 563 | hdmi_ethernet_channel_menu.Append(self.ID_CDC_HEC_RequestDeactivation, "CDC HEC RequestDeactivation") 564 | hdmi_ethernet_channel_menu.Append(self.ID_CDC_HEC_NotifyAlive, "CDC HEC NotifyAlive") 565 | hdmi_ethernet_channel_menu.Append(self.ID_CDC_HEC_Discover, "CDC HEC Discover") 566 | 567 | cdc_command_menu.AppendMenu(self.ID_HDMI_Ethernet_Channel_Menu, "HDMI Ethernet Channel", hdmi_ethernet_channel_menu) 568 | 569 | #------------------------------------------------------------------------------------------------------------- 570 | 571 | cdc_hpd_menu = wx.Menu() 572 | 573 | cdc_hpd_menu.Append(self.ID_CDC_HPD_SetState, "CDC HPD SetState") 574 | cdc_hpd_menu.Append(self.ID_CDC_HPD_ReportState, "CDC HPD ReportState") 575 | 576 | cdc_command_menu.AppendMenu(self.ID_CDC_HPD_Menu, "CDC HPD", cdc_hpd_menu) 577 | 578 | #------------------------------------------------------------------------------------------------------------- 579 | 580 | self.mb.Append(cdc_command_menu, "CDC Features") 581 | 582 | #------------------------------------------------------------------------------------------------------------- 583 | 584 | fuzzing_menu = wx.Menu() 585 | 586 | fuzzing_config_menu = wx.Menu() 587 | 588 | fuzzing_config_menu.Append(self.ID_Long_Strings, "Long Strings", "Long Strings", wx.ITEM_CHECK) 589 | fuzzing_config_menu.Append(self.ID_Format_Strings, "Format Strings", "Format Strings", wx.ITEM_CHECK) 590 | fuzzing_config_menu.Append(self.ID_Bit_Flipping, "Bit Flipping", "Bit Flipping", wx.ITEM_CHECK) 591 | 592 | fuzzing_menu.AppendMenu(self.ID_Fuzzing_Config_Menu, "Fuzzing Config", fuzzing_config_menu) 593 | 594 | fuzzing_menu.Append(self.ID_Fuzz_CEC, "Fuzz CEC") 595 | fuzzing_menu.Append(self.ID_stop_fuzzing, "Stop Fuzzing") 596 | 597 | self.mb.Append(fuzzing_menu, "Fuzzing") 598 | 599 | #------------------------------------------------------------------------------------------------------------- 600 | 601 | capture_menu = wx.Menu() 602 | 603 | capture_menu.Append(self.ID_startcapture, "Start CEC Capture") 604 | capture_menu.Append(self.ID_stopcapture, "Stop CEC Capture") 605 | 606 | self.mb.Append(capture_menu, "Capture") 607 | 608 | #------------------------------------------------------------------------------------------------------------- 609 | 610 | view_menu = wx.Menu() 611 | 612 | view_menu.Append(self.ID_showpollingmessages, "Show Polling Messages", "Show polling messages",wx.ITEM_CHECK) 613 | view_menu.Append(self.ID_showrawdata, "Suppress Raw Data","show raw data", wx.ITEM_CHECK) 614 | 615 | self.mb.Append(view_menu, "View") 616 | 617 | #------------------------------------------------------------------------------------------------------------- 618 | 619 | self.parent.SetMenuBar(self.mb) 620 | 621 | #------------------------------------------------------------------------------------------------------------- 622 | 623 | 624 | # "Command name", "Opcode", "parameters expected?" 625 | 626 | self.command_list = [ 627 | ["Active Source", "82",1], 628 | ["Image View On", "04",0], 629 | ["Text View On", "0D",0], 630 | 631 | ["Inactive Source", "9D",1], 632 | ["Request Active Source", "85",0], 633 | ["Routing Change", "80",1], 634 | ["Routing Information", "81",1], 635 | ["Set Stream Path", "86",1], 636 | 637 | ["Standby", "36",0], 638 | 639 | ["Record Off", "0B",0], 640 | ["Record On", "09",1], 641 | ["Record Status", "0A",1], 642 | ["Record TV Screen", "0F",0], 643 | 644 | ["Clear Analogue Timer", "33",1], 645 | ["Clear Digital Timer", "99",1], 646 | ["Clear External Timer", "A1",1], 647 | ["Set Analogue Timer", "34",1], 648 | ["Set Digital Timer", "97",1], 649 | ["Set External Timer", "A2",1], 650 | ["Set Timer Programme Title", "67",1], 651 | ["Timer Cleared Status", "43",1], 652 | ["Timer Status", "35",1], 653 | 654 | ["CEC Version", "9E",1], 655 | ["Get CEC Version", "9F",0], 656 | ["Give Physical Address", "83",0], 657 | ["Get Menu Language", "91",0], 658 | ["Report Physical Address", "84",1], 659 | ["Set Menu Language", "32",1], 660 | 661 | ["Deck Control", "42",1], 662 | ["Deck Status", "1B",1], 663 | ["Give Deck Status", "1A",1], 664 | ["Play", "41",1], 665 | 666 | ["Give Tuner Device Status", "08",1], 667 | ["Select Analogue Service", "92",1], 668 | ["Select Digital Service", "93",1], 669 | ["Tuner Device Status", "07",1], 670 | ["Tuner Step Decrement", "06",0], 671 | ["Tuner Step Increment", "05",0], 672 | 673 | ["Device Vendor ID", "87",1], 674 | ["Give Device Vendor ID", "8C",0], 675 | ["Vendor Command", "89",1], 676 | ["Vendor Command With ID", "A0",1], 677 | ["Vendor Remote Button Down", "8A",1], 678 | ["Vendor Remote Button Up", "8B",1], 679 | 680 | ["Set OSD String", "64",1], 681 | 682 | ["Give OSD Name", "46",0], 683 | ["Set OSD Name", "47",1], 684 | 685 | ["Menu Request", "8D",1], 686 | ["Menu Status", "8E",1], 687 | ["User Control Pressed", "44",1], 688 | ["User Control Released", "45",1], 689 | 690 | ["Give Device Power Status", "8F",0], 691 | ["Report Power Status", "90",1], 692 | 693 | ["Feature Abort", "00",1], 694 | ["Abort", "FF",0], 695 | 696 | ["Give Audio Status", "71",0], 697 | ["Give System Audio Mode Status", "7E",0], 698 | ["Report Audio Status", "7A",1], 699 | ["Report Short Audio Descriptor", "A3",1], 700 | ["Request Short Audio Descriptor", "A4",1], 701 | ["Set System Audio Mode", "72",1], 702 | ["System Audio Mode Request", "70",1], 703 | ["System Audio Mode Status", "7E",1], 704 | 705 | ["Set Audio Rate", "9A",1], 706 | 707 | ["Initiate ARC", "C0",0], 708 | ["Report ARC Initiated", "C1",0], 709 | ["Report ARC Terminated", "C2",0], 710 | ["Request ARC Initiation", "C3",0], 711 | ["Request ARC Termination", "C4",0], 712 | ["Terminate ARC", "C5",0], 713 | 714 | ["CDC Message", "F8",1]] 715 | 716 | 717 | self.cdc_command_list = [ 718 | ["CDC HEC InquireState", "00",1], 719 | ["CDC HEC ReportState", "01",1], 720 | ["CDC HEC SetStateAdjacent", "02",1], 721 | ["CDC HEC SetState", "03",1], 722 | ["CDC HEC RequestDeactivation", "04",1], 723 | ["CDC HEC NotifyAlive", "05",0], 724 | ["CDC HEC Discover", "06",0], 725 | 726 | ["CDC HPD SetState", "10",1], 727 | ["CDC HPD ReportState", "11",1]] 728 | 729 | 730 | 731 | 732 | self.target_list = [ 733 | ["0 - TV", "0"], 734 | ["1 - Recorder 1","1"], 735 | ["2 - Recorder 2","2"], 736 | ["3 - Tuner 1","3"], 737 | ["4 - Playback 1","4"], 738 | ["5 - Audio System","5"], 739 | ["6 - Tuner 2","6"], 740 | ["7 - Tuner 3","7"], 741 | ["8 - Playback 2","8"], 742 | ["9 - Recorder 3","9"], 743 | ["A - Tuner 4","A"], 744 | ["B - Playback 3","B"], 745 | ["C - Reserved 1","C"], 746 | ["D - Reserved 2","D"], 747 | ["E - Free use","E"], 748 | ["F - Broadcast","F"]] 749 | 750 | 751 | self.source_list = [ 752 | ["0 - TV", "0"], 753 | ["1 - Recorder 1","1"], 754 | ["2 - Recorder 2","2"], 755 | ["3 - Tuner 1","3"], 756 | ["4 - Playback 1","4"], 757 | ["5 - Audio System","5"], 758 | ["6 - Tuner 2","6"], 759 | ["7 - Tuner 3","7"], 760 | ["8 - Playback 2","8"], 761 | ["9 - Recorder 3","9"], 762 | ["A - Tuner 4","A"], 763 | ["B - Playback 3","B"], 764 | ["C - Reserved 1","C"], 765 | ["D - Reserved 2","D"], 766 | ["E - Free use","E"], 767 | ["F - Broadcast","F"]] 768 | 769 | 770 | self.vendorid_list = [ 771 | ["samsung", "00 00 F0"], 772 | ["LG", "00 E0 91"], 773 | ["Panasonic", "00 80 45"], 774 | ["Pioneer", "00 E0 36"], 775 | ["Onkyo", "00 09 B0"], 776 | ["Yamaha", "00 A0 DE"], 777 | ["Philips", "00 90 3E"], 778 | ["Sony", "08 00 46"], 779 | ["Toshiba", "00 00 39"]] 780 | 781 | 782 | # Create status bar 783 | 784 | self.statusbar = self.parent.CreateStatusBar(4, wx.ST_SIZEGRIP) 785 | self.statusbar.SetStatusWidths([-1,-1,-1,-1]) 786 | self.statusbar.SetStatusText("", 0) 787 | status1 = "Source Device: " + self.sourcename 788 | status2 = "Target Device: " + self.targetname 789 | self.statusbar.SetStatusText(status1, 1) 790 | self.statusbar.SetStatusText(status2, 2) 791 | self.statusbar.SetStatusText("Status: Normal", 3) 792 | 793 | # Background images 794 | 795 | image_file = 'images/cecster_logo.png' 796 | image = wx.Bitmap(image_file) 797 | image_size = image.GetSize() 798 | bm = wx.StaticBitmap(self, wx.ID_ANY, image, size=image_size, pos=(5,16)) 799 | 800 | image_file = 'images/ncc_logo.png' 801 | image = wx.Bitmap(image_file) 802 | image_size = image.GetSize() 803 | bm = wx.StaticBitmap(self, wx.ID_ANY, image, size=image_size, pos=(840,3)) 804 | 805 | image_file = 'images/underline.png' 806 | image = wx.Bitmap(image_file) 807 | image_size = image.GetSize() 808 | bm = wx.StaticBitmap(self, wx.ID_ANY, image, size=image_size, pos=(5,60)) 809 | 810 | 811 | # Text controls 812 | 813 | text = wx.StaticText(self, -1, "Output:",pos=(10,80)) 814 | text.SetBackgroundColour('White') 815 | font = wx.Font(9, wx.SWISS, wx.NORMAL, wx.NORMAL) 816 | text.SetFont(font) 817 | 818 | self.output = wx.TextCtrl(self, -1,"",size=(985, 500), pos=(10, 100), style=wx.TE_MULTILINE|wx.TE_RICH2 819 | |wx.TE_READONLY) 820 | self.output.SetBackgroundColour("BLACK") 821 | 822 | f = wx.Font(self.current_font_size, wx.MODERN, wx.NORMAL, wx.NORMAL) 823 | self.output.SetDefaultStyle(wx.TextAttr("GREEN", wx.NullColour, f)) 824 | self.output.AppendText("Welcome to CECSTeR v1.0 - The Consumer Electronics Control Security Testing Resource\n") 825 | self.output.AppendText("The tool enables the testing of HDMI protocols including CEC, CDC and HEC\n\n") 826 | 827 | text = wx.StaticText(self, -1, "Commands:",pos=(10,605)) 828 | text.SetBackgroundColour('White') 829 | font = wx.Font(9, wx.SWISS, wx.NORMAL, wx.NORMAL) 830 | text.SetFont(font) 831 | 832 | self.command = wx.TextCtrl(self, -1,"",size=(985, 60), pos=(10, 625), style=wx.TE_MULTILINE|wx.TE_RICH2) 833 | 834 | self.command.Bind(wx.EVT_KEY_DOWN, self.OnKey) 835 | 836 | 837 | self.command.SetBackgroundColour("BLACK") 838 | 839 | f = wx.Font(12, wx.MODERN, wx.NORMAL, wx.NORMAL) 840 | self.command.SetDefaultStyle(wx.TextAttr("GREEN", wx.NullColour, f)) 841 | self.command.AppendText("CEC:> ") 842 | self.command.SetFocus() 843 | 844 | 845 | self.parent.Bind(wx.EVT_MENU, self.About, id=self.ID_About) 846 | self.parent.Bind(wx.EVT_MENU, self.CloseMe, id=wx.ID_EXIT) 847 | 848 | self.parent.Bind(wx.EVT_MENU, self.EnumerateBus, id=self.ID_Enumerate_Devices) 849 | 850 | self.parent.Bind(wx.EVT_MENU, self.ProcessSourceSelect, id=self.ID_S_0_TV) 851 | self.parent.Bind(wx.EVT_MENU, self.ProcessSourceSelect, id=self.ID_S_Recorder_1) 852 | self.parent.Bind(wx.EVT_MENU, self.ProcessSourceSelect, id=self.ID_S_Recorder_2) 853 | self.parent.Bind(wx.EVT_MENU, self.ProcessSourceSelect, id=self.ID_S_Tuner_1) 854 | self.parent.Bind(wx.EVT_MENU, self.ProcessSourceSelect, id=self.ID_S_Playback_1) 855 | self.parent.Bind(wx.EVT_MENU, self.ProcessSourceSelect, id=self.ID_S_Audio_System) 856 | self.parent.Bind(wx.EVT_MENU, self.ProcessSourceSelect, id=self.ID_S_Tuner_2) 857 | self.parent.Bind(wx.EVT_MENU, self.ProcessSourceSelect, id=self.ID_S_Tuner_3) 858 | self.parent.Bind(wx.EVT_MENU, self.ProcessSourceSelect, id=self.ID_S_Playback_2) 859 | self.parent.Bind(wx.EVT_MENU, self.ProcessSourceSelect, id=self.ID_S_Recorder_3) 860 | self.parent.Bind(wx.EVT_MENU, self.ProcessSourceSelect, id=self.ID_S_Tuner_4) 861 | self.parent.Bind(wx.EVT_MENU, self.ProcessSourceSelect, id=self.ID_S_Playback_3) 862 | self.parent.Bind(wx.EVT_MENU, self.ProcessSourceSelect, id=self.ID_S_Reserved_1) 863 | self.parent.Bind(wx.EVT_MENU, self.ProcessSourceSelect, id=self.ID_S_Reserved_2) 864 | self.parent.Bind(wx.EVT_MENU, self.ProcessSourceSelect, id=self.ID_S_Free_use) 865 | self.parent.Bind(wx.EVT_MENU, self.ProcessSourceSelect, id=self.ID_S_Broadcast) 866 | 867 | self.parent.Bind(wx.EVT_MENU, self.ProcessTargetSelect, id=self.ID_0_TV) 868 | self.parent.Bind(wx.EVT_MENU, self.ProcessTargetSelect, id=self.ID_Recorder_1) 869 | self.parent.Bind(wx.EVT_MENU, self.ProcessTargetSelect, id=self.ID_Recorder_2) 870 | self.parent.Bind(wx.EVT_MENU, self.ProcessTargetSelect, id=self.ID_Tuner_1) 871 | self.parent.Bind(wx.EVT_MENU, self.ProcessTargetSelect, id=self.ID_Playback_1) 872 | self.parent.Bind(wx.EVT_MENU, self.ProcessTargetSelect, id=self.ID_Audio_System) 873 | self.parent.Bind(wx.EVT_MENU, self.ProcessTargetSelect, id=self.ID_Tuner_2) 874 | self.parent.Bind(wx.EVT_MENU, self.ProcessTargetSelect, id=self.ID_Tuner_3) 875 | self.parent.Bind(wx.EVT_MENU, self.ProcessTargetSelect, id=self.ID_Playback_2) 876 | self.parent.Bind(wx.EVT_MENU, self.ProcessTargetSelect, id=self.ID_Recorder_3) 877 | self.parent.Bind(wx.EVT_MENU, self.ProcessTargetSelect, id=self.ID_Tuner_4) 878 | self.parent.Bind(wx.EVT_MENU, self.ProcessTargetSelect, id=self.ID_Playback_3) 879 | self.parent.Bind(wx.EVT_MENU, self.ProcessTargetSelect, id=self.ID_Reserved_1) 880 | self.parent.Bind(wx.EVT_MENU, self.ProcessTargetSelect, id=self.ID_Reserved_2) 881 | self.parent.Bind(wx.EVT_MENU, self.ProcessTargetSelect, id=self.ID_Free_use) 882 | self.parent.Bind(wx.EVT_MENU, self.ProcessTargetSelect, id=self.ID_Broadcast) 883 | 884 | self.parent.Bind(wx.EVT_MENU, self.ProcessCommand, id=self.ID_Active_Source) 885 | self.parent.Bind(wx.EVT_MENU, self.ProcessCommand, id=self.ID_Image_View_On) 886 | self.parent.Bind(wx.EVT_MENU, self.ProcessCommand, id=self.ID_Text_View_On) 887 | self.parent.Bind(wx.EVT_MENU, self.ProcessCommand, id=self.ID_Inactive_Source) 888 | self.parent.Bind(wx.EVT_MENU, self.ProcessCommand, id=self.ID_Request_Active_Source) 889 | self.parent.Bind(wx.EVT_MENU, self.ProcessCommand, id=self.ID_Routing_Change) 890 | self.parent.Bind(wx.EVT_MENU, self.ProcessCommand, id=self.ID_Routing_Information) 891 | self.parent.Bind(wx.EVT_MENU, self.ProcessCommand, id=self.ID_Set_Stream_Path) 892 | self.parent.Bind(wx.EVT_MENU, self.ProcessCommand, id=self.ID_Standby) 893 | self.parent.Bind(wx.EVT_MENU, self.ProcessCommand, id=self.ID_Record_Off) 894 | self.parent.Bind(wx.EVT_MENU, self.ProcessCommand, id=self.ID_Record_On) 895 | self.parent.Bind(wx.EVT_MENU, self.ProcessCommand, id=self.ID_Record_Status) 896 | self.parent.Bind(wx.EVT_MENU, self.ProcessCommand, id=self.ID_Record_TV_Screen) 897 | self.parent.Bind(wx.EVT_MENU, self.ProcessCommand, id=self.ID_Clear_Analogue_Timer) 898 | self.parent.Bind(wx.EVT_MENU, self.ProcessCommand, id=self.ID_Clear_Digital_Timer) 899 | self.parent.Bind(wx.EVT_MENU, self.ProcessCommand, id=self.ID_Clear_External_Timer) 900 | self.parent.Bind(wx.EVT_MENU, self.ProcessCommand, id=self.ID_Set_Analogue_Timer) 901 | self.parent.Bind(wx.EVT_MENU, self.ProcessCommand, id=self.ID_Set_Digital_Timer) 902 | self.parent.Bind(wx.EVT_MENU, self.ProcessCommand, id=self.ID_Set_External_Timer) 903 | self.parent.Bind(wx.EVT_MENU, self.ProcessCommand, id=self.ID_Set_Timer_Programme_Title) 904 | self.parent.Bind(wx.EVT_MENU, self.ProcessCommand, id=self.ID_Timer_Cleared_Status) 905 | self.parent.Bind(wx.EVT_MENU, self.ProcessCommand, id=self.ID_Timer_Status) 906 | self.parent.Bind(wx.EVT_MENU, self.ProcessCommand, id=self.ID_CEC_Version) 907 | self.parent.Bind(wx.EVT_MENU, self.ProcessCommand, id=self.ID_Get_CEC_Version) 908 | self.parent.Bind(wx.EVT_MENU, self.ProcessCommand, id=self.ID_Give_Physical_Address) 909 | self.parent.Bind(wx.EVT_MENU, self.ProcessCommand, id=self.ID_Get_Menu_Language) 910 | self.parent.Bind(wx.EVT_MENU, self.ProcessCommand, id=self.ID_Report_Physical_Address) 911 | self.parent.Bind(wx.EVT_MENU, self.ProcessCommand, id=self.ID_Set_Menu_Language) 912 | self.parent.Bind(wx.EVT_MENU, self.ProcessCommand, id=self.ID_Deck_Control) 913 | self.parent.Bind(wx.EVT_MENU, self.ProcessCommand, id=self.ID_Deck_Status) 914 | self.parent.Bind(wx.EVT_MENU, self.ProcessCommand, id=self.ID_Give_Deck_Status) 915 | self.parent.Bind(wx.EVT_MENU, self.ProcessCommand, id=self.ID_Play) 916 | self.parent.Bind(wx.EVT_MENU, self.ProcessCommand, id=self.ID_Give_Tuner_Device_Status) 917 | self.parent.Bind(wx.EVT_MENU, self.ProcessCommand, id=self.ID_Select_Analogue_Service) 918 | self.parent.Bind(wx.EVT_MENU, self.ProcessCommand, id=self.ID_Select_Digital_Service) 919 | self.parent.Bind(wx.EVT_MENU, self.ProcessCommand, id=self.ID_Tuner_Device_Status) 920 | self.parent.Bind(wx.EVT_MENU, self.ProcessCommand, id=self.ID_Tuner_Step_Decrement) 921 | self.parent.Bind(wx.EVT_MENU, self.ProcessCommand, id=self.ID_Tuner_Step_Increment) 922 | self.parent.Bind(wx.EVT_MENU, self.ProcessCommand, id=self.ID_Device_Vendor_ID) 923 | self.parent.Bind(wx.EVT_MENU, self.ProcessCommand, id=self.ID_Give_Device_Vendor_ID) 924 | self.parent.Bind(wx.EVT_MENU, self.ProcessCommand, id=self.ID_Vendor_Command) 925 | self.parent.Bind(wx.EVT_MENU, self.ProcessCommand, id=self.ID_Vendor_Command_With_ID) 926 | self.parent.Bind(wx.EVT_MENU, self.ProcessCommand, id=self.ID_Vendor_Remote_Button_Down) 927 | self.parent.Bind(wx.EVT_MENU, self.ProcessCommand, id=self.ID_Vendor_Remote_Button_Up) 928 | self.parent.Bind(wx.EVT_MENU, self.ProcessCommand, id=self.ID_Set_OSD_String) 929 | self.parent.Bind(wx.EVT_MENU, self.ProcessCommand, id=self.ID_Give_OSD_Name) 930 | self.parent.Bind(wx.EVT_MENU, self.ProcessCommand, id=self.ID_Set_OSD_Name) 931 | self.parent.Bind(wx.EVT_MENU, self.ProcessCommand, id=self.ID_Menu_Request) 932 | self.parent.Bind(wx.EVT_MENU, self.ProcessCommand, id=self.ID_Menu_Status) 933 | self.parent.Bind(wx.EVT_MENU, self.ProcessCommand, id=self.ID_User_Control_Pressed) 934 | self.parent.Bind(wx.EVT_MENU, self.ProcessCommand, id=self.ID_User_Control_Released) 935 | self.parent.Bind(wx.EVT_MENU, self.ProcessCommand, id=self.ID_Give_Device_Power_Status) 936 | self.parent.Bind(wx.EVT_MENU, self.ProcessCommand, id=self.ID_Report_Power_Status) 937 | self.parent.Bind(wx.EVT_MENU, self.ProcessCommand, id=self.ID_Feature_Abort) 938 | self.parent.Bind(wx.EVT_MENU, self.ProcessCommand, id=self.ID_Abort) 939 | self.parent.Bind(wx.EVT_MENU, self.ProcessCommand, id=self.ID_Give_Audio_Status) 940 | self.parent.Bind(wx.EVT_MENU, self.ProcessCommand, id=self.ID_Give_System_Audio_Mode_Status) 941 | self.parent.Bind(wx.EVT_MENU, self.ProcessCommand, id=self.ID_Report_Audio_Status) 942 | self.parent.Bind(wx.EVT_MENU, self.ProcessCommand, id=self.ID_Report_Short_Audio_Descriptor) 943 | self.parent.Bind(wx.EVT_MENU, self.ProcessCommand, id=self.ID_Request_Short_Audio_Descriptor) 944 | self.parent.Bind(wx.EVT_MENU, self.ProcessCommand, id=self.ID_Set_System_Audio_Mode) 945 | self.parent.Bind(wx.EVT_MENU, self.ProcessCommand, id=self.ID_System_Audio_Mode_Request) 946 | self.parent.Bind(wx.EVT_MENU, self.ProcessCommand, id=self.ID_System_Audio_Mode_Status) 947 | self.parent.Bind(wx.EVT_MENU, self.ProcessCommand, id=self.ID_Set_Audio_Rate) 948 | self.parent.Bind(wx.EVT_MENU, self.ProcessCommand, id=self.ID_Initiate_ARC) 949 | self.parent.Bind(wx.EVT_MENU, self.ProcessCommand, id=self.ID_Report_ARC_Initiated) 950 | self.parent.Bind(wx.EVT_MENU, self.ProcessCommand, id=self.ID_Report_ARC_Terminated) 951 | self.parent.Bind(wx.EVT_MENU, self.ProcessCommand, id=self.ID_Request_ARC_Initiation) 952 | self.parent.Bind(wx.EVT_MENU, self.ProcessCommand, id=self.ID_Request_ARC_Termination) 953 | self.parent.Bind(wx.EVT_MENU, self.ProcessCommand, id=self.ID_Terminate_ARC) 954 | self.parent.Bind(wx.EVT_MENU, self.ProcessCommand, id=self.ID_CDC_Message) 955 | 956 | self.parent.Bind(wx.EVT_MENU, self.ProcessCDCCommand, id=self.ID_CDC_HEC_InquireState) 957 | self.parent.Bind(wx.EVT_MENU, self.ProcessCDCCommand, id=self.ID_CDC_HEC_ReportState) 958 | self.parent.Bind(wx.EVT_MENU, self.ProcessCDCCommand, id=self.ID_CDC_HEC_SetStateAdjacent) 959 | self.parent.Bind(wx.EVT_MENU, self.ProcessCDCCommand, id=self.ID_CDC_HEC_SetState) 960 | self.parent.Bind(wx.EVT_MENU, self.ProcessCDCCommand, id=self.ID_CDC_HEC_RequestDeactivation) 961 | self.parent.Bind(wx.EVT_MENU, self.ProcessCDCCommand, id=self.ID_CDC_HEC_NotifyAlive) 962 | self.parent.Bind(wx.EVT_MENU, self.ProcessCDCCommand, id=self.ID_CDC_HEC_Discover) 963 | 964 | self.parent.Bind(wx.EVT_MENU, self.ProcessCDCCommand, id=self.ID_CDC_HPD_SetState) 965 | self.parent.Bind(wx.EVT_MENU, self.ProcessCDCCommand, id=self.ID_CDC_HPD_ReportState) 966 | 967 | self.parent.Bind(wx.EVT_MENU, self.FuzzCEC, id=self.ID_Fuzz_CEC) 968 | self.parent.Bind(wx.EVT_MENU, self.StopFuzzing, id=self.ID_stop_fuzzing) 969 | 970 | self.parent.Bind(wx.EVT_MENU, self.Toggle_Long_Strings, id=self.ID_Long_Strings) 971 | self.parent.Bind(wx.EVT_MENU, self.Toggle_Format_Strings, id=self.ID_Format_Strings) 972 | self.parent.Bind(wx.EVT_MENU, self.Toggle_Bit_Flipping, id=self.ID_Bit_Flipping) 973 | 974 | self.parent.Bind(wx.EVT_MENU, self.Toggle_polling, id=self.ID_showpollingmessages) 975 | self.parent.Bind(wx.EVT_MENU, self.Toggle_dataview, id=self.ID_showrawdata) 976 | 977 | self.parent.Bind(wx.EVT_MENU, self.StartCapture, id=self.ID_startcapture) 978 | self.parent.Bind(wx.EVT_MENU, self.StopCapture, id=self.ID_stopcapture) 979 | 980 | 981 | 982 | #------- main code ------------------------------------------------------------------------------------------- 983 | 984 | try: 985 | self.ser = serial.Serial(self.serialport, 9600, timeout=0.5, parity=serial.PARITY_NONE, stopbits=1) 986 | 987 | except: 988 | wx.MessageBox("Serial communication error", caption="Error", style=wx.OK|wx.ICON_ERROR, parent=self) 989 | self.Close(True) 990 | sys.exit(0) 991 | 992 | 993 | self.output.AppendText(time.strftime("%H:%M:%S ", time.localtime())) 994 | self.output.AppendText("Status: CEC-USB Bridge connected ok\n") 995 | self.output.AppendText(time.strftime("%H:%M:%S ", time.localtime())) 996 | 997 | 998 | self.physical = self.GetPhysicalAddress() 999 | wx.Yield() 1000 | self.source = self.GetLogicalAddress() 1001 | wx.Yield() 1002 | 1003 | #command = "!OCECSTeR~" 1004 | #self.RawCommandSend (command) 1005 | 1006 | self.output.AppendText("Status: Source configured as physical address: ") 1007 | self.output.AppendText(self.physical[0]) 1008 | self.output.AppendText(".") 1009 | self.output.AppendText(self.physical[1]) 1010 | self.output.AppendText(".") 1011 | self.output.AppendText(self.physical[2]) 1012 | self.output.AppendText(".") 1013 | self.output.AppendText(self.physical[3]) 1014 | self.output.AppendText("\n") 1015 | self.output.AppendText(time.strftime("%H:%M:%S ", time.localtime())) 1016 | self.output.AppendText("Status: Source configured as logical address: ") 1017 | self.output.AppendText(self.sourcename) 1018 | self.output.AppendText("\n") 1019 | self.output.AppendText(time.strftime("%H:%M:%S ", time.localtime())) 1020 | self.output.AppendText("Status: Target configured as logical address: ") 1021 | self.output.AppendText(self.targetname) 1022 | self.output.AppendText("\n") 1023 | 1024 | 1025 | #------- functions ------------------------------------------------------------------------------------------- 1026 | 1027 | 1028 | 1029 | def RawCommandSend(self,CommandToSend): 1030 | 1031 | self.ser.write (CommandToSend) 1032 | 1033 | 1034 | def SendCommand(self,target,opcode,data): 1035 | 1036 | command = "!x" 1037 | command += target 1038 | command += " " 1039 | command += opcode 1040 | command += " " 1041 | command += data 1042 | command += "~" 1043 | 1044 | if opcode == "": 1045 | print "no opcode" 1046 | return 1047 | 1048 | 1049 | self.RawCommandSend (command) 1050 | print command 1051 | 1052 | found = False 1053 | x = 0 1054 | while (x < len (self.command_list)): 1055 | if (self.command_list[x][1] == opcode): 1056 | self.CurrentCommand = self.command_list[x][0] 1057 | found = True 1058 | break 1059 | x+=1 1060 | 1061 | if (found == False): 1062 | self.CurrentCommand = "Unknown" 1063 | 1064 | if (self.enumerating == True): 1065 | return command 1066 | 1067 | self.output.AppendText(time.strftime("%H:%M:%S ", time.localtime())) 1068 | self.output.AppendText("Sent command: ") 1069 | self.output.AppendText(opcode) 1070 | self.output.AppendText(" - \"") 1071 | self.output.AppendText(self.CurrentCommand) 1072 | self.output.AppendText("\"") 1073 | self.output.AppendText("\n") 1074 | 1075 | return command 1076 | 1077 | 1078 | 1079 | def StartCapture(self,event): 1080 | 1081 | self.capture = True 1082 | self.statusbar.SetStatusText("Status: Capturing", 3) 1083 | self.output.AppendText(time.strftime("%H:%M:%S ", time.localtime())) 1084 | self.output.AppendText("Status: CEC capture started ") 1085 | if (self.suppress_polling_messages == True): 1086 | self.output.AppendText("(\"polling\" messages are being suppressed)\n") 1087 | else: 1088 | self.output.AppendText("\n") 1089 | 1090 | self.output.AppendText("\n") 1091 | 1092 | while (self.capture == True): 1093 | wx.Yield() 1094 | self.DisplayResponse() 1095 | 1096 | 1097 | def StopCapture(self,event): 1098 | 1099 | if (self.capture == False): 1100 | return 1101 | 1102 | self.capture = False 1103 | self.output.AppendText("\n") 1104 | self.output.AppendText(time.strftime("%H:%M:%S ", time.localtime())) 1105 | self.output.AppendText("Status: CEC capture stopped\n") 1106 | self.statusbar.SetStatusText("Status: Normal", 3) 1107 | self.output.AppendText("\n") 1108 | 1109 | 1110 | 1111 | def GetPhysicalAddress(self): 1112 | command = "!P~" 1113 | 1114 | self.RawCommandSend (command) 1115 | sub = "PHY " 1116 | self.enumerating = True # prevent extraneous text being output by ReceiveData() 1117 | buf = self.ReceiveData() 1118 | self.enumerating = False 1119 | pos = string.find(buf, sub) 1120 | pos += 4 1121 | physical = buf[pos] 1122 | physical += buf[pos+1] 1123 | physical += buf[pos+2] 1124 | physical += buf[pos+3] 1125 | 1126 | return physical 1127 | 1128 | 1129 | def GetLogicalAddress(self): 1130 | command = "!a~" 1131 | 1132 | self.RawCommandSend (command) 1133 | sub = "ADR " 1134 | self.enumerating = True # prevent extraneous text being output by ReceiveData() 1135 | buf = self.ReceiveData() 1136 | self.enumerating = False 1137 | pos = string.find(buf, sub) 1138 | pos += 4 1139 | logical = buf[pos] 1140 | 1141 | x = 0 1142 | while (x < len (self.source_list)): 1143 | if (self.source_list[x][1] == logical): 1144 | self.sourcename = self.source_list[x][0] 1145 | x+=1 1146 | 1147 | status = "Source Device: " + self.sourcename 1148 | self.statusbar.SetStatusText(status, 1) 1149 | 1150 | return logical 1151 | 1152 | 1153 | def EnumerateBus(self,event): 1154 | x = 0 1155 | target = "" 1156 | data = "" 1157 | buf = "" 1158 | sub = "" 1159 | 1160 | self.enumerating = True 1161 | 1162 | self.output.AppendText(time.strftime("%H:%M:%S ", time.localtime())) 1163 | self.output.AppendText("Status: Enumerating CEC bus - the following devices are present:") 1164 | self.output.AppendText("\n\n") 1165 | 1166 | 1167 | 1168 | while (x < 16): 1169 | 1170 | wx.Yield() 1171 | 1172 | target = "%x" % x 1173 | target = target.upper() 1174 | alive = "" 1175 | opcode = "FF" 1176 | 1177 | CommandSent = self.SendCommand(target,opcode,data) 1178 | sub = "REC " + self.source + target + " FF" 1179 | buf = self.ReceiveData() 1180 | pos = string.find(buf, sub) 1181 | pos += 10 1182 | 1183 | if buf[pos] == "1": 1184 | 1185 | y = 0 1186 | while (y < len (self.target_list)): 1187 | if target == self.target_list[y][1]: 1188 | alive = self.target_list[y][0] 1189 | self.output.AppendText(alive) 1190 | if (target == self.source): 1191 | self.output.AppendText(" (CECSTeR)") 1192 | 1193 | self.output.AppendText("\n") 1194 | y+=1 1195 | 1196 | x+=1 1197 | 1198 | self.output.AppendText("\n") 1199 | self.output.AppendText(time.strftime("%H:%M:%S ", time.localtime())) 1200 | self.output.AppendText("Status: Bus enumeration complete") 1201 | self.output.AppendText("\n") 1202 | self.enumerating = False 1203 | 1204 | 1205 | def Toggle_polling(self,event): 1206 | 1207 | if self.suppress_polling_messages == True: 1208 | self.suppress_polling_messages = False 1209 | self.output.AppendText(time.strftime("%H:%M:%S ", time.localtime())) 1210 | self.output.AppendText("Status: Configuration changed - \"Polling messages\" enabled\n") 1211 | else: 1212 | self.suppress_polling_messages = True 1213 | self.output.AppendText(time.strftime("%H:%M:%S ", time.localtime())) 1214 | self.output.AppendText("Status: Configuration changed - \"Polling messages\" suppressed\n") 1215 | 1216 | 1217 | def Toggle_dataview(self,event): 1218 | 1219 | if self.dataview == True: 1220 | self.dataview = False 1221 | self.output.AppendText(time.strftime("%H:%M:%S ", time.localtime())) 1222 | self.output.AppendText("Status: Configuration changed - \"Raw data\" suppressed\n") 1223 | else: 1224 | self.dataview = True 1225 | self.output.AppendText(time.strftime("%H:%M:%S ", time.localtime())) 1226 | self.output.AppendText("Status: Configuration changed - \"Raw data\" enabled\n") 1227 | 1228 | 1229 | def Toggle_Long_Strings(self,event): 1230 | 1231 | if self.fuzz_long_strings == True: 1232 | self.fuzz_long_strings = False 1233 | self.output.AppendText(time.strftime("%H:%M:%S ", time.localtime())) 1234 | self.output.AppendText("Fuzzing: Configuration changed - \"Long Strings\" disabled\n") 1235 | else: 1236 | self.fuzz_long_strings = True 1237 | self.output.AppendText(time.strftime("%H:%M:%S ", time.localtime())) 1238 | self.output.AppendText("Fuzzing: Configuration changed - \"Long Strings\" enabled\n") 1239 | 1240 | 1241 | def Toggle_Format_Strings(self,event): 1242 | 1243 | if self.fuzz_format_strings == True: 1244 | self.fuzz_format_strings = False 1245 | self.output.AppendText(time.strftime("%H:%M:%S ", time.localtime())) 1246 | self.output.AppendText("Fuzzing: Configuration changed - \"Format Strings\" disabled\n") 1247 | else: 1248 | self.fuzz_format_strings = True 1249 | self.output.AppendText(time.strftime("%H:%M:%S ", time.localtime())) 1250 | self.output.AppendText("Fuzzing: Configuration changed - \"Format Strings\" enabled\n") 1251 | 1252 | 1253 | def Toggle_Bit_Flipping(self,event): 1254 | 1255 | if self.fuzz_bit_flipping == True: 1256 | self.fuzz_bit_flipping = False 1257 | self.output.AppendText(time.strftime("%H:%M:%S ", time.localtime())) 1258 | self.output.AppendText("Fuzzing: Configuration changed - \"Bit Flipping\" disabled\n") 1259 | else: 1260 | self.fuzz_bit_flipping = True 1261 | self.output.AppendText(time.strftime("%H:%M:%S ", time.localtime())) 1262 | self.output.AppendText("Fuzzing: Configuration changed - \"Bit Flipping\" enabled\n") 1263 | 1264 | 1265 | 1266 | def FuzzCEC(self,event): 1267 | 1268 | 1269 | logfilepath = "logfile_CEC_" + time.strftime("%Y-%m-%d", time.localtime()) + ".txt" 1270 | self.fplog = file(logfilepath, 'a') # open logfile for writing 1271 | self.fplog.write("\n\n**** CECSTeR Log file ****\n\n") 1272 | 1273 | self.output.AppendText(time.strftime("%H:%M:%S ", time.localtime())) 1274 | self.output.AppendText("Fuzzing: CEC Fuzzer started\n") 1275 | 1276 | self.fplog.write(time.strftime("%H:%M:%S ", time.localtime())) 1277 | self.fplog.write("Fuzzing: CEC Fuzzer started\n") 1278 | 1279 | self.fuzzing = True 1280 | self.statusbar.SetStatusText("Status: Fuzzing", 3) 1281 | 1282 | 1283 | if (self.fuzz_long_strings == True): 1284 | self.TestCase1(0x00,0xff) 1285 | 1286 | if (self.fuzz_format_strings == True): 1287 | self.TestCase2(0x00,0xff) 1288 | 1289 | if (self.fuzz_bit_flipping == True): 1290 | self.TestCase3(0x00,0xff,14) 1291 | 1292 | 1293 | self.output.AppendText(time.strftime("%H:%M:%S ", time.localtime())) 1294 | self.output.AppendText("Fuzzing: CEC Fuzzer finished\n") 1295 | 1296 | self.fplog.write(time.strftime("%H:%M:%S ", time.localtime())) 1297 | self.fplog.write("Fuzzing: CEC Fuzzer finished\n") 1298 | 1299 | self.fuzzing = False 1300 | self.statusbar.SetStatusText("Status: Normal", 3) 1301 | self.fplog.close() 1302 | 1303 | 1304 | def StopFuzzing(self,event): 1305 | 1306 | if (self.fuzzing == False): 1307 | return 1308 | 1309 | self.fuzzing = False 1310 | 1311 | self.output.AppendText(time.strftime("%H:%M:%S ", time.localtime())) 1312 | self.output.AppendText("Fuzzing: Fuzzing stopped by user\n") 1313 | 1314 | self.fplog.write(time.strftime("%H:%M:%S ", time.localtime())) 1315 | self.fplog.write("Fuzzing: Fuzzing stopped by user\n") 1316 | 1317 | self.statusbar.SetStatusText("Status: Normal", 3) 1318 | 1319 | 1320 | 1321 | 1322 | # ----------------------------------------------------------------------------- 1323 | # TestCase #1 - Long strings 1324 | # ----------------------------------------------------------------------------- 1325 | 1326 | def TestCase1(self, start, end): 1327 | 1328 | self.output.AppendText(time.strftime("%H:%M:%S ", time.localtime())) 1329 | self.output.AppendText("Fuzzing: TestCase #1 - Long strings\n") 1330 | 1331 | self.fplog.write(time.strftime("%H:%M:%S ", time.localtime())) 1332 | self.fplog.write("Fuzzing: TestCase #1 - Long strings\n") 1333 | 1334 | self.output.AppendText(time.strftime("%H:%M:%S ", time.localtime())) 1335 | self.output.AppendText("Fuzzing: TestCase #1 - 14 bytes\n") 1336 | string = "61 " * 14 1337 | self.TestType2(string,start,end) 1338 | 1339 | self.output.AppendText(time.strftime("%H:%M:%S ", time.localtime())) 1340 | self.output.AppendText("Fuzzing: TestCase #1 - 15 bytes\n") 1341 | string = "61 " * 15 1342 | self.TestType2(string,start,end) 1343 | 1344 | self.output.AppendText(time.strftime("%H:%M:%S ", time.localtime())) 1345 | self.output.AppendText("Fuzzing: TestCase #1 - 100 bytes\n") 1346 | string = "61 " * 100 1347 | self.TestType2(string,start,end) 1348 | 1349 | self.output.AppendText(time.strftime("%H:%M:%S ", time.localtime())) 1350 | self.output.AppendText("Fuzzing: TestCase #1 - 300 bytes\n") 1351 | string = "61 " * 300 1352 | self.TestType2(string,start,end) 1353 | 1354 | self.output.AppendText(time.strftime("%H:%M:%S ", time.localtime())) 1355 | self.output.AppendText("Fuzzing: TestCase #1 - finished\n") 1356 | 1357 | 1358 | # ----------------------------------------------------------------------------- 1359 | # TestCase #2 - Format strings 1360 | # ----------------------------------------------------------------------------- 1361 | 1362 | def TestCase2(self, start, end): 1363 | 1364 | self.output.AppendText(time.strftime("%H:%M:%S ", time.localtime())) 1365 | self.output.AppendText("Fuzzing: TestCase #2 - Format strings\n") 1366 | 1367 | self.fplog.write(time.strftime("%H:%M:%S ", time.localtime())) 1368 | self.fplog.write("Fuzzing: TestCase #2 - Format strings\n") 1369 | 1370 | self.output.AppendText(time.strftime("%H:%M:%S ", time.localtime())) 1371 | self.output.AppendText("Fuzzing: TestCase #2 - Test #1\n") 1372 | string = "25 6e 25 6e 25 6e 25 6e 25 6e" # %n%n%n%n%n 1373 | self.TestType2(string,start,end) 1374 | 1375 | self.output.AppendText(time.strftime("%H:%M:%S ", time.localtime())) 1376 | self.output.AppendText("Fuzzing: TestCase #2 - Test #2\n") 1377 | string = "25 70 25 70 25 70 25 70 25 70" # %p%p%p%p%p 1378 | self.TestType2(string,start,end) 1379 | 1380 | self.output.AppendText(time.strftime("%H:%M:%S ", time.localtime())) 1381 | self.output.AppendText("Fuzzing: TestCase #2 - Test #3\n") 1382 | string = "25 73 25 73 25 73 25 73 25 73" # %s%s%s%s%s 1383 | self.TestType2(string,start,end) 1384 | 1385 | self.output.AppendText(time.strftime("%H:%M:%S ", time.localtime())) 1386 | self.output.AppendText("Fuzzing: TestCase #2 - Test #4\n") 1387 | string = "25 78 25 78 25 78 25 78 25 78" # %x%x%x%x%x 1388 | self.TestType2(string,start,end) 1389 | 1390 | self.output.AppendText(time.strftime("%H:%M:%S ", time.localtime())) 1391 | self.output.AppendText("Fuzzing: TestCase #2 - Test #5\n") 1392 | string = "25 73 25 70 25 78 25 64" # %s%p%x%d 1393 | self.TestType2(string,start,end) 1394 | 1395 | self.output.AppendText(time.strftime("%H:%M:%S ", time.localtime())) 1396 | self.output.AppendText("Fuzzing: TestCase #2 - Test #6\n") 1397 | string = "25 2e 31 30 32 34 64" # %.1024d 1398 | self.TestType2(string,start,end) 1399 | 1400 | self.output.AppendText(time.strftime("%H:%M:%S ", time.localtime())) 1401 | self.output.AppendText("Fuzzing: TestCase #2 - Test #7\n") 1402 | string = "25 2e 31 30 32 35 64" # %.1025d 1403 | self.TestType2(string,start,end) 1404 | 1405 | self.output.AppendText(time.strftime("%H:%M:%S ", time.localtime())) 1406 | self.output.AppendText("Fuzzing: TestCase #2 - Test #8\n") 1407 | string = "25 2e 32 30 34 38 64" # %.2048d 1408 | self.TestType2(string,start,end) 1409 | 1410 | self.output.AppendText(time.strftime("%H:%M:%S ", time.localtime())) 1411 | self.output.AppendText("Fuzzing: TestCase #2 - Test #9\n") 1412 | string = "25 2e 32 30 34 39 64" # %.2049d 1413 | self.TestType2(string,start,end) 1414 | 1415 | self.output.AppendText(time.strftime("%H:%M:%S ", time.localtime())) 1416 | self.output.AppendText("Fuzzing: TestCase #2 - Test #10\n") 1417 | string = "25 2e 34 30 39 36 64" # %.4096d 1418 | self.TestType2(string,start,end) 1419 | 1420 | self.output.AppendText(time.strftime("%H:%M:%S ", time.localtime())) 1421 | self.output.AppendText("Fuzzing: TestCase #2 - Test #11\n") 1422 | string = "25 2e 34 30 39 37 64" # %.4097d 1423 | self.TestType2(string,start,end) 1424 | 1425 | self.output.AppendText(time.strftime("%H:%M:%S ", time.localtime())) 1426 | self.output.AppendText("Fuzzing: TestCase #2 - Test #12\n") 1427 | string = "25 39 39 39 39 39 39 39 39 39 39 73" # %9999999999s 1428 | self.TestType2(string,start,end) 1429 | 1430 | self.output.AppendText(time.strftime("%H:%M:%S ", time.localtime())) 1431 | self.output.AppendText("Fuzzing: TestCase #2 - Test #13\n") 1432 | string = "25 30 38 78" # %08x 1433 | self.TestType2(string,start,end) 1434 | 1435 | self.output.AppendText(time.strftime("%H:%M:%S ", time.localtime())) 1436 | self.output.AppendText("Fuzzing: TestCase #2 - Test #14\n") 1437 | string = "25 25 32 30 6e" # %%20n 1438 | self.TestType2(string,start,end) 1439 | 1440 | self.output.AppendText(time.strftime("%H:%M:%S ", time.localtime())) 1441 | self.output.AppendText("Fuzzing: TestCase #2 - Test #15\n") 1442 | string = "25 25 32 30 70" # %%20p 1443 | self.TestType2(string,start,end) 1444 | 1445 | self.output.AppendText(time.strftime("%H:%M:%S ", time.localtime())) 1446 | self.output.AppendText("Fuzzing: TestCase #2 - Test #16\n") 1447 | string = "25 25 32 30 73" # %%20s 1448 | self.TestType2(string,start,end) 1449 | 1450 | self.output.AppendText(time.strftime("%H:%M:%S ", time.localtime())) 1451 | self.output.AppendText("Fuzzing: TestCase #2 - Test #17\n") 1452 | string = "25 25 32 30 64" # %%20d 1453 | self.TestType2(string,start,end) 1454 | 1455 | self.output.AppendText(time.strftime("%H:%M:%S ", time.localtime())) 1456 | self.output.AppendText("Fuzzing: TestCase #2 - Test #18\n") 1457 | string = "25 25 32 30 78" # %%20x 1458 | self.TestType2(string,start,end) 1459 | 1460 | self.output.AppendText(time.strftime("%H:%M:%S ", time.localtime())) 1461 | self.output.AppendText("Fuzzing: TestCase #2 - finished\n") 1462 | 1463 | 1464 | 1465 | # ----------------------------------------------------------------------------- 1466 | # TestCase #3 - Iterative bit flip 1467 | # ----------------------------------------------------------------------------- 1468 | 1469 | def TestCase3(self, start, end, maxparams): 1470 | 1471 | self.output.AppendText(time.strftime("%H:%M:%S ", time.localtime())) 1472 | self.output.AppendText("Fuzzing: TestCase #3 - Iterative bit flip\n") 1473 | 1474 | self.fplog.write(time.strftime("%H:%M:%S ", time.localtime())) 1475 | self.fplog.write("Fuzzing: TestCase #3 - Iterative bit flip\n") 1476 | 1477 | 1478 | x = 0 1479 | y = 0 1480 | string = "" 1481 | prev = "" 1482 | 1483 | while (x < maxparams and self.fuzzing == True): 1484 | while (y < 256 and self.fuzzing == True): 1485 | temp = "%02x" % y 1486 | string = prev + temp.upper() 1487 | self.TestType2(string,start,end) 1488 | self.output.AppendText(time.strftime("%H:%M:%S ", time.localtime())) 1489 | self.output.AppendText("Fuzzing: TestCase #3 - data = ") 1490 | self.output.AppendText(string) 1491 | self.output.AppendText("\n") 1492 | y += 1 1493 | prev += "FF " 1494 | y = 0 1495 | x += 1 1496 | 1497 | self.output.AppendText(time.strftime("%H:%M:%S ", time.localtime())) 1498 | self.output.AppendText("Fuzzing: TestCase #3 - finished\n") 1499 | 1500 | 1501 | 1502 | 1503 | # ----------------------------------------------------------------------------- 1504 | # TestType #1 - Iterate through all possible opcodes with no data 1505 | # ----------------------------------------------------------------------------- 1506 | 1507 | def TestType1(self): 1508 | 1509 | x = 0 1510 | CommandSent = "" 1511 | data = "" 1512 | while (x < 256 and self.fuzzing == True): 1513 | wx.Yield() 1514 | 1515 | if (x == 0x36): # skip standby command 1516 | x = 0x37 1517 | 1518 | opcode = "%02x" % x 1519 | opcode = opcode.upper() 1520 | CommandSent = self.SendCommand(self.target,opcode,data) 1521 | print CommandSent 1522 | 1523 | self.fplog.write(time.strftime("%H:%M:%S ", time.localtime())) 1524 | self.fplog.write(CommandSent) 1525 | self.fplog.write("\n") 1526 | 1527 | self.DisplayResponse() 1528 | x+=1 1529 | 1530 | 1531 | # ----------------------------------------------------------------------------- 1532 | # TestType #2 - Send the same parameter bytes to a number of opcodes 1533 | # ----------------------------------------------------------------------------- 1534 | 1535 | def TestType2(self, parameter_bytes, start, end): 1536 | 1537 | x = start 1538 | CommandSent = "" 1539 | data = parameter_bytes 1540 | while (x < end+1 and self.fuzzing == True): 1541 | wx.Yield() 1542 | 1543 | if (x == 0x36): # skip standby command 1544 | x = 0x37 1545 | 1546 | opcode = "%02x" % x 1547 | opcode = opcode.upper() 1548 | CommandSent = self.SendCommand(self.target,opcode,data) 1549 | print CommandSent 1550 | 1551 | self.fplog.write(time.strftime("%H:%M:%S ", time.localtime())) 1552 | self.fplog.write(CommandSent) 1553 | self.fplog.write("\n") 1554 | 1555 | self.DisplayResponse() 1556 | x+=1 1557 | 1558 | 1559 | 1560 | # ----------------------------------------------------------------------------- 1561 | # TestType #3 - Mutate data then send with specific opcode 1562 | # ----------------------------------------------------------------------------- 1563 | 1564 | def TestType3(self, parameter_bytes_list, opcode, number_mutations): 1565 | 1566 | x = 0 1567 | temp_list = [] 1568 | byte_to_mutate = 0 1569 | mutate_value = 0 1570 | data = "" 1571 | number_of_bytes = len(parameter_bytes_list) 1572 | number_of_bytes -= 1 1573 | 1574 | while (x < number_mutations and self.fuzzing == True): 1575 | 1576 | wx.Yield() 1577 | 1578 | temp_list = parameter_bytes_list 1579 | 1580 | print parameter_bytes_list 1581 | print temp_list 1582 | 1583 | byte_to_mutate = randint(0,number_of_bytes) 1584 | temp_list[byte_to_mutate] = randint(0,255) 1585 | 1586 | y = 0 1587 | while (y < number_of_bytes+1): 1588 | data += "%02x " % temp_list[y] 1589 | y+=1 1590 | 1591 | data = data.upper() 1592 | data = data[:-1] #remove final space 1593 | 1594 | CommandSent = self.SendCommand(self.target,opcode,data) 1595 | print CommandSent 1596 | 1597 | self.fplog.write(time.strftime("%H:%M:%S ", time.localtime())) 1598 | self.fplog.write(CommandSent) 1599 | self.fplog.write("\n") 1600 | 1601 | self.DisplayResponse() 1602 | 1603 | data = "" 1604 | x+=1 1605 | 1606 | 1607 | 1608 | 1609 | def ReceiveData(self): 1610 | buf = self.ser.read(1000) 1611 | 1612 | return buf 1613 | 1614 | 1615 | def DisplayResponse(self): 1616 | 1617 | self.buf = self.ReceiveData() 1618 | 1619 | self.buf = string.replace(self.buf, "\r\n", "\n" ) 1620 | self.buf = string.replace(self.buf, "\r", "" ) 1621 | self.buf = string.replace(self.buf, "\n\n", "\n" ) 1622 | 1623 | 1624 | if (self.fuzzing == True): 1625 | 1626 | self.fplog.write(time.strftime("%H:%M:%S ", time.localtime())) 1627 | self.fplog.write(self.buf) 1628 | 1629 | 1630 | if len(self.buf) > 1: 1631 | print self.buf 1632 | 1633 | x = 0 1634 | linebuf="" 1635 | 1636 | while (x < len (self.buf)): 1637 | data="" 1638 | source="" 1639 | dest="" 1640 | opcode="" 1641 | 1642 | x+=1 # read "?" 1643 | 1644 | if (x+2 < len (self.buf) - 1): 1645 | if (self.buf[x] == "S" and self.buf[x+1] == "T" and self.buf[x+2] == "A"): 1646 | x+=6 1647 | continue 1648 | 1649 | x+=4 # read "REC " 1650 | 1651 | if (x < len (self.buf) - 1): 1652 | source = self.buf[x] # parse logical source address 1653 | else: 1654 | self.output.AppendText("\n") 1655 | break # or leave 1656 | 1657 | x+=1 # source 1658 | 1659 | if (x < len (self.buf) - 1): 1660 | dest = self.buf[x] # parse logical source address 1661 | else: 1662 | self.output.AppendText("\n") 1663 | break # or leave 1664 | 1665 | x+=2 # dest + space 1666 | 1667 | # Parse data 1668 | 1669 | if (x < len (self.buf) - 1): 1670 | while (self.buf[x] != "\n"): 1671 | data += self.buf[x] # parse data 1672 | x+=1 1673 | 1674 | 1675 | x+=1 # carriage return 1676 | 1677 | 1678 | # Parse opcode 1679 | 1680 | if (len(data) > 2): 1681 | opcode = data[0] 1682 | opcode += data[1] 1683 | data = data[3:] # remove opcode from the data 1684 | 1685 | 1686 | # At this point we should have parsed the data from a response like ?REC 04 47 54 56 1 1687 | 1688 | if (dest == self.target): 1689 | 1690 | status = data[-2:] 1691 | 1692 | if (status == "2" or status == " 2"): 1693 | if (self.capture == True): 1694 | continue 1695 | 1696 | self.output.AppendText(time.strftime("%H:%M:%S ", time.localtime())) 1697 | self.output.AppendText ("Error: No response from target!\n") 1698 | continue 1699 | 1700 | 1701 | if (dest == self.source or dest == "F" or self.capture == True): # the filter - is it to us or to the broadcast address? 1702 | 1703 | data = data[:-2] # remove status byte 1704 | 1705 | 1706 | if (len(opcode) == 0): 1707 | if (self.suppress_polling_messages == True): 1708 | continue #suppress "polling" messages 1709 | 1710 | self.output.AppendText(time.strftime("%H:%M:%S ", time.localtime())) 1711 | self.output.AppendText("Source: ") 1712 | self.output.AppendText(source) 1713 | self.output.AppendText(" Dest: ") 1714 | self.output.AppendText(dest) 1715 | self.output.AppendText(" ") 1716 | 1717 | 1718 | if (len(opcode) > 0): 1719 | z = 0 1720 | while (z < len (self.command_list)): 1721 | if (self.command_list[z][1] == opcode): 1722 | retcommand = self.command_list[z][0] 1723 | self.output.AppendText("\"") 1724 | self.output.AppendText(retcommand) 1725 | self.output.AppendText("\" ") 1726 | break 1727 | z+=1 1728 | else: 1729 | if (self.suppress_polling_messages == False): 1730 | self.output.AppendText("\"") 1731 | self.output.AppendText("polling") 1732 | self.output.AppendText("\"") 1733 | self.output.AppendText("\n") 1734 | continue 1735 | 1736 | datalist = data.split(' ') 1737 | 1738 | #------- parse command-specific responses ------------------- 1739 | 1740 | 1741 | if opcode == "00" and len(datalist) > 1: # Feature Abort 1742 | 1743 | print datalist 1744 | if datalist[1] == "00": 1745 | self.output.AppendText("(Unrecognized opcode) ") 1746 | if datalist[1] == "01": 1747 | self.output.AppendText("(Not in correct mode to respond) ") 1748 | if datalist[1] == "02": 1749 | self.output.AppendText("(Cannot provide source) ") 1750 | if datalist[1] == "03": 1751 | self.output.AppendText("(Invalid operand) ") 1752 | if datalist[1] == "04": 1753 | self.output.AppendText("(Refused) ") 1754 | if datalist[1] == "05": 1755 | self.output.AppendText("(Unable to determine) ") 1756 | 1757 | 1758 | #------------------------------------------------------------ 1759 | 1760 | if opcode == "47": # OSD Name 1761 | 1762 | a = 0 1763 | 1764 | self.output.AppendText("(") 1765 | while (a < len(datalist)): 1766 | 1767 | if datalist[a] != "": 1768 | byte = int(datalist[a],16) 1769 | else: 1770 | a+=1 1771 | continue 1772 | 1773 | if (byte > 31 and byte < 127): 1774 | temp = "%c" % int(datalist[a],16) 1775 | self.output.AppendText(temp) 1776 | else: 1777 | self.output.AppendText(".") 1778 | a+=1 1779 | 1780 | self.output.AppendText(")") 1781 | 1782 | 1783 | #------------------------------------------------------------ 1784 | 1785 | if opcode == "87": # Vendor ID 1786 | 1787 | a = 0 1788 | vendor_known = False 1789 | while (a < len(self.vendorid_list)): 1790 | if data == self.vendorid_list[a][1]: 1791 | vendor = self.vendorid_list[a][0] 1792 | self.output.AppendText("(") 1793 | self.output.AppendText(vendor) 1794 | self.output.AppendText(") ") 1795 | vendor_known = True 1796 | a+=1 1797 | 1798 | if vendor_known == False: 1799 | self.output.AppendText("(") 1800 | self.output.AppendText("Vendor unknown") 1801 | self.output.AppendText(") ") 1802 | 1803 | #------------------------------------------------------------ 1804 | 1805 | if opcode == "9E": # CEC Version 1806 | 1807 | if datalist[0] == "04": 1808 | self.output.AppendText("(HDMI v1.3a) ") 1809 | if datalist[0] == "05": 1810 | self.output.AppendText("(HDMI v1.4 or v1.4a) ") 1811 | 1812 | if opcode == "90": # Power Status 1813 | 1814 | if datalist[0] == "00": 1815 | self.output.AppendText("(On) ") 1816 | if datalist[0] == "01": 1817 | self.output.AppendText("(Standby) ") 1818 | if datalist[0] == "02": 1819 | self.output.AppendText("(Transition - standby to on) ") 1820 | if datalist[0] == "03": 1821 | self.output.AppendText("(Transition - on to standby) ") 1822 | 1823 | #------------------------------------------------------------ 1824 | 1825 | if opcode == "A0": # Vendor command with ID 1826 | 1827 | vendortxt = data[:8] 1828 | 1829 | a = 0 1830 | vendor_known = False 1831 | while (a < len(self.vendorid_list)): 1832 | if vendortxt == self.vendorid_list[a][1]: 1833 | vendor = self.vendorid_list[a][0] 1834 | self.output.AppendText("(") 1835 | self.output.AppendText(vendor) 1836 | self.output.AppendText(") ") 1837 | vendor_known = True 1838 | a+=1 1839 | 1840 | if vendor_known == False: 1841 | self.output.AppendText("(") 1842 | self.output.AppendText("Vendor unknown") 1843 | self.output.AppendText(") ") 1844 | 1845 | #------------------------------------------------------------ 1846 | 1847 | if self.dataview == False: 1848 | self.output.AppendText("\n") 1849 | continue 1850 | 1851 | 1852 | self.output.AppendText("Data: ") 1853 | self.output.AppendText(data) 1854 | 1855 | #if (len(datalist) != 1): 1856 | self.output.AppendText(" ") 1857 | 1858 | y = 0 1859 | 1860 | self.output.AppendText("\"") 1861 | while (y < len(datalist)): 1862 | if (len(datalist) == 1): 1863 | break 1864 | 1865 | if datalist[y] != "": 1866 | byte = int(datalist[y],16) 1867 | else: 1868 | y+=1 1869 | continue 1870 | 1871 | if (byte > 31 and byte < 127): 1872 | temp = "%c" % int(datalist[y],16) 1873 | self.output.AppendText(temp) 1874 | else: 1875 | self.output.AppendText(".") 1876 | y+=1 1877 | 1878 | self.output.AppendText("\"") 1879 | self.output.AppendText("\n") 1880 | 1881 | 1882 | 1883 | 1884 | def OnKey(self, evt): 1885 | # keycodes for arrow keys, page up/down, CR 1886 | KEYS_TO_CANCEL = [314, 316, 366, 367, 13] 1887 | 1888 | keycode = evt.GetKeyCode() 1889 | 1890 | if keycode == 315: 1891 | if (self.current_font_size < 20): 1892 | self.current_font_size += 1 1893 | f = wx.Font(self.current_font_size, wx.MODERN, wx.NORMAL, wx.NORMAL) 1894 | self.output.SetDefaultStyle(wx.TextAttr("GREEN", wx.NullColour, f)) 1895 | self.output.AppendText(time.strftime("%H:%M:%S ", time.localtime())) 1896 | self.output.AppendText("Status: Font size increased\n") 1897 | return 1898 | 1899 | 1900 | if keycode == 317: 1901 | if (self.current_font_size > 8): 1902 | self.current_font_size -= 1 1903 | f = wx.Font(self.current_font_size, wx.MODERN, wx.NORMAL, wx.NORMAL) 1904 | self.output.SetDefaultStyle(wx.TextAttr("GREEN", wx.NullColour, f)) 1905 | self.output.AppendText(time.strftime("%H:%M:%S ", time.localtime())) 1906 | self.output.AppendText("Status: Font size decreased\n") 1907 | return 1908 | 1909 | 1910 | if keycode == 27: 1911 | self.command.AppendText("\nCEC:> ") 1912 | self.commandmode = False 1913 | self.cdc_commandmode = False 1914 | 1915 | 1916 | if keycode in KEYS_TO_CANCEL: 1917 | if keycode == 13: 1918 | 1919 | #--------------- Is a CEC or CDC command selected? Or has anything been typed? ------ 1920 | 1921 | 1922 | if ((self.commandmode == False) and (self.cdc_commandmode == False) and len(self.inputbufferlist) == 0): 1923 | self.output.AppendText(time.strftime("%H:%M:%S ", time.localtime())) 1924 | self.output.AppendText("Error: Command not selected!\n") 1925 | return 1926 | 1927 | 1928 | #--------------- Is there a CR present that should be removed? ---------------------- 1929 | 1930 | if len(self.inputbufferlist) > 0: 1931 | if (self.inputbufferlist[0] == 13): # remove CR if present 1932 | self.inputbufferlist.pop(0) 1933 | 1934 | 1935 | #--------------- Has a CEC command been typed? -------------------------------------- 1936 | 1937 | if (self.commandmode == False and self.cdc_commandmode == False and len(self.inputbufferlist) > 0): 1938 | x=0 1939 | self.opcode = "" 1940 | while (x<2): 1941 | self.opcode += "%c" % self.inputbufferlist[x] 1942 | x+=1 1943 | self.inputbufferlist.pop(0) # remove opcode + space from data 1944 | self.inputbufferlist.pop(0) 1945 | 1946 | #--------------- Are parameters required, but have not been supplied? --------------- 1947 | 1948 | if ((len(self.inputbufferlist) == 0 or len(self.inputbufferlist) == 1) and (self.parameters_required == 1 or self.cdc_parameters_required == 1)): 1949 | self.output.AppendText(time.strftime("%H:%M:%S ", time.localtime())) 1950 | self.output.AppendText("Error: Command requires parameters!\n") 1951 | return 1952 | 1953 | #--------------- Is this a CDC command? --------------------------------------------- 1954 | 1955 | if (self.cdc_commandmode == True): 1956 | self.opcode = "F8" 1957 | self.command_data = self.physical[:2] #first byte of physical address 1958 | self.command_data += " " 1959 | self.command_data += self.physical[-2:] #second byte of physical address 1960 | self.command_data += " " 1961 | self.command_data += self.cdc_opcode 1962 | self.command_data += " " 1963 | 1964 | x=0 1965 | 1966 | if len(self.inputbufferlist) > 0: 1967 | if (self.inputbufferlist[0] == 32): 1968 | self.inputbufferlist.pop(0) 1969 | 1970 | while (x ") 1985 | self.parameters_required = 0 1986 | self.cdc_parameters_required = 0 1987 | self.commandmode = False 1988 | self.cdc_commandmode = False 1989 | 1990 | else: 1991 | evt.Skip() 1992 | 1993 | if keycode == 8: #delete key 1994 | self.inputbufferlist.pop() 1995 | if (len(self.inputbufferlist) < 1): 1996 | self.commandmode == False 1997 | return 1998 | 1999 | self.inputbufferlist.append(keycode) 2000 | #print self.inputbufferlist 2001 | 2002 | 2003 | 2004 | 2005 | def ProcessCommand(self, event): 2006 | item = self.parent.GetMenuBar().FindItemById(event.GetId()) 2007 | selected = item.GetText() 2008 | 2009 | x = 0 2010 | while (x < len (self.command_list)): 2011 | if (self.command_list[x][0] == selected): 2012 | self.opcode = self.command_list[x][1] 2013 | self.parameters_required = self.command_list[x][2] 2014 | self.command.AppendText("\nCEC:") 2015 | self.command.AppendText(self.command_list[x][0]) 2016 | self.command.AppendText(">") 2017 | self.CurrentCommand = self.command_list[x][0] 2018 | self.commandmode = True 2019 | x+=1 2020 | 2021 | 2022 | 2023 | def ProcessCDCCommand(self, event): 2024 | item = self.parent.GetMenuBar().FindItemById(event.GetId()) 2025 | selected = item.GetText() 2026 | 2027 | x = 0 2028 | while (x < len (self.cdc_command_list)): 2029 | if (self.cdc_command_list[x][0] == selected): 2030 | self.cdc_opcode = self.cdc_command_list[x][1] 2031 | self.cdc_parameters_required = self.cdc_command_list[x][2] 2032 | self.command.AppendText("\nCDC:") 2033 | self.command.AppendText(self.cdc_command_list[x][0]) 2034 | self.command.AppendText(">") 2035 | self.CurrentCommand = self.cdc_command_list[x][0] 2036 | self.cdc_commandmode = True 2037 | x+=1 2038 | 2039 | 2040 | def ProcessSourceSelect(self, event): 2041 | item = self.parent.GetMenuBar().FindItemById(event.GetId()) 2042 | selected = item.GetText() 2043 | print selected 2044 | x = 0 2045 | while (x < len (self.source_list)): 2046 | if (self.source_list[x][0] == selected): 2047 | self.source = self.source_list[x][1] 2048 | command = "!A " + self.source + "~" 2049 | self.RawCommandSend (command) 2050 | self.sourcename = self.source_list[x][0] 2051 | status1 = "Source Device: " + self.sourcename 2052 | status2 = "Target Device: " + self.targetname 2053 | self.statusbar.SetStatusText(status1, 1) 2054 | self.statusbar.SetStatusText(status2, 2) 2055 | self.output.AppendText(time.strftime("%H:%M:%S ", time.localtime())) 2056 | self.output.AppendText("Status: Source changed to \"") 2057 | self.output.AppendText(self.sourcename) 2058 | self.output.AppendText("\"\n") 2059 | 2060 | x+=1 2061 | 2062 | 2063 | 2064 | def ProcessTargetSelect(self, event): 2065 | item = self.parent.GetMenuBar().FindItemById(event.GetId()) 2066 | selected = item.GetText() 2067 | 2068 | x = 0 2069 | while (x < len (self.target_list)): 2070 | if (self.target_list[x][0] == selected): 2071 | self.target = self.target_list[x][1] 2072 | self.targetname = self.target_list[x][0] 2073 | status1 = "Source Device: " + self.sourcename 2074 | status2 = "Target Device: " + self.targetname 2075 | self.statusbar.SetStatusText(status1, 1) 2076 | self.statusbar.SetStatusText(status2, 2) 2077 | self.output.AppendText(time.strftime("%H:%M:%S ", time.localtime())) 2078 | self.output.AppendText("Status: Target changed to \"") 2079 | self.output.AppendText(self.target_list[x][0]) 2080 | self.output.AppendText("\"\n") 2081 | 2082 | x+=1 2083 | 2084 | 2085 | def About(self, event): 2086 | wx.MessageBox("CECSTeR v1.0: Andy Davis, NCC Group 2012", caption="Information", style=wx.OK|wx.ICON_INFORMATION, parent=self) 2087 | return(1) 2088 | 2089 | def CloseMe(self, event): 2090 | self.parent.Close(True) 2091 | 2092 | 2093 | app = wx.App(False) 2094 | frame = wx.Frame(None, wx.ID_ANY, "CECSTeR", size=(1024,768)) 2095 | 2096 | win = MainPanel(frame) 2097 | frame.Show(True) 2098 | frame.Center() 2099 | app.MainLoop() 2100 | -------------------------------------------------------------------------------- /HDMI_Ethernet_Channel_whitepaper.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nccgroup/CECster/15544cb789403ddcbb6e3231715b9d17198da309/HDMI_Ethernet_Channel_whitepaper.pdf -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | GNU AFFERO GENERAL PUBLIC LICENSE 2 | Version 3, 19 November 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU Affero General Public License is a free, copyleft license for 11 | software and other kinds of works, specifically designed to ensure 12 | cooperation with the community in the case of network server software. 13 | 14 | The licenses for most software and other practical works are designed 15 | to take away your freedom to share and change the works. By contrast, 16 | our General Public Licenses are intended to guarantee your freedom to 17 | share and change all versions of a program--to make sure it remains free 18 | software for all its users. 19 | 20 | When we speak of free software, we are referring to freedom, not 21 | price. Our General Public Licenses are designed to make sure that you 22 | have the freedom to distribute copies of free software (and charge for 23 | them if you wish), that you receive source code or can get it if you 24 | want it, that you can change the software or use pieces of it in new 25 | free programs, and that you know you can do these things. 26 | 27 | Developers that use our General Public Licenses protect your rights 28 | with two steps: (1) assert copyright on the software, and (2) offer 29 | you this License which gives you legal permission to copy, distribute 30 | and/or modify the software. 31 | 32 | A secondary benefit of defending all users' freedom is that 33 | improvements made in alternate versions of the program, if they 34 | receive widespread use, become available for other developers to 35 | incorporate. Many developers of free software are heartened and 36 | encouraged by the resulting cooperation. However, in the case of 37 | software used on network servers, this result may fail to come about. 38 | The GNU General Public License permits making a modified version and 39 | letting the public access it on a server without ever releasing its 40 | source code to the public. 41 | 42 | The GNU Affero General Public License is designed specifically to 43 | ensure that, in such cases, the modified source code becomes available 44 | to the community. It requires the operator of a network server to 45 | provide the source code of the modified version running there to the 46 | users of that server. Therefore, public use of a modified version, on 47 | a publicly accessible server, gives the public access to the source 48 | code of the modified version. 49 | 50 | An older license, called the Affero General Public License and 51 | published by Affero, was designed to accomplish similar goals. This is 52 | a different license, not a version of the Affero GPL, but Affero has 53 | released a new version of the Affero GPL which permits relicensing under 54 | this license. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | TERMS AND CONDITIONS 60 | 61 | 0. Definitions. 62 | 63 | "This License" refers to version 3 of the GNU Affero General Public License. 64 | 65 | "Copyright" also means copyright-like laws that apply to other kinds of 66 | works, such as semiconductor masks. 67 | 68 | "The Program" refers to any copyrightable work licensed under this 69 | License. Each licensee is addressed as "you". "Licensees" and 70 | "recipients" may be individuals or organizations. 71 | 72 | To "modify" a work means to copy from or adapt all or part of the work 73 | in a fashion requiring copyright permission, other than the making of an 74 | exact copy. The resulting work is called a "modified version" of the 75 | earlier work or a work "based on" the earlier work. 76 | 77 | A "covered work" means either the unmodified Program or a work based 78 | on the Program. 79 | 80 | To "propagate" a work means to do anything with it that, without 81 | permission, would make you directly or secondarily liable for 82 | infringement under applicable copyright law, except executing it on a 83 | computer or modifying a private copy. Propagation includes copying, 84 | distribution (with or without modification), making available to the 85 | public, and in some countries other activities as well. 86 | 87 | To "convey" a work means any kind of propagation that enables other 88 | parties to make or receive copies. Mere interaction with a user through 89 | a computer network, with no transfer of a copy, is not conveying. 90 | 91 | An interactive user interface displays "Appropriate Legal Notices" 92 | to the extent that it includes a convenient and prominently visible 93 | feature that (1) displays an appropriate copyright notice, and (2) 94 | tells the user that there is no warranty for the work (except to the 95 | extent that warranties are provided), that licensees may convey the 96 | work under this License, and how to view a copy of this License. If 97 | the interface presents a list of user commands or options, such as a 98 | menu, a prominent item in the list meets this criterion. 99 | 100 | 1. Source Code. 101 | 102 | The "source code" for a work means the preferred form of the work 103 | for making modifications to it. "Object code" means any non-source 104 | form of a work. 105 | 106 | A "Standard Interface" means an interface that either is an official 107 | standard defined by a recognized standards body, or, in the case of 108 | interfaces specified for a particular programming language, one that 109 | is widely used among developers working in that language. 110 | 111 | The "System Libraries" of an executable work include anything, other 112 | than the work as a whole, that (a) is included in the normal form of 113 | packaging a Major Component, but which is not part of that Major 114 | Component, and (b) serves only to enable use of the work with that 115 | Major Component, or to implement a Standard Interface for which an 116 | implementation is available to the public in source code form. A 117 | "Major Component", in this context, means a major essential component 118 | (kernel, window system, and so on) of the specific operating system 119 | (if any) on which the executable work runs, or a compiler used to 120 | produce the work, or an object code interpreter used to run it. 121 | 122 | The "Corresponding Source" for a work in object code form means all 123 | the source code needed to generate, install, and (for an executable 124 | work) run the object code and to modify the work, including scripts to 125 | control those activities. However, it does not include the work's 126 | System Libraries, or general-purpose tools or generally available free 127 | programs which are used unmodified in performing those activities but 128 | which are not part of the work. For example, Corresponding Source 129 | includes interface definition files associated with source files for 130 | the work, and the source code for shared libraries and dynamically 131 | linked subprograms that the work is specifically designed to require, 132 | such as by intimate data communication or control flow between those 133 | subprograms and other parts of the work. 134 | 135 | The Corresponding Source need not include anything that users 136 | can regenerate automatically from other parts of the Corresponding 137 | Source. 138 | 139 | The Corresponding Source for a work in source code form is that 140 | same work. 141 | 142 | 2. Basic Permissions. 143 | 144 | All rights granted under this License are granted for the term of 145 | copyright on the Program, and are irrevocable provided the stated 146 | conditions are met. This License explicitly affirms your unlimited 147 | permission to run the unmodified Program. The output from running a 148 | covered work is covered by this License only if the output, given its 149 | content, constitutes a covered work. This License acknowledges your 150 | rights of fair use or other equivalent, as provided by copyright law. 151 | 152 | You may make, run and propagate covered works that you do not 153 | convey, without conditions so long as your license otherwise remains 154 | in force. You may convey covered works to others for the sole purpose 155 | of having them make modifications exclusively for you, or provide you 156 | with facilities for running those works, provided that you comply with 157 | the terms of this License in conveying all material for which you do 158 | not control copyright. Those thus making or running the covered works 159 | for you must do so exclusively on your behalf, under your direction 160 | and control, on terms that prohibit them from making any copies of 161 | your copyrighted material outside their relationship with you. 162 | 163 | Conveying under any other circumstances is permitted solely under 164 | the conditions stated below. Sublicensing is not allowed; section 10 165 | makes it unnecessary. 166 | 167 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 168 | 169 | No covered work shall be deemed part of an effective technological 170 | measure under any applicable law fulfilling obligations under article 171 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 172 | similar laws prohibiting or restricting circumvention of such 173 | measures. 174 | 175 | When you convey a covered work, you waive any legal power to forbid 176 | circumvention of technological measures to the extent such circumvention 177 | is effected by exercising rights under this License with respect to 178 | the covered work, and you disclaim any intention to limit operation or 179 | modification of the work as a means of enforcing, against the work's 180 | users, your or third parties' legal rights to forbid circumvention of 181 | technological measures. 182 | 183 | 4. Conveying Verbatim Copies. 184 | 185 | You may convey verbatim copies of the Program's source code as you 186 | receive it, in any medium, provided that you conspicuously and 187 | appropriately publish on each copy an appropriate copyright notice; 188 | keep intact all notices stating that this License and any 189 | non-permissive terms added in accord with section 7 apply to the code; 190 | keep intact all notices of the absence of any warranty; and give all 191 | recipients a copy of this License along with the Program. 192 | 193 | You may charge any price or no price for each copy that you convey, 194 | and you may offer support or warranty protection for a fee. 195 | 196 | 5. Conveying Modified Source Versions. 197 | 198 | You may convey a work based on the Program, or the modifications to 199 | produce it from the Program, in the form of source code under the 200 | terms of section 4, provided that you also meet all of these conditions: 201 | 202 | a) The work must carry prominent notices stating that you modified 203 | it, and giving a relevant date. 204 | 205 | b) The work must carry prominent notices stating that it is 206 | released under this License and any conditions added under section 207 | 7. This requirement modifies the requirement in section 4 to 208 | "keep intact all notices". 209 | 210 | c) You must license the entire work, as a whole, under this 211 | License to anyone who comes into possession of a copy. This 212 | License will therefore apply, along with any applicable section 7 213 | additional terms, to the whole of the work, and all its parts, 214 | regardless of how they are packaged. This License gives no 215 | permission to license the work in any other way, but it does not 216 | invalidate such permission if you have separately received it. 217 | 218 | d) If the work has interactive user interfaces, each must display 219 | Appropriate Legal Notices; however, if the Program has interactive 220 | interfaces that do not display Appropriate Legal Notices, your 221 | work need not make them do so. 222 | 223 | A compilation of a covered work with other separate and independent 224 | works, which are not by their nature extensions of the covered work, 225 | and which are not combined with it such as to form a larger program, 226 | in or on a volume of a storage or distribution medium, is called an 227 | "aggregate" if the compilation and its resulting copyright are not 228 | used to limit the access or legal rights of the compilation's users 229 | beyond what the individual works permit. Inclusion of a covered work 230 | in an aggregate does not cause this License to apply to the other 231 | parts of the aggregate. 232 | 233 | 6. Conveying Non-Source Forms. 234 | 235 | You may convey a covered work in object code form under the terms 236 | of sections 4 and 5, provided that you also convey the 237 | machine-readable Corresponding Source under the terms of this License, 238 | in one of these ways: 239 | 240 | a) Convey the object code in, or embodied in, a physical product 241 | (including a physical distribution medium), accompanied by the 242 | Corresponding Source fixed on a durable physical medium 243 | customarily used for software interchange. 244 | 245 | b) Convey the object code in, or embodied in, a physical product 246 | (including a physical distribution medium), accompanied by a 247 | written offer, valid for at least three years and valid for as 248 | long as you offer spare parts or customer support for that product 249 | model, to give anyone who possesses the object code either (1) a 250 | copy of the Corresponding Source for all the software in the 251 | product that is covered by this License, on a durable physical 252 | medium customarily used for software interchange, for a price no 253 | more than your reasonable cost of physically performing this 254 | conveying of source, or (2) access to copy the 255 | Corresponding Source from a network server at no charge. 256 | 257 | c) Convey individual copies of the object code with a copy of the 258 | written offer to provide the Corresponding Source. This 259 | alternative is allowed only occasionally and noncommercially, and 260 | only if you received the object code with such an offer, in accord 261 | with subsection 6b. 262 | 263 | d) Convey the object code by offering access from a designated 264 | place (gratis or for a charge), and offer equivalent access to the 265 | Corresponding Source in the same way through the same place at no 266 | further charge. You need not require recipients to copy the 267 | Corresponding Source along with the object code. If the place to 268 | copy the object code is a network server, the Corresponding Source 269 | may be on a different server (operated by you or a third party) 270 | that supports equivalent copying facilities, provided you maintain 271 | clear directions next to the object code saying where to find the 272 | Corresponding Source. Regardless of what server hosts the 273 | Corresponding Source, you remain obligated to ensure that it is 274 | available for as long as needed to satisfy these requirements. 275 | 276 | e) Convey the object code using peer-to-peer transmission, provided 277 | you inform other peers where the object code and Corresponding 278 | Source of the work are being offered to the general public at no 279 | charge under subsection 6d. 280 | 281 | A separable portion of the object code, whose source code is excluded 282 | from the Corresponding Source as a System Library, need not be 283 | included in conveying the object code work. 284 | 285 | A "User Product" is either (1) a "consumer product", which means any 286 | tangible personal property which is normally used for personal, family, 287 | or household purposes, or (2) anything designed or sold for incorporation 288 | into a dwelling. In determining whether a product is a consumer product, 289 | doubtful cases shall be resolved in favor of coverage. For a particular 290 | product received by a particular user, "normally used" refers to a 291 | typical or common use of that class of product, regardless of the status 292 | of the particular user or of the way in which the particular user 293 | actually uses, or expects or is expected to use, the product. A product 294 | is a consumer product regardless of whether the product has substantial 295 | commercial, industrial or non-consumer uses, unless such uses represent 296 | the only significant mode of use of the product. 297 | 298 | "Installation Information" for a User Product means any methods, 299 | procedures, authorization keys, or other information required to install 300 | and execute modified versions of a covered work in that User Product from 301 | a modified version of its Corresponding Source. The information must 302 | suffice to ensure that the continued functioning of the modified object 303 | code is in no case prevented or interfered with solely because 304 | modification has been made. 305 | 306 | If you convey an object code work under this section in, or with, or 307 | specifically for use in, a User Product, and the conveying occurs as 308 | part of a transaction in which the right of possession and use of the 309 | User Product is transferred to the recipient in perpetuity or for a 310 | fixed term (regardless of how the transaction is characterized), the 311 | Corresponding Source conveyed under this section must be accompanied 312 | by the Installation Information. But this requirement does not apply 313 | if neither you nor any third party retains the ability to install 314 | modified object code on the User Product (for example, the work has 315 | been installed in ROM). 316 | 317 | The requirement to provide Installation Information does not include a 318 | requirement to continue to provide support service, warranty, or updates 319 | for a work that has been modified or installed by the recipient, or for 320 | the User Product in which it has been modified or installed. Access to a 321 | network may be denied when the modification itself materially and 322 | adversely affects the operation of the network or violates the rules and 323 | protocols for communication across the network. 324 | 325 | Corresponding Source conveyed, and Installation Information provided, 326 | in accord with this section must be in a format that is publicly 327 | documented (and with an implementation available to the public in 328 | source code form), and must require no special password or key for 329 | unpacking, reading or copying. 330 | 331 | 7. Additional Terms. 332 | 333 | "Additional permissions" are terms that supplement the terms of this 334 | License by making exceptions from one or more of its conditions. 335 | Additional permissions that are applicable to the entire Program shall 336 | be treated as though they were included in this License, to the extent 337 | that they are valid under applicable law. If additional permissions 338 | apply only to part of the Program, that part may be used separately 339 | under those permissions, but the entire Program remains governed by 340 | this License without regard to the additional permissions. 341 | 342 | When you convey a copy of a covered work, you may at your option 343 | remove any additional permissions from that copy, or from any part of 344 | it. (Additional permissions may be written to require their own 345 | removal in certain cases when you modify the work.) You may place 346 | additional permissions on material, added by you to a covered work, 347 | for which you have or can give appropriate copyright permission. 348 | 349 | Notwithstanding any other provision of this License, for material you 350 | add to a covered work, you may (if authorized by the copyright holders of 351 | that material) supplement the terms of this License with terms: 352 | 353 | a) Disclaiming warranty or limiting liability differently from the 354 | terms of sections 15 and 16 of this License; or 355 | 356 | b) Requiring preservation of specified reasonable legal notices or 357 | author attributions in that material or in the Appropriate Legal 358 | Notices displayed by works containing it; or 359 | 360 | c) Prohibiting misrepresentation of the origin of that material, or 361 | requiring that modified versions of such material be marked in 362 | reasonable ways as different from the original version; or 363 | 364 | d) Limiting the use for publicity purposes of names of licensors or 365 | authors of the material; or 366 | 367 | e) Declining to grant rights under trademark law for use of some 368 | trade names, trademarks, or service marks; or 369 | 370 | f) Requiring indemnification of licensors and authors of that 371 | material by anyone who conveys the material (or modified versions of 372 | it) with contractual assumptions of liability to the recipient, for 373 | any liability that these contractual assumptions directly impose on 374 | those licensors and authors. 375 | 376 | All other non-permissive additional terms are considered "further 377 | restrictions" within the meaning of section 10. If the Program as you 378 | received it, or any part of it, contains a notice stating that it is 379 | governed by this License along with a term that is a further 380 | restriction, you may remove that term. If a license document contains 381 | a further restriction but permits relicensing or conveying under this 382 | License, you may add to a covered work material governed by the terms 383 | of that license document, provided that the further restriction does 384 | not survive such relicensing or conveying. 385 | 386 | If you add terms to a covered work in accord with this section, you 387 | must place, in the relevant source files, a statement of the 388 | additional terms that apply to those files, or a notice indicating 389 | where to find the applicable terms. 390 | 391 | Additional terms, permissive or non-permissive, may be stated in the 392 | form of a separately written license, or stated as exceptions; 393 | the above requirements apply either way. 394 | 395 | 8. Termination. 396 | 397 | You may not propagate or modify a covered work except as expressly 398 | provided under this License. Any attempt otherwise to propagate or 399 | modify it is void, and will automatically terminate your rights under 400 | this License (including any patent licenses granted under the third 401 | paragraph of section 11). 402 | 403 | However, if you cease all violation of this License, then your 404 | license from a particular copyright holder is reinstated (a) 405 | provisionally, unless and until the copyright holder explicitly and 406 | finally terminates your license, and (b) permanently, if the copyright 407 | holder fails to notify you of the violation by some reasonable means 408 | prior to 60 days after the cessation. 409 | 410 | Moreover, your license from a particular copyright holder is 411 | reinstated permanently if the copyright holder notifies you of the 412 | violation by some reasonable means, this is the first time you have 413 | received notice of violation of this License (for any work) from that 414 | copyright holder, and you cure the violation prior to 30 days after 415 | your receipt of the notice. 416 | 417 | Termination of your rights under this section does not terminate the 418 | licenses of parties who have received copies or rights from you under 419 | this License. If your rights have been terminated and not permanently 420 | reinstated, you do not qualify to receive new licenses for the same 421 | material under section 10. 422 | 423 | 9. Acceptance Not Required for Having Copies. 424 | 425 | You are not required to accept this License in order to receive or 426 | run a copy of the Program. Ancillary propagation of a covered work 427 | occurring solely as a consequence of using peer-to-peer transmission 428 | to receive a copy likewise does not require acceptance. However, 429 | nothing other than this License grants you permission to propagate or 430 | modify any covered work. These actions infringe copyright if you do 431 | not accept this License. Therefore, by modifying or propagating a 432 | covered work, you indicate your acceptance of this License to do so. 433 | 434 | 10. Automatic Licensing of Downstream Recipients. 435 | 436 | Each time you convey a covered work, the recipient automatically 437 | receives a license from the original licensors, to run, modify and 438 | propagate that work, subject to this License. You are not responsible 439 | for enforcing compliance by third parties with this License. 440 | 441 | An "entity transaction" is a transaction transferring control of an 442 | organization, or substantially all assets of one, or subdividing an 443 | organization, or merging organizations. If propagation of a covered 444 | work results from an entity transaction, each party to that 445 | transaction who receives a copy of the work also receives whatever 446 | licenses to the work the party's predecessor in interest had or could 447 | give under the previous paragraph, plus a right to possession of the 448 | Corresponding Source of the work from the predecessor in interest, if 449 | the predecessor has it or can get it with reasonable efforts. 450 | 451 | You may not impose any further restrictions on the exercise of the 452 | rights granted or affirmed under this License. For example, you may 453 | not impose a license fee, royalty, or other charge for exercise of 454 | rights granted under this License, and you may not initiate litigation 455 | (including a cross-claim or counterclaim in a lawsuit) alleging that 456 | any patent claim is infringed by making, using, selling, offering for 457 | sale, or importing the Program or any portion of it. 458 | 459 | 11. Patents. 460 | 461 | A "contributor" is a copyright holder who authorizes use under this 462 | License of the Program or a work on which the Program is based. The 463 | work thus licensed is called the contributor's "contributor version". 464 | 465 | A contributor's "essential patent claims" are all patent claims 466 | owned or controlled by the contributor, whether already acquired or 467 | hereafter acquired, that would be infringed by some manner, permitted 468 | by this License, of making, using, or selling its contributor version, 469 | but do not include claims that would be infringed only as a 470 | consequence of further modification of the contributor version. For 471 | purposes of this definition, "control" includes the right to grant 472 | patent sublicenses in a manner consistent with the requirements of 473 | this License. 474 | 475 | Each contributor grants you a non-exclusive, worldwide, royalty-free 476 | patent license under the contributor's essential patent claims, to 477 | make, use, sell, offer for sale, import and otherwise run, modify and 478 | propagate the contents of its contributor version. 479 | 480 | In the following three paragraphs, a "patent license" is any express 481 | agreement or commitment, however denominated, not to enforce a patent 482 | (such as an express permission to practice a patent or covenant not to 483 | sue for patent infringement). To "grant" such a patent license to a 484 | party means to make such an agreement or commitment not to enforce a 485 | patent against the party. 486 | 487 | If you convey a covered work, knowingly relying on a patent license, 488 | and the Corresponding Source of the work is not available for anyone 489 | to copy, free of charge and under the terms of this License, through a 490 | publicly available network server or other readily accessible means, 491 | then you must either (1) cause the Corresponding Source to be so 492 | available, or (2) arrange to deprive yourself of the benefit of the 493 | patent license for this particular work, or (3) arrange, in a manner 494 | consistent with the requirements of this License, to extend the patent 495 | license to downstream recipients. "Knowingly relying" means you have 496 | actual knowledge that, but for the patent license, your conveying the 497 | covered work in a country, or your recipient's use of the covered work 498 | in a country, would infringe one or more identifiable patents in that 499 | country that you have reason to believe are valid. 500 | 501 | If, pursuant to or in connection with a single transaction or 502 | arrangement, you convey, or propagate by procuring conveyance of, a 503 | covered work, and grant a patent license to some of the parties 504 | receiving the covered work authorizing them to use, propagate, modify 505 | or convey a specific copy of the covered work, then the patent license 506 | you grant is automatically extended to all recipients of the covered 507 | work and works based on it. 508 | 509 | A patent license is "discriminatory" if it does not include within 510 | the scope of its coverage, prohibits the exercise of, or is 511 | conditioned on the non-exercise of one or more of the rights that are 512 | specifically granted under this License. You may not convey a covered 513 | work if you are a party to an arrangement with a third party that is 514 | in the business of distributing software, under which you make payment 515 | to the third party based on the extent of your activity of conveying 516 | the work, and under which the third party grants, to any of the 517 | parties who would receive the covered work from you, a discriminatory 518 | patent license (a) in connection with copies of the covered work 519 | conveyed by you (or copies made from those copies), or (b) primarily 520 | for and in connection with specific products or compilations that 521 | contain the covered work, unless you entered into that arrangement, 522 | or that patent license was granted, prior to 28 March 2007. 523 | 524 | Nothing in this License shall be construed as excluding or limiting 525 | any implied license or other defenses to infringement that may 526 | otherwise be available to you under applicable patent law. 527 | 528 | 12. No Surrender of Others' Freedom. 529 | 530 | If conditions are imposed on you (whether by court order, agreement or 531 | otherwise) that contradict the conditions of this License, they do not 532 | excuse you from the conditions of this License. If you cannot convey a 533 | covered work so as to satisfy simultaneously your obligations under this 534 | License and any other pertinent obligations, then as a consequence you may 535 | not convey it at all. For example, if you agree to terms that obligate you 536 | to collect a royalty for further conveying from those to whom you convey 537 | the Program, the only way you could satisfy both those terms and this 538 | License would be to refrain entirely from conveying the Program. 539 | 540 | 13. Remote Network Interaction; Use with the GNU General Public License. 541 | 542 | Notwithstanding any other provision of this License, if you modify the 543 | Program, your modified version must prominently offer all users 544 | interacting with it remotely through a computer network (if your version 545 | supports such interaction) an opportunity to receive the Corresponding 546 | Source of your version by providing access to the Corresponding Source 547 | from a network server at no charge, through some standard or customary 548 | means of facilitating copying of software. This Corresponding Source 549 | shall include the Corresponding Source for any work covered by version 3 550 | of the GNU General Public License that is incorporated pursuant to the 551 | following paragraph. 552 | 553 | Notwithstanding any other provision of this License, you have 554 | permission to link or combine any covered work with a work licensed 555 | under version 3 of the GNU General Public License into a single 556 | combined work, and to convey the resulting work. The terms of this 557 | License will continue to apply to the part which is the covered work, 558 | but the work with which it is combined will remain governed by version 559 | 3 of the GNU General Public License. 560 | 561 | 14. Revised Versions of this License. 562 | 563 | The Free Software Foundation may publish revised and/or new versions of 564 | the GNU Affero General Public License from time to time. Such new versions 565 | will be similar in spirit to the present version, but may differ in detail to 566 | address new problems or concerns. 567 | 568 | Each version is given a distinguishing version number. If the 569 | Program specifies that a certain numbered version of the GNU Affero General 570 | Public License "or any later version" applies to it, you have the 571 | option of following the terms and conditions either of that numbered 572 | version or of any later version published by the Free Software 573 | Foundation. If the Program does not specify a version number of the 574 | GNU Affero General Public License, you may choose any version ever published 575 | by the Free Software Foundation. 576 | 577 | If the Program specifies that a proxy can decide which future 578 | versions of the GNU Affero General Public License can be used, that proxy's 579 | public statement of acceptance of a version permanently authorizes you 580 | to choose that version for the Program. 581 | 582 | Later license versions may give you additional or different 583 | permissions. However, no additional obligations are imposed on any 584 | author or copyright holder as a result of your choosing to follow a 585 | later version. 586 | 587 | 15. Disclaimer of Warranty. 588 | 589 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 590 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 591 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 592 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 593 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 594 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 595 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 596 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 597 | 598 | 16. Limitation of Liability. 599 | 600 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 601 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 602 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 603 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 604 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 605 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 606 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 607 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 608 | SUCH DAMAGES. 609 | 610 | 17. Interpretation of Sections 15 and 16. 611 | 612 | If the disclaimer of warranty and limitation of liability provided 613 | above cannot be given local legal effect according to their terms, 614 | reviewing courts shall apply local law that most closely approximates 615 | an absolute waiver of all civil liability in connection with the 616 | Program, unless a warranty or assumption of liability accompanies a 617 | copy of the Program in return for a fee. 618 | 619 | END OF TERMS AND CONDITIONS 620 | 621 | How to Apply These Terms to Your New Programs 622 | 623 | If you develop a new program, and you want it to be of the greatest 624 | possible use to the public, the best way to achieve this is to make it 625 | free software which everyone can redistribute and change under these terms. 626 | 627 | To do so, attach the following notices to the program. It is safest 628 | to attach them to the start of each source file to most effectively 629 | state the exclusion of warranty; and each file should have at least 630 | the "copyright" line and a pointer to where the full notice is found. 631 | 632 | 633 | Copyright (C) 634 | 635 | This program is free software: you can redistribute it and/or modify 636 | it under the terms of the GNU Affero General Public License as published by 637 | the Free Software Foundation, either version 3 of the License, or 638 | (at your option) any later version. 639 | 640 | This program is distributed in the hope that it will be useful, 641 | but WITHOUT ANY WARRANTY; without even the implied warranty of 642 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 643 | GNU Affero General Public License for more details. 644 | 645 | You should have received a copy of the GNU Affero General Public License 646 | along with this program. If not, see . 647 | 648 | Also add information on how to contact you by electronic and paper mail. 649 | 650 | If your software can interact with users remotely through a computer 651 | network, you should also make sure that it provides a way for users to 652 | get its source. For example, if your program is a web application, its 653 | interface could display a "Source" link that leads users to an archive 654 | of the code. There are many ways you could offer source, and different 655 | solutions will be better for different programs; see section 13 for the 656 | specific requirements. 657 | 658 | You should also get your employer (if you work as a programmer) or school, 659 | if any, to sign a "copyright disclaimer" for the program, if necessary. 660 | For more information on this, and how to apply and follow the GNU AGPL, see 661 | . 662 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | CECSTeR 2 | ======= 3 | CECSTeR is the Consumer Electronics Control Security Testing Resource - a GUI-based tool to perform security testing against the HDMI CEC (Consumer Electronics Control) and HEC (HDMI Ethernet Channel) protocols 4 | 5 | Released as open source by NCC Group Plc - http://www.nccgroup.com/ 6 | 7 | Developed by Andy Davis, andy dot davis at nccgroup dot com 8 | 9 | https://www.github.com/nccgroup/CECSTeR 10 | 11 | Released under AGPL see LICENSE for more information 12 | 13 | ## Documentation 14 | 15 | For full details of how to use the tool please read the HDMI Ethernet Channel whitepaper: 16 | https://github.com/nccgroup/CECster/blob/master/HDMI_Ethernet_Channel_whitepaper.pdf 17 | 18 | In order to get CECSTeR up and running there are a number of dependencies: 19 | 20 | - Python - http://www.python.org/getit/ 21 | - wxPython - http://www.wxpython.org/download.php#stable 22 | - Pyserial - http://pypi.python.org/pypi/pyserial 23 | 24 | You will also need: 25 | 26 | - RainShadow Tech USB-CEC bridge - http://rainshadowtech.com/default_files/HDMICECUSB.htm 27 | 28 | Usage: CECSTeR.py 29 | 30 | -------------------------------------------------------------------------------- /images/cecster_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nccgroup/CECster/15544cb789403ddcbb6e3231715b9d17198da309/images/cecster_logo.png -------------------------------------------------------------------------------- /images/cecster_splash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nccgroup/CECster/15544cb789403ddcbb6e3231715b9d17198da309/images/cecster_splash.png -------------------------------------------------------------------------------- /images/ncc_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nccgroup/CECster/15544cb789403ddcbb6e3231715b9d17198da309/images/ncc_logo.png -------------------------------------------------------------------------------- /images/underline.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nccgroup/CECster/15544cb789403ddcbb6e3231715b9d17198da309/images/underline.png --------------------------------------------------------------------------------