eclair4151 / samsung_encrypted_POC

A proof of concept to pair and send commands to H and J series Samsung TVs
10 stars 5 forks source link

Wow, almost works but seems like smth with my python library #1

Closed andreypopov closed 6 years ago

andreypopov commented 6 years ago

pi@raspberrypi:/var/www/html/RPi/samsung $ python main.py Enter TV Pin: 1413 session_key: 81BE00EEF51E4E73713815EA9FA01224 session_id: 1 waiting for a sec... sending command! Traceback (most recent call last): File "main.py", line 72, in connection = websocket.create_connection(websocket_url) AttributeError: 'module' object has no attribute 'create_connection'

ideas?

andreypopov commented 6 years ago

Please, add small manual, which libraries are required

pip install pycrypto pip install websocket pip install websocket-client

SOLVED!

Thanks for your work

andreypopov commented 6 years ago

So, .. PIN works, connected successfully. How to send commands ? I mean next time, without entering pin.

eclair4151 commented 6 years ago

Yea right now it’s pretty bare bones. Gonna add an easier way to do this but for now go into the debug file, replace the session id and key printed from pairing in main and you can just run the debug.py file to send commands now from there without pairing

andreypopov commented 6 years ago

cool. just now looking into it!

andreypopov commented 6 years ago

pi@raspberrypi:/var/www/html/RPi/samsung $ python debug.py ws://192.168.1.16:8000/socket.io/1/websocket/xFLKeGV9gd7bW98SDlnz

no effect, nothing happens, volume didnt change(

andreypopov commented 6 years ago

pi@raspberrypi:/var/www/html/RPi/samsung $ python debug.py ws://192.168.1.16:8000/socket.io/1/websocket/uM2Fhqpf_oQrG45DDloA <Response [200]> KEY_CHUP 5::/com.samsung.companion:{"name":"callCommon","args":[{"SessionId":4,"body":"[!,?,-,},",?,?,?,},s,l,,?,?,?,?,t, ,L,v,?,,G,0,?,W,?,?,?,?,},-,D,Q,J,f,*,,?,d,,?,6,Z,?,,?,?,2,?,c,?,?,?,?,W,?,O,?,,?,?,?,),?,t,&,G, ,,?,?,?,,",?,?,?,?,?,@,?, , ,?,?,?,?,#,?,?,~,O,?,?,?,?,?,q,:,Z,?,,?,?,?,?, ,W,B,J,?,R,?,?,p,v,,,,?,?,,?,?,?,?, ,?,L,,,u,?,.,U,?,?,?,',?,",N,c,?,?,m,?,<,Y,?,?,p,?,,Y,A,?,2,?,?,C,R,?,?,,K,,]"}]}

seems like aes code is incorrect, I dont know

eclair4151 commented 6 years ago

Hmm. Very odd haven’t seen that before. Can you send your encryption key and session id and I can see what’s going on. It should be using the same code as the other file. Also what version of python are you using

andreypopov commented 6 years ago

enc_key = '43603992DBBA92BCA668ECC6B55E5C1C' session = '4' key_command = 'KEY_CHUP' tv_address = '192.168.1.16'

Python 2.7.9 (default, Sep 17 2016, 20:26:04) Samsung 2014, H-Series 6400

andreypopov commented 6 years ago

btw main.py doesnt execute KEY_VOLDOWN , nothing happens too

eclair4151 commented 6 years ago

@andreypopov looks like its a python2 issue right now. trying to debug, but for now can you try to use it using python3. you will need to

pip3 install pycrypto pip3 install websocket-client-py3

python3 debug.py

andreypopov commented 6 years ago

it works! u r genius