-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Not an issue, but a question #70
Comments
You were looking at an obfuscated compressed stream. Yesterday I was dealing with files unpacking and made an auxiliary tool. Next, the first 128 bytes from the trace files at the decompression stages. char.vromfs.bin
deobfuscate: data.zstd
unzstd: data
|
I see, that makes sense. Thank you! |
@kotiq Could you help me a bit more?
Once it works - I want to publish C# implementation on Github as well. I speak Russian as well |
Используется фреймворк Construct, сам python прост. 1В таблице строк подряд идет пара чисел в ULEB128 число строк в таблице и размер блока строк в байтах. 2Тонкий файл начинается с 0 байта.
Длинные значения в случае тонкого файла у последовательностей из 2- и 3- целых и 2-, 3-, 4-, 12- рациональных и у длинного целого как 8 байт LE.
По числу подсекций берутся подсекции из таблицы описания подсекций подряд, начиная с указанного индекса первого блока. Аналогично параметрам, для нетривиальной корневой секции в соответствии с обходом секции в ширину:
|
В качестве иллюстрации я упакую простую секцию как тонкую и распакую ее обратно вручную.
Ей будет соответствовать множество двоичных представлений, которые различаются из-за различных обходов секции при
И сама секция имеет представление:
Таблица строк.
Секция.
Блок значений длинных параметров.
Таблица описания параметров.
Таблица описания секций.
Построение таблицы параметров из таблицы строк, блока значений длинных параметров и таблицы описания параметров.
Построение секций из таблицы строк, таблицы параметров и таблицы описания секций. Буду обходить таблицу описания секций снизу вверх.
Подсекции
Корневая секция
|
Recently I have found an interesting project called Kaitai, they are collaborating with construct developers to enable import of python struct code to their format, but it's not available yet.
I have been trying to port it myself, so the formats would not be tied to python, but I have run into some issues trying to understand the format.
Here is what the file looks like:

I have to read the values after the file has been parsed and discovered that :
data_start_offset
is equal to0
filename_table_offset
is equal to32
files_count
is equal to23
filedata_table_offsed
is equal to672
I don't understand why Tell is returning 0 in this case, since the pointer would have moved, after reading the header.
I also don't understand where the 32 is coming from.
I'm assuming the
00 00 00
is the tail fromzstd_stream
, then there is17 00
which translated to23
, but I would expect a 4 byte integer, not just 2 bytesAfter this 23, there is
a0 02
it translates to672
, which also fits the number I need, but it's 2 bytes wide again.It also contradicts the
Seek(8,1)
lineI have tried searching entire file for a a 32 bit, unsigned, little-endian integer equal to 672 and found nothing.
The section after

after_obfs
does not seem to contain any of those numbers.I have also tried to look for a "visualizer" for python's construct, to better understand the relation between the structure description and file contents location, but was unable to find any.
Could you please explain at least some of those issues?
I would really appreciate it.
I could translate this to Russian if it's necessary.
The text was updated successfully, but these errors were encountered: