├── README.md
├── patch.sh
└── synocodectool
├── original
├── synocodectool.6.0-7321-0_6.0.3-8754-8.original
├── synocodectool.6.1-15047-0_6.1.1-15101-4.original
├── synocodectool.6.1.2-15132-0_6.1.3-15152-8.original
├── synocodectool.6.1.4-15217-0_6.2-23739-2.original
├── synocodectool.6.2.1-23824-0_6.2.3-25426-3.original
├── synocodectool.7.0.1-42216-0_7.0.1-42218-3.original
├── synocodectool.7.1-42661-0_7.1-42661-0.CodecPack.original
├── synocodectool.7.1-42661-0_7.1-42661-0.original
├── synocodectool.7.1.1-42962-2.original
├── synocodectool.7.2-64570-0.original
└── synocodectool.7.2.1-69057-0.original
└── patch
├── synocodectool.6.0-7321-0_6.0.3-8754-8.patch
├── synocodectool.6.1-15047-0_6.1.1-15101-4.patch
├── synocodectool.6.1.2-15132-0_6.1.3-15152-8.patch
├── synocodectool.6.1.4-15217-0_6.2-23739-2.patch
├── synocodectool.6.2.1-23824-0_6.2.3-25426-3.patch
├── synocodectool.7.0.1-42216-0_7.0.1-42218-3.patch
├── synocodectool.7.1-42661-0_7.1-42661-0.CodecPack.patch
├── synocodectool.7.1-42661-0_7.1-42661-0.patch
├── synocodectool.7.1.1-42962-2.patch
├── synocodectool.7.2-64570-0.patch
└── synocodectool.7.2.1-69057-0.patch
/README.md:
--------------------------------------------------------------------------------
1 | # synocodectool-patch
2 |
3 | **[Repository has been discontinued!](https://github.com/wirgen/synocodectool-patch/pull/16)**
4 |
5 | 
6 |
7 | This patch enables transcoding on Synologys DiskStation Manager 6+ without a valid serial number.
8 | The structure is loosely based on https://github.com/keylase/nvidia-patch
9 |
10 | ### Requirements:
11 | - DiskStation Manager 6 or higher
12 | - Your serial number ***must*** be in the proper format (e.g. XXXXPDNXXXXXX for DS918+, XXXXODNXXXXXX for DS3617xs, XXXXLWNXXXXXX for 3615xs)
13 | - x86-64 based
14 | - SSH/Terminal Access
15 | - sudo/root
16 |
17 | ## Version Table
18 |
19 | | Version | Patch supported | Original SHA1 / Patched SHA1 | Original | Patch |
20 | |:--------|:---------------:|:----------------------------:|:--------:|:-----:|
21 | |6.0 7321-0 -
6.0.3 8754-8| :heavy_check_mark: | cde88ed8fdb2bfeda8de52ef3adede87a72326ef
e5c1a65b3967968560476fcda5071fd37db40223 | [Link](../../raw/master/synocodectool/original/synocodectool.6.0-7321-0_6.0.3-8754-8.original) | [Link](../../raw/master/synocodectool/patch/synocodectool.6.0-7321-0_6.0.3-8754-8.patch) |
22 | |6.1 15047-0 -
6.1.1 15101-4| :heavy_check_mark: | ec0c3f5bbb857fa84f5d1153545d30d7b408520b
d58f5b33ff2b6f2141036837ddf15dd5188384c6 | [Link](../../raw/master/synocodectool/original/synocodectool.6.1-15047-0_6.1.1-15101-4.original) | [Link](../../raw/master/synocodectool/patch/synocodectool.6.1-15047-0_6.1.1-15101-4.patch) |
23 | |6.1.2 15132-0 -
6.1.3 15152-8| :heavy_check_mark: | 1473d6ad6ff6e5b8419c6b0bc41006b72fd777dd
56ca9adaf117e8aae9a3a2e29bbcebf0d8903a99 | [Link](../../raw/master/synocodectool/original/synocodectool.6.1.2-15132-0_6.1.3-15152-8.original) | [Link](../../raw/master/synocodectool/patch/synocodectool.6.1.2-15132-0_6.1.3-15152-8.patch) |
24 | |6.1.4 15217-0 -
6.2 23739-2| :heavy_check_mark: | 26e42e43b393811c176dac651efc5d61e4569305
511dec657daa60b0f11da20295e2c665ba2c749c | [Link](../../raw/master/synocodectool/original/synocodectool.6.1.4-15217-0_6.2-23739-2.original) | [Link](../../raw/master/synocodectool/patch/synocodectool.6.1.4-15217-0_6.2-23739-2.patch) |
25 | |6.2.1 23824-0 -
6.2.3 25426-3| :heavy_check_mark: | 1d01ee38211f21c67a4311f90315568b3fa530e6
93067026c251b100e27805a8b4b9d8f0ae8e291c | [Link](../../raw/master/synocodectool/original/synocodectool.6.2.1-23824-0_6.2.3-25426-3.original) | [Link](../../raw/master/synocodectool/patch/synocodectool.6.2.1-23824-0_6.2.3-25426-3.patch) |
26 | |7.0.1 42216-0 -
7.0.1 42218-3| :heavy_check_mark: | c2f07f4cebf0bfb63e3ca38f811fd5b6112a797e
873749b00e1624df4b01335e0b69102acc185eb9 | [Link](../../raw/master/synocodectool/original/synocodectool.7.0.1-42216-0_7.0.1-42218-3.original) | [Link](../../raw/master/synocodectool/patch/synocodectool.7.0.1-42216-0_7.0.1-42218-3.patch) |
27 | |7.1 42661-0 -
7.1 42661-4| :heavy_check_mark: | 796ac7fab2dcad7978a0e8ae48abc9150aba916c
06d543b2aab5ea73600ca96497febdad96dc7864 | [Link](../../raw/master/synocodectool/original/synocodectool.7.1-42661-0_7.1-42661-0.original) | [Link](../../raw/master/synocodectool/patch/synocodectool.7.1-42661-0_7.1-42661-0.patch) |
28 | |7.1 42661-0 -
7.1 42661-4
(CodecPack)| :heavy_check_mark: | 22445f5b0d8b6714954b50930c47b8805cf32b98
3a5ed18dc41ff243f3481b6e3cf4770651df0b54 | [Link](../../raw/master/synocodectool/original/synocodectool.7.1-42661-0_7.1-42661-0.CodecPack.original) | [Link](../../raw/master/synocodectool/patch/synocodectool.7.1-42661-0_7.1-42661-0.CodecPack.patch) |
29 | |7.1.1 42962-0 -
7.1.1 42962-6| :heavy_check_mark: | 18461b62813166652fd64a96e06237fde81925f7
4bfa2a72da607752435e432545f98f1a0b3815a8 | [Link](../../raw/master/synocodectool/original/synocodectool.7.1.1-42962-2.original) | [Link](../../raw/master/synocodectool/patch/synocodectool.7.1.1-42962-2.patch) |
30 | |7.2 64570-0 -
7.2 64570-1| :heavy_check_mark: | d316d5b2b080346b4bc197ad5ad7994ac043a15d
8ffe49d91dc0fcd3268ff1afcbc9132d1ae634d1 | [Link](../../raw/master/synocodectool/original/synocodectool.7.2-64570-0.original) | [Link](../../raw/master/synocodectool/patch/synocodectool.7.2-64570-0.patch) |
31 | |7.2.1 69057-0 -
7.2.1 69057-5| :heavy_check_mark: | a205aa337d808213cf6d4d839b035cde0237b424
1f4491bf5f27f0719ddebdcab6ff4eff56c64b2c | [Link](../../raw/master/synocodectool/original/synocodectool.7.2.1-69057-0.original) | [Link](../../raw/master/synocodectool/patch/synocodectool.7.2.1-69057-0.patch) |
32 |
33 | :warning: : Not tested yet
34 |
35 | ## Synopsis
36 |
37 | ```
38 | # sudo ./patch.sh -h
39 |
40 | SYNOPSIS
41 | patch.sh [-h] [-p|-r|-l]
42 | DESCRIPTION
43 | Patch to enable transcoding without a valid serial in DSM 6+
44 | -h Print this help message
45 | -p Patch synocodectool
46 | -r Restore original from backup
47 | -l List supported DSM versions
48 |
49 | ```
50 |
51 | ## Manual
52 |
53 | ### Downloading and making script executable
54 |
55 | ```bash
56 | wget https://raw.githubusercontent.com/wirgen/synocodectool-patch/master/patch.sh
57 | chmod +x patch.sh
58 | ```
59 |
60 | ### Patching synocodectool
61 |
62 | This patch performs a backup of the original file prior to making changes.
63 |
64 | ```bash
65 | sudo ./patch.sh -p
66 | ```
67 |
68 | ### Restoring original file
69 |
70 | If something goes horribly wrong restoring the original file is possible
71 |
72 | ```bash
73 | sudo ./patch.sh -r
74 | ```
75 |
--------------------------------------------------------------------------------
/patch.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | set -eo pipefail;
3 | shopt -s nullglob;
4 |
5 | #variables
6 | bin_file="synocodectool"
7 | conf_file="activation.conf"
8 | conf_path="/usr/syno/etc/codec"
9 | conf_string='{"success":true,"activated_codec":["hevc_dec","ac3_dec","h264_dec","h264_enc","aac_dec","aac_enc","mpeg4part2_dec","vc1_dec","vc1_enc"],"token":"123456789987654abc"}'
10 | opmode="patchhelp"
11 |
12 | #arrays
13 | declare -A binhash_version_list=(
14 | ["cde88ed8fdb2bfeda8de52ef3adede87a72326ef"]="6.0-7321-0_6.0.3-8754-8"
15 | ["ec0c3f5bbb857fa84f5d1153545d30d7b408520b"]="6.1-15047-0_6.1.1-15101-4"
16 | ["1473d6ad6ff6e5b8419c6b0bc41006b72fd777dd"]="6.1.2-15132-0_6.1.3-15152-8"
17 | ["26e42e43b393811c176dac651efc5d61e4569305"]="6.1.4-15217-0_6.2-23739-2"
18 | ["1d01ee38211f21c67a4311f90315568b3fa530e6"]="6.2.1-23824-0_6.2.3-25426-3"
19 | ["c2f07f4cebf0bfb63e3ca38f811fd5b6112a797e"]="7.0.1-42216-0_7.0.1-42218-3"
20 | ["796ac7fab2dcad7978a0e8ae48abc9150aba916c"]="7.1-42661-0_7.1-42661-0"
21 | ["22445f5b0d8b6714954b50930c47b8805cf32b98"]="7.1-42661-0_7.1-42661-0"
22 | ["18461b62813166652fd64a96e06237fde81925f7"]="7.1.1-42962-0_7.1.1-42962-6"
23 | ["d316d5b2b080346b4bc197ad5ad7994ac043a15d"]="7.2-64570-0_7.2-64570-1"
24 | ["a205aa337d808213cf6d4d839b035cde0237b424"]="7.2.1-69057-0_7.2.1-69057-5"
25 | )
26 |
27 | declare -A patchhash_binhash_list=(
28 | ["e5c1a65b3967968560476fcda5071fd37db40223"]="cde88ed8fdb2bfeda8de52ef3adede87a72326ef"
29 | ["d58f5b33ff2b6f2141036837ddf15dd5188384c6"]="ec0c3f5bbb857fa84f5d1153545d30d7b408520b"
30 | ["56ca9adaf117e8aae9a3a2e29bbcebf0d8903a99"]="1473d6ad6ff6e5b8419c6b0bc41006b72fd777dd"
31 | ["511dec657daa60b0f11da20295e2c665ba2c749c"]="26e42e43b393811c176dac651efc5d61e4569305"
32 | ["93067026c251b100e27805a8b4b9d8f0ae8e291c"]="1d01ee38211f21c67a4311f90315568b3fa530e6"
33 | ["873749b00e1624df4b01335e0b69102acc185eb9"]="c2f07f4cebf0bfb63e3ca38f811fd5b6112a797e"
34 | ["06d543b2aab5ea73600ca96497febdad96dc7864"]="796ac7fab2dcad7978a0e8ae48abc9150aba916c"
35 | ["3a5ed18dc41ff243f3481b6e3cf4770651df0b54"]="22445f5b0d8b6714954b50930c47b8805cf32b98"
36 | ["4bfa2a72da607752435e432545f98f1a0b3815a8"]="18461b62813166652fd64a96e06237fde81925f7"
37 | ["8ffe49d91dc0fcd3268ff1afcbc9132d1ae634d1"]="d316d5b2b080346b4bc197ad5ad7994ac043a15d"
38 | ["1f4491bf5f27f0719ddebdcab6ff4eff56c64b2c"]="a205aa337d808213cf6d4d839b035cde0237b424"
39 | )
40 |
41 | declare -A binhash_patch_list=(
42 | ["cde88ed8fdb2bfeda8de52ef3adede87a72326ef"]="00002dc0: 27000084c0eb4cb9b6000000badd6940\n00003660: 24f0000000e8961e000084c00f84b400"
43 | ["ec0c3f5bbb857fa84f5d1153545d30d7b408520b"]="00002dc0: 27000084c0eb4cb9b7000000bafd6940\n000036f0: 0000e8291e000084c0eb1eb9ec000000"
44 | ["1473d6ad6ff6e5b8419c6b0bc41006b72fd777dd"]="00002dc0: 27000084c0eb4cb9b7000000baad6a40\n000036f0: 0000e8291e000084c0eb1eb9ec000000"
45 | ["26e42e43b393811c176dac651efc5d61e4569305"]="00002dc0: 27000084c0eb4cb9ba000000badf6a40\n00003710: f0000000e8271e000084c0eb1eb9ef00"
46 | ["1d01ee38211f21c67a4311f90315568b3fa530e6"]="00002dc0: 27000084c0eb4cb9bd000000baf76a40\n00003720: 24f0000000e8261e000084c0eb1eb9f2"
47 | ["c2f07f4cebf0bfb63e3ca38f811fd5b6112a797e"]="00002dc0: 000084c0eb2141b8c1000000b9586c40\n00003780: 1d000084c0e90d0100009041b8f60000"
48 | ["796ac7fab2dcad7978a0e8ae48abc9150aba916c"]="000035b0: 74cd4889efe8f623000084c0eb004c8d\n000040a0: fdffff4c89efe80519000084c0eb0048"
49 | ["22445f5b0d8b6714954b50930c47b8805cf32b98"]="00003850: e7e89a27000084c0eb00488dac249000\n00004340: fdffff4c89efe8a51c000084c0eb0048"
50 | ["18461b62813166652fd64a96e06237fde81925f7"]="000038e0: e7e89a27000084c0eb00488dac249000\n000043d0: fdffff4c89efe8a51c000084c0eb0048"
51 | ["d316d5b2b080346b4bc197ad5ad7994ac043a15d"]="00004220: 08fdffffe87722000084c090e9000000\n00004390: ffe80a21000084c090e900000000488b"
52 | ["a205aa337d808213cf6d4d839b035cde0237b424"]="00004220: 08fdffffe87722000084c090e9000000\n00004390: ffe80a21000084c090e900000000488b"
53 | )
54 |
55 | declare -a binpath_list=()
56 |
57 | declare -a path_list=(
58 | "/usr/syno/bin"
59 | "/volume1/@appstore/VideoStation/bin"
60 | "/volume2/@appstore/VideoStation/bin"
61 | "/volume3/@appstore/VideoStation/bin"
62 | "/volume1/@appstore/MediaServer/bin"
63 | "/volume2/@appstore/MediaServer/bin"
64 | "/volume3/@appstore/MediaServer/bin"
65 | "/volume1/@appstore/SurveillanceStation/bin"
66 | "/volume2/@appstore/SurveillanceStation/bin"
67 | "/volume3/@appstore/SurveillanceStation/bin"
68 | "/volume1/@appstore/CodecPack/bin"
69 | "/volume2/@appstore/CodecPack/bin"
70 | "/volume3/@appstore/CodecPack/bin"
71 | "/volume1/@appstore/AudioStation/bin"
72 | "/volume2/@appstore/AudioStation/bin"
73 | "/volume3/@appstore/AudioStation/bin"
74 | )
75 |
76 | declare -a versions_list=(
77 | "6.0 7321-0"
78 | "6.0 7321-1"
79 | "6.0 7321-2"
80 | "6.0 7321-3"
81 | "6.0 7321-4"
82 | "6.0 7321-5"
83 | "6.0 7321-6"
84 | "6.0 7321-7"
85 | "6.0.1 7393-0"
86 | "6.0.1 7393-1"
87 | "6.0.1 7393-2"
88 | "6.0.2 8451-0"
89 | "6.0.2 8451-1"
90 | "6.0.2 8451-2"
91 | "6.0.2 8451-3"
92 | "6.0.2 8451-4"
93 | "6.0.2 8451-5"
94 | "6.0.2 8451-6"
95 | "6.0.2 8451-7"
96 | "6.0.2 8451-8"
97 | "6.0.2 8451-9"
98 | "6.0.2 8451-10"
99 | "6.0.2 8451-11"
100 | "6.0.3 8754-0"
101 | "6.0.3 8754-1"
102 | "6.0.3 8754-2"
103 | "6.0.3 8754-3"
104 | "6.0.3 8754-4"
105 | "6.0.3 8754-5"
106 | "6.0.3 8754-6"
107 | "6.0.3 8754-7"
108 | "6.0.3 8754-8"
109 | "6.1 15047-0"
110 | "6.1 15047-1"
111 | "6.1 15047-2"
112 | "6.1.1 15101-0"
113 | "6.1.1 15101-1"
114 | "6.1.1 15101-2"
115 | "6.1.1 15101-3"
116 | "6.1.1 15101-4"
117 | "6.1.2 15132-0"
118 | "6.1.2 15132-1"
119 | "6.1.3 15152-0"
120 | "6.1.3 15152-1"
121 | "6.1.3 15152-2"
122 | "6.1.3 15152-3"
123 | "6.1.3 15152-4"
124 | "6.1.3 15152-5"
125 | "6.1.3 15152-6"
126 | "6.1.3 15152-7"
127 | "6.1.3 15152-8"
128 | "6.1.4 15217-0"
129 | "6.1.4 15217-1"
130 | "6.1.4 15217-2"
131 | "6.1.4 15217-3"
132 | "6.1.4 15217-4"
133 | "6.1.4 15217-5"
134 | "6.1.4 15217-0"
135 | "6.1.5 15254-0"
136 | "6.1.5 15254-1"
137 | "6.1.6 15266-0"
138 | "6.1.6 15266-1"
139 | "6.1.7 15284-0"
140 | "6.1.7 15284-1"
141 | "6.1.7 15284-2"
142 | "6.1.7 15284-3"
143 | "6.2 23739-0"
144 | "6.2 23739-1"
145 | "6.2 23739-2"
146 | "6.2.1 23824-0"
147 | "6.2.1 23824-1"
148 | "6.2.1 23824-2"
149 | "6.2.1 23824-3"
150 | "6.2.1 23824-4"
151 | "6.2.1 23824-5"
152 | "6.2.1 23824-6"
153 | "6.2.2 24922-0"
154 | "6.2.2 24922-1"
155 | "6.2.2 24922-2"
156 | "6.2.2 24922-3"
157 | "6.2.2 24922-4"
158 | "6.2.2 24922-5"
159 | "6.2.2 24922-6"
160 | "6.2.3 25423-0"
161 | "6.2.3 25426-0"
162 | "6.2.3 25426-2"
163 | "6.2.3 25426-3"
164 | "7.0.1 42218-0"
165 | "7.0.1 42218-1"
166 | "7.0.1 42218-2"
167 | "7.0.1 42218-3"
168 | "7.1 42661-0"
169 | "7.1 42661-1"
170 | "7.1 42661-2"
171 | "7.1 42661-3"
172 | "7.1 42661-4"
173 | "7.1.1 42951"
174 | "7.1.1 42962-0"
175 | "7.1.1 42962-1"
176 | "7.1.1 42962-2"
177 | "7.1.1 42962-3"
178 | "7.1.1 42962-4"
179 | "7.1.1 42962-5"
180 | "7.1.1 42962-6"
181 | "7.2 64570-0"
182 | "7.2 64570-1"
183 | "7.2.1 69057-0"
184 | "7.2.1 69057-1"
185 | "7.2.1 69057-2"
186 | "7.2.1 69057-3"
187 | "7.2.1 69057-4"
188 | "7.2.1 69057-5"
189 | )
190 |
191 | #functions
192 | print_usage() {
193 | printf "
194 | SYNOPSIS
195 | patch.sh [-h] [-p|-r|-l]
196 | DESCRIPTION
197 | Patch to enable transcoding without a valid serial in DSM 6+
198 | -h Print this help message
199 | -p Patch synocodectool
200 | -r Restore from original from backup
201 | -l List supported DSM versions
202 | "
203 | }
204 | check_path () {
205 | for i in "${path_list[@]}"; do
206 | if [ -e "$i/$bin_file" ]; then
207 | binpath_list+=( "$i/$bin_file" )
208 | fi
209 | done
210 | }
211 |
212 | check_version () {
213 | local ver="$1"
214 | for i in "${versions_list[@]}" ; do
215 | [[ "$i" == "$ver" ]] && return 0
216 | done || return 1
217 | }
218 |
219 | list_versions () {
220 | for i in "${versions_list[@]}"; do
221 | echo "$i"
222 | done
223 | return 0
224 | }
225 |
226 | patch_menu() {
227 | local options=("$@")
228 | echo "Available binaries to patch/restore:"
229 | local PS3="Please choose which binary you want to patch/restore:"
230 | select option in "${options[@]}" "Quit"; do
231 | if [[ $REPLY = "$(( ${#options[@]}+1 ))" ]] ; then
232 | echo "Goodbye"
233 | exit 0
234 | fi
235 | bin_path="$option"
236 | break
237 | done
238 | }
239 |
240 | restore_menu() {
241 | local options=("$@")
242 | echo "Available backups to restore:"
243 | local PS3="Please choose which binary you want to restore to $bin_path:"
244 | select option in "${options[@]}" "Quit"; do
245 | if [[ $REPLY = "$(( ${#options[@]}+1 ))" ]] ; then
246 | echo "Goodbye"
247 | exit 0
248 | fi
249 | backup_file="$option"
250 | break
251 | done
252 | }
253 |
254 | patch_common () {
255 | source "/etc/VERSION"
256 | dsm_version="$productversion $buildnumber-$smallfixnumber"
257 | if [[ ! "$dsm_version" ]] ; then
258 | echo "Something went wrong. Could not fetch DSM version"
259 | exit 1
260 | fi
261 |
262 | echo "Detected DSM version: $dsm_version"
263 |
264 | if ! check_version "$dsm_version" ; then
265 | echo "Patch for DSM Version ($dsm_version) not found."
266 | echo "Patch is available for versions: "
267 | list_versions
268 | exit 1
269 | fi
270 |
271 | echo "Patch for DSM Version ($dsm_version) AVAILABLE!"
272 | check_path
273 |
274 | if ! (( ${#binpath_list[@]} )) ; then
275 | echo "Something went wrong. Could not find synocodectool"
276 | exit 1
277 | fi
278 |
279 | patch_menu "${binpath_list[@]}"
280 | }
281 |
282 | patch () {
283 | patch_common
284 | local backup_path="${bin_path%??????????????}/backup"
285 | local synocodectool_hash="$(sha1sum "$bin_path" | cut -f1 -d\ )"
286 | if [[ "${binhash_version_list[$synocodectool_hash]+isset}" ]] ; then
287 | local backup_identifier="${synocodectool_hash:0:8}"
288 | if [[ -f "$backup_path/$bin_file.$backup_identifier" ]]; then
289 | backup_hash="$(sha1sum "$backup_path/$bin_file.$backup_identifier" | cut -f1 -d\ )"
290 | if [[ "${binhash_version_list[$backup_hash]+isset}" ]]; then
291 | echo "Restored synocodectool and valid backup detected (DSM ${binhash_version_list[$backup_hash]}) . Patching..."
292 | echo -e "${binhash_patch_list[$synocodectool_hash]}" | xxd -r - "$bin_path"
293 | echo "Patched successfully"
294 | echo "Creating spoofed activation.conf.."
295 | if [ ! -e "$conf_path/$conf_file" ] ; then
296 | mkdir -p $conf_path
297 | echo "$conf_string" > "$conf_path/$conf_file"
298 | chattr +i "$conf_path/$conf_file"
299 | echo "Spoofed activation.conf created successfully"
300 | exit 0
301 | else
302 | chattr -i "$conf_path/$conf_file"
303 | rm "$conf_path/$conf_file"
304 | echo "$conf_string" > "$conf_path/$conf_file"
305 | chattr +i "$conf_path/$conf_file"
306 | echo "Spoofed activation.conf created successfully"
307 | exit 0
308 | fi
309 | else
310 | echo "Corrupted backup and original synocodectool detected. Overwriting backup..."
311 | mkdir -p "$backup_path"
312 | cp -p "$bin_path" \
313 | "$backup_path/$bin_file.$backup_identifier"
314 | exit 0
315 | fi
316 | else
317 | echo "Detected valid synocodectool. Creating backup.."
318 | mkdir -p "$backup_path"
319 | cp -p "$bin_path" \
320 | "$backup_path/$bin_file.$backup_identifier"
321 | echo "Patching..."
322 | echo -e "${binhash_patch_list[$synocodectool_hash]}" | xxd -r - "$bin_path"
323 | echo "Patched"
324 | echo "Creating spoofed activation.conf.."
325 | if [ ! -e "$conf_path/$conf_file" ] ; then
326 | mkdir -p $conf_path
327 | echo "$conf_string" > "$conf_path/$conf_file"
328 | chattr +i "$conf_path/$conf_file"
329 | echo "Spoofed activation.conf created successfully"
330 | exit 0
331 | else
332 | chattr -i "$conf_path/$conf_file"
333 | rm "$conf_path/$conf_file"
334 | echo "$conf_string" > "$conf_path/$conf_file"
335 | chattr +i "$conf_path/$conf_file"
336 | echo "Spoofed activation.conf created successfully"
337 | exit 0
338 | fi
339 | fi
340 | elif [[ "${patchhash_binhash_list[$synocodectool_hash]+isset}" ]]; then
341 | local original_hash="${patchhash_binhash_list[$synocodectool_hash]}"
342 | local backup_identifier="${original_hash:0:8}"
343 | if [[ -f "$backup_path/$bin_file.$backup_identifier" ]]; then
344 | backup_hash="$(sha1sum "$backup_path/$bin_file.$backup_identifier" | cut -f1 -d\ )"
345 | if [[ "$original_hash"="$backup_hash" ]]; then
346 | echo "Valid backup and patched synocodectool detected. Skipping patch."
347 | exit 0
348 | else
349 | echo "Patched synocodectool and corrupted backup detected. Skipping patch."
350 | exit 1
351 | fi
352 | else
353 | echo "Patched synocodectool and no backup detected. Skipping patch."
354 | exit 1
355 | fi
356 | else
357 | echo "Corrupted synocodectool detected. Please use the -r option to try restoring it."
358 | exit 1
359 | fi
360 | }
361 |
362 | rollback () {
363 | patch_common
364 | local backup_path="${bin_path%??????????????}/backup"
365 | local synocodectool_hash="$(sha1sum "$bin_path" | cut -f1 -d\ )"
366 | if [[ "${patchhash_binhash_list[$synocodectool_hash]+isset}" ]] ; then
367 | local original_hash="${patchhash_binhash_list[$synocodectool_hash]}"
368 | local backup_identifier="${original_hash:0:8}"
369 | if [[ -e "$backup_path/$bin_file.$backup_identifier" ]] ; then
370 | local backup_hash="$(sha1sum "$backup_path/$bin_file.$backup_identifier" | cut -f1 -d\ )"
371 | if [[ "$original_hash" = "$backup_hash" ]]; then
372 | cp -p "$backup_path/$bin_file.$backup_identifier" \
373 | "$bin_path"
374 | echo "Backup restored successfully (DSM ${binhash_version_list[$backup_hash]})"
375 | exit 0
376 | else
377 | echo "No valid backup found for patched synocodectool currently in use. You can download the original file for DSM ${binhash_version_list[$original_hash]} from https://github.com/stl88083365/synocodectool-patch/."
378 | exit 1
379 | fi
380 | else
381 | echo "No backups found for patched synocodectool currently in use. You can download the original file for DSM ${binhash_version_list[$original_hash]} from https://github.com/stl88083365/synocodectool-patch/."
382 | exit 1
383 | fi
384 | elif [[ "${binhash_version_list[$synocodectool_hash]+isset}" ]]; then
385 | echo "Detected unpatched original synocodectool. Restoring not neccessary!"
386 | exit 0
387 | else
388 | echo "Detected corrupted synocodectool."
389 | local backup_files=( "$backup_path"/* )
390 | if (( ${#backup_files[@]} )); then
391 | restore_menu "${backup_files[@]}"
392 | echo "Checking Hash.."
393 | local backup_hash="$(sha1sum "$backup_file" | cut -f1 -d\ )"
394 | if [[ "${binhash_version_list[$backup_hash]+isset}" ]]; then
395 | cp -p "$backup_file" \
396 | "$bin_path"
397 | echo "Backup restored successfully (DSM ${binhash_version_list[$backup_hash]})"
398 | exit 0
399 | else
400 | echo "Not a valid backup. You can either try restoring another backup or download the original file for DSM $dsm_version from https://github.com/stl88083365/synocodectool-patch/."
401 | exit 1
402 | fi
403 | else
404 | echo "No backups found. You can download the original file for DSM $dsm_version from https://github.com/stl88083365/synocodectool-patch/."
405 | exit 1
406 | fi
407 | fi
408 | }
409 |
410 | #main()
411 | if (( $EUID != 0 )); then
412 | echo "Please run as root"
413 | exit 1
414 | fi
415 |
416 | while getopts "prhl" flag; do
417 | case "${flag}" in
418 | p) opmode="patch";;
419 | r) opmode="patchrollback" ;;
420 | h) opmode="${opmode}" ;;
421 | l) opmode="listversions" ;;
422 | *) echo "Incorrect option specified in command line" ; exit 2 ;;
423 | esac
424 | done
425 |
426 | case "${opmode}" in
427 | patch) patch ;;
428 | patchrollback) rollback ;;
429 | patchhelp) print_usage ; exit 2 ;;
430 | listversions) list_versions ;;
431 | *) echo "Incorrect combination of flags. Use option -h to get help."
432 | exit 2 ;;
433 | esac
434 |
--------------------------------------------------------------------------------
/synocodectool/original/synocodectool.6.0-7321-0_6.0.3-8754-8.original:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wirgen/synocodectool-patch/1b9b34287e28cf60fc604d432f2d0dd0ac5a04b8/synocodectool/original/synocodectool.6.0-7321-0_6.0.3-8754-8.original
--------------------------------------------------------------------------------
/synocodectool/original/synocodectool.6.1-15047-0_6.1.1-15101-4.original:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wirgen/synocodectool-patch/1b9b34287e28cf60fc604d432f2d0dd0ac5a04b8/synocodectool/original/synocodectool.6.1-15047-0_6.1.1-15101-4.original
--------------------------------------------------------------------------------
/synocodectool/original/synocodectool.6.1.2-15132-0_6.1.3-15152-8.original:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wirgen/synocodectool-patch/1b9b34287e28cf60fc604d432f2d0dd0ac5a04b8/synocodectool/original/synocodectool.6.1.2-15132-0_6.1.3-15152-8.original
--------------------------------------------------------------------------------
/synocodectool/original/synocodectool.6.1.4-15217-0_6.2-23739-2.original:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wirgen/synocodectool-patch/1b9b34287e28cf60fc604d432f2d0dd0ac5a04b8/synocodectool/original/synocodectool.6.1.4-15217-0_6.2-23739-2.original
--------------------------------------------------------------------------------
/synocodectool/original/synocodectool.6.2.1-23824-0_6.2.3-25426-3.original:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wirgen/synocodectool-patch/1b9b34287e28cf60fc604d432f2d0dd0ac5a04b8/synocodectool/original/synocodectool.6.2.1-23824-0_6.2.3-25426-3.original
--------------------------------------------------------------------------------
/synocodectool/original/synocodectool.7.0.1-42216-0_7.0.1-42218-3.original:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wirgen/synocodectool-patch/1b9b34287e28cf60fc604d432f2d0dd0ac5a04b8/synocodectool/original/synocodectool.7.0.1-42216-0_7.0.1-42218-3.original
--------------------------------------------------------------------------------
/synocodectool/original/synocodectool.7.1-42661-0_7.1-42661-0.CodecPack.original:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wirgen/synocodectool-patch/1b9b34287e28cf60fc604d432f2d0dd0ac5a04b8/synocodectool/original/synocodectool.7.1-42661-0_7.1-42661-0.CodecPack.original
--------------------------------------------------------------------------------
/synocodectool/original/synocodectool.7.1-42661-0_7.1-42661-0.original:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wirgen/synocodectool-patch/1b9b34287e28cf60fc604d432f2d0dd0ac5a04b8/synocodectool/original/synocodectool.7.1-42661-0_7.1-42661-0.original
--------------------------------------------------------------------------------
/synocodectool/original/synocodectool.7.1.1-42962-2.original:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wirgen/synocodectool-patch/1b9b34287e28cf60fc604d432f2d0dd0ac5a04b8/synocodectool/original/synocodectool.7.1.1-42962-2.original
--------------------------------------------------------------------------------
/synocodectool/original/synocodectool.7.2-64570-0.original:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wirgen/synocodectool-patch/1b9b34287e28cf60fc604d432f2d0dd0ac5a04b8/synocodectool/original/synocodectool.7.2-64570-0.original
--------------------------------------------------------------------------------
/synocodectool/original/synocodectool.7.2.1-69057-0.original:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wirgen/synocodectool-patch/1b9b34287e28cf60fc604d432f2d0dd0ac5a04b8/synocodectool/original/synocodectool.7.2.1-69057-0.original
--------------------------------------------------------------------------------
/synocodectool/patch/synocodectool.6.0-7321-0_6.0.3-8754-8.patch:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wirgen/synocodectool-patch/1b9b34287e28cf60fc604d432f2d0dd0ac5a04b8/synocodectool/patch/synocodectool.6.0-7321-0_6.0.3-8754-8.patch
--------------------------------------------------------------------------------
/synocodectool/patch/synocodectool.6.1-15047-0_6.1.1-15101-4.patch:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wirgen/synocodectool-patch/1b9b34287e28cf60fc604d432f2d0dd0ac5a04b8/synocodectool/patch/synocodectool.6.1-15047-0_6.1.1-15101-4.patch
--------------------------------------------------------------------------------
/synocodectool/patch/synocodectool.6.1.2-15132-0_6.1.3-15152-8.patch:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wirgen/synocodectool-patch/1b9b34287e28cf60fc604d432f2d0dd0ac5a04b8/synocodectool/patch/synocodectool.6.1.2-15132-0_6.1.3-15152-8.patch
--------------------------------------------------------------------------------
/synocodectool/patch/synocodectool.6.1.4-15217-0_6.2-23739-2.patch:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wirgen/synocodectool-patch/1b9b34287e28cf60fc604d432f2d0dd0ac5a04b8/synocodectool/patch/synocodectool.6.1.4-15217-0_6.2-23739-2.patch
--------------------------------------------------------------------------------
/synocodectool/patch/synocodectool.6.2.1-23824-0_6.2.3-25426-3.patch:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wirgen/synocodectool-patch/1b9b34287e28cf60fc604d432f2d0dd0ac5a04b8/synocodectool/patch/synocodectool.6.2.1-23824-0_6.2.3-25426-3.patch
--------------------------------------------------------------------------------
/synocodectool/patch/synocodectool.7.0.1-42216-0_7.0.1-42218-3.patch:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wirgen/synocodectool-patch/1b9b34287e28cf60fc604d432f2d0dd0ac5a04b8/synocodectool/patch/synocodectool.7.0.1-42216-0_7.0.1-42218-3.patch
--------------------------------------------------------------------------------
/synocodectool/patch/synocodectool.7.1-42661-0_7.1-42661-0.CodecPack.patch:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wirgen/synocodectool-patch/1b9b34287e28cf60fc604d432f2d0dd0ac5a04b8/synocodectool/patch/synocodectool.7.1-42661-0_7.1-42661-0.CodecPack.patch
--------------------------------------------------------------------------------
/synocodectool/patch/synocodectool.7.1-42661-0_7.1-42661-0.patch:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wirgen/synocodectool-patch/1b9b34287e28cf60fc604d432f2d0dd0ac5a04b8/synocodectool/patch/synocodectool.7.1-42661-0_7.1-42661-0.patch
--------------------------------------------------------------------------------
/synocodectool/patch/synocodectool.7.1.1-42962-2.patch:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wirgen/synocodectool-patch/1b9b34287e28cf60fc604d432f2d0dd0ac5a04b8/synocodectool/patch/synocodectool.7.1.1-42962-2.patch
--------------------------------------------------------------------------------
/synocodectool/patch/synocodectool.7.2-64570-0.patch:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wirgen/synocodectool-patch/1b9b34287e28cf60fc604d432f2d0dd0ac5a04b8/synocodectool/patch/synocodectool.7.2-64570-0.patch
--------------------------------------------------------------------------------
/synocodectool/patch/synocodectool.7.2.1-69057-0.patch:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/wirgen/synocodectool-patch/1b9b34287e28cf60fc604d432f2d0dd0ac5a04b8/synocodectool/patch/synocodectool.7.2.1-69057-0.patch
--------------------------------------------------------------------------------