From f3cd29e4d8e2b4a207bcc22990bb09f4e61db8b5 Mon Sep 17 00:00:00 2001 From: Zegorax Date: Sat, 21 Mar 2020 23:52:27 +0100 Subject: [PATCH] Removed Python indentation --- install.sh | 122 ++++++++++++++++++++++++++--------------------------- 1 file changed, 61 insertions(+), 61 deletions(-) diff --git a/install.sh b/install.sh index 2e77c2d..f864abf 100644 --- a/install.sh +++ b/install.sh @@ -10,79 +10,79 @@ else pip install pycrypto cat < index.py - from Crypto.Hash import SHA, SHA256 - from Crypto.Signature import PKCS1_v1_5 - from Crypto.PublicKey import RSA - from shutil import copyfile - import json - import codecs +from Crypto.Hash import SHA, SHA256 +from Crypto.Signature import PKCS1_v1_5 +from Crypto.PublicKey import RSA +from shutil import copyfile +import json +import codecs - hexlify = codecs.getencoder('hex') +hexlify = codecs.getencoder('hex') - licenseFile = { - "branding": False, - "connections": 9999, - "customization": False, - "end_date": "2099-01-01T23:59:59.000Z", - "light": "False", - "mode": "", - "portal_count": "0", - "process": 2, - "ssbranding": False, - "test": "False", - "trial": "False", - "user_quota": "0", - "users_count": 9999, - "users_expire": 99999, - "whiteLabel": False, - "customer_id": "customerID", - "start_date": "2020-01-01T00:00:00.000Z", - "users": [], - "version": 2 - } +licenseFile = { + "branding": False, + "connections": 9999, + "customization": False, + "end_date": "2099-01-01T23:59:59.000Z", + "light": "False", + "mode": "", + "portal_count": "0", + "process": 2, + "ssbranding": False, + "test": "False", + "trial": "False", + "user_quota": "0", + "users_count": 9999, + "users_expire": 99999, + "whiteLabel": False, + "customer_id": "customerID", + "start_date": "2020-01-01T00:00:00.000Z", + "users": [], + "version": 2 +} - jsonLicenseFile = codecs.encode(json.dumps(licenseFile, separators=(',', ':')), encoding='utf-8') +jsonLicenseFile = codecs.encode(json.dumps(licenseFile, separators=(',', ':')), encoding='utf-8') - privKey = RSA.generate(1024) - publKey = privKey.publickey().exportKey('PEM') +privKey = RSA.generate(1024) +publKey = privKey.publickey().exportKey('PEM') - digest = SHA.new(jsonLicenseFile) - signer = PKCS1_v1_5.new(privKey) - signature = signer.sign(digest) +digest = SHA.new(jsonLicenseFile) +signer = PKCS1_v1_5.new(privKey) +signature = signer.sign(digest) - finalSignature = signature.hex() +finalSignature = signature.hex() - licenseFile['signature'] = finalSignature +licenseFile['signature'] = finalSignature - f = open("OO_License", "w+") - f.write(json.dumps(licenseFile)) - f.close +f = open("OO_License", "w+") +f.write(json.dumps(licenseFile)) +f.close - f = open("OO_PubKey", "w+") - f.write(publKey.decode('utf-8')) +f = open("OO_PubKey", "w+") +f.write(publKey.decode('utf-8')) +f.close() + +print("The license file has been saved to OO_License. Here's the content :") +print(json.dumps(licenseFile)) +print("It will be placed automatically in the Data directory of OnlyOffice") + +copyfile("OO_License", "/var/www/onlyoffice/Data/license.lic") + +print("Patching docservice and convert...") + +basePath = "/var/www/onlyoffice/documentserver/server/" +files = ["DocService/docservice", "FileConverter/converter"] + +for file in files: + f = open(basePath+file, 'rb') + data = f.read() f.close() - print("The license file has been saved to OO_License. Here's the content :") - print(json.dumps(licenseFile)) - print("It will be placed automatically in the Data directory of OnlyOffice") + replacedData = data.replace(b"-----BEGIN PUBLIC KEY-----\nMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDRhGF7X4A0ZVlEg594WmODVVUI\niiPQs04aLmvfg8SborHss5gQXu0aIdUT6nb5rTh5hD2yfpF2WIW6M8z0WxRhwicg\nXwi80H1aLPf6lEPPLvN29EhQNjBpkFkAJUbS8uuhJEeKw0cE49g80eBBF4BCqSL6\nPFQbP9/rByxdxEoAIQIDAQAB\n-----END PUBLIC KEY-----", bytes(publKey)) - copyfile("OO_License", "/var/www/onlyoffice/Data/license.lic") - - print("Patching docservice and convert...") - - basePath = "/var/www/onlyoffice/documentserver/server/" - files = ["DocService/docservice", "FileConverter/converter"] - - for file in files: - f = open(basePath+file, 'rb') - data = f.read() - f.close() - - replacedData = data.replace(b"-----BEGIN PUBLIC KEY-----\nMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDRhGF7X4A0ZVlEg594WmODVVUI\niiPQs04aLmvfg8SborHss5gQXu0aIdUT6nb5rTh5hD2yfpF2WIW6M8z0WxRhwicg\nXwi80H1aLPf6lEPPLvN29EhQNjBpkFkAJUbS8uuhJEeKw0cE49g80eBBF4BCqSL6\nPFQbP9/rByxdxEoAIQIDAQAB\n-----END PUBLIC KEY-----", bytes(publKey)) - - f = open(basePath+file, 'wb') - f.write(replacedData) - f.close() + f = open(basePath+file, 'wb') + f.write(replacedData) + f.close() EOF