SmartCrypto
SmartCrypto copied to clipboard
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:
- Clone this repository seems not enough. What additional Software do I need? [Edit] Solved - It works if I use python3 smartcrypto.py
- 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
I played around with the smartcrypto.py script. At moment I use this script to be able to send Keys to the TV:
python3 .\tv.py KEY_VOLDOWN
#!/usr/bin/env python3
from __future__ import print_function
import crypto
import sys
import re
from command_encryption import AESCipher
import requests
import time
import websocket
import argparse
parser = argparse.ArgumentParser(description='Gib dem TV Befehle')
parser.add_argument("key", help='befehle an den TV')
args = parser.parse_args()
UserId = "xxxxxx"
AppId = "xxxxxx"
deviceId = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
tvIP = "xxx.xxx.xxx.xxx"
tvPort = "xxxx"
ctx = "xxxxxx"
session_id = "1xxxxxxx"
key_command = args.key
def send_command(session_id, ctx, key_command):
ctx = ctx.upper()
millis = int(round(time.time() * 1000))
step4_url = 'http://' + tvIP + ':8000/socket.io/1/?t=' + str(millis)
websocket_response = requests.get(step4_url)
websocket_url = 'ws://' + tvIP + ':8000/socket.io/1/websocket/' + websocket_response.text.split(':')[0]
print(websocket_url)
aesLib = AESCipher(ctx, session_id)
connection = websocket.create_connection(websocket_url)
time.sleep(0.35)
# need sleeps cuz if you send commands to quick it fails
connection.send('1::/com.samsung.companion')
# pairs to this app with this command.
time.sleep(0.35)
connection.send(aesLib.generate_command(key_command))
time.sleep(0.35)
connection.close()
print('Attempting to send command ' + args.key + ' to tv')
send_command(session_id, ctx, args.key)