diff --git a/config-sample.ini b/config-sample.ini index 9b07d5da7..30e919f22 100644 --- a/config-sample.ini +++ b/config-sample.ini @@ -18,8 +18,3 @@ certKeyPath=cert.key username=your_username # This is bcrypt password hash. You can use generate-password.py (in this directory) to hash your password passwordHash=$2b$12$FHT8keXp3BGTfzAV/VnrkuLpkwN8Vpj5iIh4RwCbHTNWYSBI9hGAK - -[Sync] -sync-server-url=https://localhost:57201 -sync-server-username=syncuser -sync-server-password=password \ No newline at end of file diff --git a/src/sync.py b/src/sync.py deleted file mode 100644 index 186f02ad1..000000000 --- a/src/sync.py +++ /dev/null @@ -1,62 +0,0 @@ -import binascii -import hashlib -import os - -import configparser -import requests - -config = configparser.ConfigParser() -config.read('config.ini') - -syncServerUrl = config['Sync']['sync-server-url'] -syncServerUsername = config['Sync']['sync-server-username'] -syncServerPassword = config['Sync']['sync-server-password'] - -nonce = binascii.hexlify(bytearray(os.urandom(32))) - -print('Nonce: ' + nonce) - -authContent = syncServerUsername + ":" + hashlib.sha256(syncServerUsername + ":" + syncServerPassword).hexdigest() + ":" + nonce - -print('Auth content: ' + authContent) - -# SHA256(user + ":" + SHA256(user + ":" + password) + ":" + nonce) where SHA256 is a hex encoded value -auth = hashlib.sha256(authContent).hexdigest() - -response = requests.post(syncServerUrl + "/login", json={ - 'user': syncServerUsername, - 'nonce': nonce, - 'auth': auth, - 'protocol': '2' -}, verify=False) - -# verify='/home/adam/.notecase/server.pem' - -def printResp(resp): - print('Status: ' + str(resp.status_code)) - - for key in response.headers: - print(key + ': ' + resp.headers[key]) - - print('Body: ' + resp.content) - -printResp(response) - -session = response.headers['Auth'] - -response = requests.get(syncServerUrl + "/document/list", headers={ - 'Auth': session -}, verify=False) - -printResp(response) - -response = requests.post(syncServerUrl + "/document/tree", headers={ - 'Auth': session -}, -json={ - 'id': 1, - 'password': '' -}, -verify=False) - -printResp(response)