Code Monkey home page Code Monkey logo

smartcrypto's People

Contributors

eclair4151 avatar sectroyer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

smartcrypto's Issues

Question on Rijndael

@eclair4151 @McKael @sectroyer

This is not an issue but a question. I'm porting this code to vb.net for my HA application. So far all code works and is checked against the PY implementation but I can't figure out this code

def applySamyGOKeyTransform(input):
r = Rijndael(bytes.fromhex(keys.transKey))
return r.encrypt(input)

.net has AES and Rijdael but they return different results from what the PY code returns. All AES and SHA1 code in this PY project I figured out how to use with .NET but the above I can't figure out. Rijndael is supposed to be AES but you guys picked specifically an flavor of RIjndael. Any idea why? Any idea how this is different from AES? Specific setting?

import errors while executing

I'm executing smartcrypto.py with sudo ./smartcrypto.py and I'm getting the following errors

from: can't read /var/mail/__future__
from: can't read /var/mail/PySmartCrypto
./smartcrypto.py: 3: ./smartcrypto.py: import: not found
./smartcrypto.py: 4: ./smartcrypto.py: import: not found
from: can't read /var/mail/PySmartCrypto.command_encryption
./smartcrypto.py: 6: ./smartcrypto.py: import: not found
./smartcrypto.py: 7: ./smartcrypto.py: import: not found
./smartcrypto.py: 8: ./smartcrypto.py: import: not found
./smartcrypto.py: 12: ./smartcrypto.py: UserId: not found
./smartcrypto.py: 13: ./smartcrypto.py: AppId: not found
./smartcrypto.py: 14: ./smartcrypto.py: deviceId: not found
./smartcrypto.py: 15: ./smartcrypto.py: tvIP: not found
./smartcrypto.py: 16: ./smartcrypto.py: tvPort: not found
./smartcrypto.py: 18: ./smartcrypto.py: lastRequestId: not found
./smartcrypto.py: 19: ./smartcrypto.py: Syntax error: "(" unexpected

Where to find token?

I have run the script and pin is accepted. But now how do I find my token? What line is it in?

Can't send command to: UE48JU6770

The connection to the TV worked without any issue but when trying to send a key to the TV nothing happens.
Via:

connection.recv()
print(connection.connected)

I can see that the script connected to the TV but nothing will happen, no matter what button I try to send.
Is there a solution to this problem?

Powering TV ON problem

Hey @eclair4151,

Your code works great with my UE55HU7505 (2014?) TV. But i can't turn the TV ON with this code. Should this SmartCrypto also support that feature?

ValueError

Traceback (most recent call last):
File "smartcrypto.py", line 126, in
output = HelloExchange(tvPIN)
File "smartcrypto.py", line 68, in HelloExchange
return crypto.parseClientHello(clientHello, hello_output['hash'], hello_output['AES_key'], UserId)
File "/home/lebhack/SmartCrypto-master/PySmartCrypto/crypto.py", line 79, in parseClientHello
secret = bytes.fromhex(hex(pow(bnPGx, bnPrivateKey, bnPrime)).rstrip("L").lstrip("0x"))
ValueError: non-hexadecimal number found in fromhex() arg at position 255

i got:
pEncWBGx: "redacted"
pEncGx: "redacted"
pGx: "redacted"
cant get the CTX code

Need to re-pair after power off the TV

HI @eclair4151,

I have an issue with my tv (J5500), I am able to get the token and Id session, and the work, I can send commands to the TV, but when I turn off and then ON the TV, I need to re-pair the TV again because TV seems not to receive any command.

Send command issue

Hi,
I ' ve tried to send command on a model J and the Tv seems not understanding the command.
The handshake part of the communication process works fine.

Have you managed to send successfully a command andon which Tv model.
Thanks !

Install this on Raspbian. what do I need?

Goal
I would like to install this on a Raspbian. Goal is to use it with node-red and over SSH.

Problem:

  1. Clone this repository seems not enough. What additional Software do I need?
    [Edit] Solved - It works if I use python3 smartcrypto.py
  2. According to the README.md I have to use the last line in smartcrypto.py but I do not understand how a command line should look like

ImportError: No module named 'Crypto'

Hi,
can I please get help while executing:

python3 PySmartCrypto/smartcrypto.py Traceback (most recent call last): File "PySmartCrypto/smartcrypto.py", line 2, in <module> import crypto File "/root/temp/SmartCrypto-master/temp/SmartCrypto/PySmartCrypto/crypto.py", line 2, in <module> from Crypto.Cipher import AES ImportError: No module named 'Crypto'

Any ideas how I can fix this?

Not Working on 2017 Model

I have a QN65Q6FNA.
I do not get a pin page on my display when I run the command "ws://10.0.0.243:8001/ws/app/CloudPINPage".

if I run this from the WS google extension I get:
{
"data": {
"clients": [
{
"attributes": {
"name": null
},
"connectTime": 1559090240610,
"deviceName": "Smart Device",
"id": "ac9d77c9-af62-4f6b-b366-14e6d58d99e5",
"isHost": false
}
],
"id": "ac9d77c9-af62-4f6b-b366-14e6d58d99e5"
},
"event": "ms.channel.connect"
}

I have tried so many different Samsung control python scripts and cannot get anything to work.
Any help would be great.

String vs byte_string issue

Hi,

after I run

python smartcrypto.py

I got the same issue after I input then PIN back

Current state: stopped
Pin NOT on TV
Please enter pin from tv: 9220
Got pin: '9220'

AES key: d46ecd26a032ded4a2f9f4e8b7ef41f1
Traceback (most recent call last):
  File "smartcrypto.py", line 126, in <module>
    output = HelloExchange(tvPIN)
  File "smartcrypto.py", line 55, in HelloExchange
    hello_output = crypto.generateServerHello(UserId,pin)
  File "/srv/homeassistant/lib/python3.5/site-packages/PySmartCrypto/crypto.py", line 39, in generateServerHello
    cipher = AES.new(aes_key, AES.MODE_CBC, iv)
  File "/srv/homeassistant/lib/python3.5/site-packages/Crypto/Cipher/AES.py", line 206, in new
    return _create_cipher(sys.modules[__name__], key, mode, *args, **kwargs)
  File "/srv/homeassistant/lib/python3.5/site-packages/Crypto/Cipher/__init__.py", line 79, in _create_cipher
    return modes[mode](factory, **kwargs)
  File "/srv/homeassistant/lib/python3.5/site-packages/Crypto/Cipher/_mode_cbc.py", line 253, in _create_cbc_cipher
    return CbcMode(cipher_state, iv)
  File "/srv/homeassistant/lib/python3.5/site-packages/Crypto/Cipher/_mode_cbc.py", line 96, in __init__
    c_uint8_ptr(iv),
  File "/srv/homeassistant/lib/python3.5/site-packages/Crypto/Util/_raw_api.py", line 109, in c_uint8_ptr
    raise TypeError("Object type %s cannot be passed to C code" % type(data))
TypeError: Object type <class 'str'> cannot be passed to C code

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.