diff options
author | Joel Wetzell <[email protected]> | 2023-04-23 07:13:50 -0500 |
---|---|---|
committer | Joel Wetzell <[email protected]> | 2023-04-23 07:13:50 -0500 |
commit | c806db767069720b54364428e108b4121edbd934 (patch) | |
tree | 29c41dddf81f30e06c354d75115426487b7a0e04 | |
parent | 311a0f221652047fef8db040c97d492c0c600f47 (diff) | |
download | OpenCortex-c806db767069720b54364428e108b4121edbd934.tar.gz OpenCortex-c806db767069720b54364428e108b4121edbd934.zip |
relocate js, css and proto files
-rw-r--r-- | File-decryption/webapp/assets/css/style.css (renamed from File-decryption/webapp/style.css) | 0 | ||||
-rw-r--r-- | File-decryption/webapp/assets/js/sha1.js (renamed from File-decryption/webapp/sha1.js) | 0 | ||||
-rw-r--r-- | File-decryption/webapp/assets/proto/Capture.proto | 23 | ||||
-rw-r--r-- | File-decryption/webapp/assets/proto/Preset.proto | 157 | ||||
-rw-r--r-- | File-decryption/webapp/main.js | 107 |
5 files changed, 180 insertions, 107 deletions
diff --git a/File-decryption/webapp/style.css b/File-decryption/webapp/assets/css/style.css index 64fa213..64fa213 100644 --- a/File-decryption/webapp/style.css +++ b/File-decryption/webapp/assets/css/style.css diff --git a/File-decryption/webapp/sha1.js b/File-decryption/webapp/assets/js/sha1.js index 13d340f..13d340f 100644 --- a/File-decryption/webapp/sha1.js +++ b/File-decryption/webapp/assets/js/sha1.js diff --git a/File-decryption/webapp/assets/proto/Capture.proto b/File-decryption/webapp/assets/proto/Capture.proto new file mode 100644 index 0000000..01e66ad --- /dev/null +++ b/File-decryption/webapp/assets/proto/Capture.proto @@ -0,0 +1,23 @@ +syntax = "proto3"; + +package captureProto; + +message Capture { + float sample_rate = 1; + uint32 pre_filter_length = 2; + uint32 post_filter_length = 3; + repeated float pre_filter_coefficients = 4; + repeated float post_filter_coefficients = 5; + float constant_pre_gain = 6; + float constant_post_gain = 7; + uint32 number_of_layers = 8; + repeated uint32 layer_sizes = 9; + repeated layerWeightsAndBiases weights_and_biases = 10; + float high_pass_frequency = 11; + float high_pass_bandwidth = 12; +} + +message layerWeightsAndBiases { + repeated float weights = 1; + repeated float biases = 2; +}
\ No newline at end of file diff --git a/File-decryption/webapp/assets/proto/Preset.proto b/File-decryption/webapp/assets/proto/Preset.proto new file mode 100644 index 0000000..5fd8174 --- /dev/null +++ b/File-decryption/webapp/assets/proto/Preset.proto @@ -0,0 +1,157 @@ +syntax = "proto3"; + +message BinaryPreset { + string name = 2; + uint32 hash = 3; + string date = 4; + float volume = 5; + float pan = 6; + uint32 default_scene = 7; + string author_name = 8; + string author_id = 9; + uint32 tempo = 10; + repeated Chain chains = 11; + repeated string tags = 12; + repeated LegacyStompModeStompData legacy_stomp_mode_stomp_data = 13; + repeated uint32 scene_tempo = 14; + repeated string scene_labels = 15; + repeated MidiMessageInfo midi_messages = 16; + repeated MidiMessageInfo midi_messages_general = 17; + repeated Bypass bypass = 18; + repeated Model tempoProgramData = 19; + repeated uint32 layout_code_1 = 20; + repeated uint32 layout_code_2 = 21; + repeated string created_version = 22; + repeated string modified_version = 23; + repeated string oldest_compatible_version = 24; + repeated string cloud_id = 25; + repeated string description = 26; + repeated StompModeAssignment stomp_mode_assignments = 27; +} + +message Chain { + repeated Model models = 5; + repeated SplitControlPoints split_control_points = 6; + repeated Model splitter = 7; + repeated Model mixer = 8; + repeated Model output_control = 9; + repeated SceneBypass splitBypass = 10; + repeated SceneBypass mixBypass = 11; + repeated Model combined_splitter = 12; + repeated Model input_control = 13; + + oneof _in_portid { + uint32 in_portid = 1; + } + + oneof _out_portid { + uint32 out_portid = 2; + } + + oneof _row { + uint32 row = 14; + } +} + +message Model { + repeated Param params = 2; + repeated Expression bypass_expression = 3; + repeated ExpressionBypassInfo expression_bypass_info = 4; + + oneof _hash { + uint32 hash = 1; + } + + oneof _column { + uint32 column = 5; + } +} + +message SplitControlPoints { + int32 split = 1; + int32 mix = 2; +} + +message Bypass { + repeated ColBypass colBypass = 1; + + oneof _row { + uint32 row = 2; + } +} + +message ColBypass { + repeated SceneBypass sceneBypass = 1; + + oneof _column { + uint32 column = 2; + } +} + +message SceneBypass { + bool bypass = 1; +} + +message Param { + repeated ParamValue param_values = 5; + + oneof _expression { + int32 expression = 1; + } + + oneof _expression_min { + float expression_min = 2; + } + + oneof _expression_max { + float expression_max = 3; + } + + oneof _scene_mode { + bool scene_mode = 4; + } + + oneof _index { + uint32 index = 6; + } +} + +message ParamValue { + oneof value { + int32 int_value = 1; + float float_value = 2; + string string_value = 3; + } +} + +message LegacyStompModeStompData { + uint32 row = 1; + uint32 column = 2; +} + +message StompModeAssignment { + uint32 row = 1; + uint32 column = 2; + uint32 stomp_index = 3; +} + +message MidiMessageInfo { + uint32 type = 1; + uint32 channel = 2; + uint32 param1 = 3; + uint32 param2 = 4; + uint32 param3 = 5; +} + +message Expression { + int32 expression = 1; + float expression_min = 2; + float expression_max = 3; +} + +message ExpressionBypassInfo { + uint32 type = 1; + bool invert = 2; + uint32 delay_ms = 3; + bool latch_emulation = 4; +} diff --git a/File-decryption/webapp/main.js b/File-decryption/webapp/main.js deleted file mode 100644 index 792eb3d..0000000 --- a/File-decryption/webapp/main.js +++ /dev/null @@ -1,107 +0,0 @@ -// as seen in /usr/lib/libzc.so / SetupKeys -const MASTER_KEY = new Uint8Array([ - 0x13, 0x27, 0x3f, 0x42, - 0xa5, 0xb6, 0x79, 0xe8, - 0x20, 0x31, 0xc4, 0xf5, - 0x16, 0x17, 0x88, 0x2f, - 0x43, 0xa4, 0x55, 0x69, - 0x77, 0xb8, 0xe2, 0x83, - 0x04, 0x05, 0x60, 0x70, - 0x80, 0x02, 0x03, 0x04, - 0x50, 0x6a, 0x7c, 0x8a, - 0x02, 0x30, 0x40, 0x51, - 0x6a, 0x7d, 0x8d, 0x22, - 0x33, 0x44, 0x59, 0x66, - 0x71, 0x08, 0x02, 0x03, - 0x43, 0x05, 0x67, 0x7a, - 0x8f]); - -function hex(byteArray) { - return Array.prototype.map.call(byteArray, function (byte) { - return ('0' + (byte & 0xFF).toString(16)).slice(-2); - }).join(''); -} - -// ported from EVP_BytesToKey -// https://github.com/openssl/openssl/blob/c04e78f0c69201226430fed14c291c281da47f2d/crypto/evp/evp_key.c#L78 -function deriveKeyAndIV(password, iterations = 10) { - var keyLen = 16; - var ivLen = 16; - var addmd = 0; - - var key = new Uint8Array(keyLen); - var iv = new Uint8Array(ivLen); - var tmp = new Uint8Array(); - var i, key_i = 0, iv_i = 0; - - for (; keyLen > 0 || ivLen > 0;) { - if (addmd++) { - block = new Uint8Array([...tmp, ...password]); - } else { - block = password; - } - - tmp = new Uint8Array(sha1.array(block)); - for (i = 1; i < iterations; i++) { - tmp = sha1.array(tmp); - } - - i = 0; - while (keyLen && i != tmp.length) { - key[key_i++] = tmp[i]; - keyLen--; - i++; - } - - while (ivLen != 0 && i != tmp.length) { - iv[iv_i++] = tmp[i]; - ivLen--; - i++; - } - } - - return { key: key, iv: iv }; -} - -function processFileInput(e) { - const fileName = e.target.fileName; - const serial = document.getElementById('serial-input').value; - let main_key = null; - if (serial.length > 0) { - // local decryption, use master key + serial - main_key = new Uint8Array([...MASTER_KEY, ...new TextEncoder("utf-8").encode(serial)]); - } else { - // global decryption, use master key only - main_key = MASTER_KEY; - } - - // derive key and iv with our EVP_BytesToKey port - const derived = deriveKeyAndIV(main_key); - // encrypted file contents - const ciphertext = e.target.result; - // import the raw key - window.crypto.subtle.importKey("raw", derived.key, "AES-CTR", true, ["encrypt", "decrypt"]).then(function (key) { - // decrypt using aes-128-ctr - window.crypto.subtle.decrypt({ name: "AES-CTR", counter: derived.iv, length: 128 }, key, ciphertext).then(function (cleartext) { - var blob = new Blob([cleartext], { type: "application/octet-stream" }); - const link = document.createElement('a'); - link.href = window.URL.createObjectURL(blob); - link.download = fileName + '.dec'; - link.click(); - }); - }); -} - -document.addEventListener("DOMContentLoaded", function () { - // handle file uploads - let fileInput = document.getElementById('file-input') - fileInput.onchange = () => { - const reader = new FileReader() - reader.onload = processFileInput; - for (let file of fileInput.files) { - // https://stackoverflow.com/questions/24245105/how-to-get-the-filename-from-the-javascript-filereader - reader.fileName = file.name; - reader.readAsArrayBuffer(file); - } - }; -});
\ No newline at end of file |