One Thousand Lies .rpa files

Extraction and unpacking of game archives and compression, encryption, obfuscation, decoding of unknown files
wawon0
Posts: 4
Joined: Wed Apr 20, 2016 10:46 pm

One Thousand Lies .rpa files

Post by wawon0 »

aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: One Thousand Lies .rpa files

Post by aluigi »

It's a Ren'Py archive ("RPA-3.0"), so this is the script to use:
http://aluigi.org/bms/rpa_renpy.bms

If you don't have python installed you can use this other script:
http://aluigi.org/bms/rpa_renpy_nopython.bms
bugmenot
Posts: 45
Joined: Sun Oct 09, 2016 6:27 pm

Re: One Thousand Lies .rpa files

Post by bugmenot »

aluigi, any chance you can take a look at https://gofile.io/?c=1Y7GeA and see why it isn't working with the scripts you quoted? A Python based script can unpack the files without a problem but I'd prefer not to have to install it.

P.S. If you'd like a look at the Python script just send me a PM.
Last edited by bugmenot on Fri Mar 03, 2017 7:58 am, edited 1 time in total.
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: One Thousand Lies .rpa files

Post by aluigi »

Ok I have updated the nopython script to version 0.1.2.
Please note that it's still a work-around and not a full implementation but it does the job with the archive you provided.
bugmenot
Posts: 45
Joined: Sun Oct 09, 2016 6:27 pm

Re: One Thousand Lies .rpa files

Post by bugmenot »

Thanks.
bugmenot
Posts: 45
Joined: Sun Oct 09, 2016 6:27 pm

Re: One Thousand Lies .rpa files

Post by bugmenot »

Here is another example where the script doesn't work (if you have the time to check it): link is dead
Last edited by bugmenot on Fri Mar 03, 2017 7:59 am, edited 1 time in total.
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: One Thousand Lies .rpa files

Post by aluigi »

Ok I decided to give up with the work-arounds and finally we have a Python Pickle deserializer that can be implemented in any script, including the RPA one :D
Script 0.2 + http://aluigi.org/bms/pickle.bms
bugmenot
Posts: 45
Joined: Sun Oct 09, 2016 6:27 pm

Re: One Thousand Lies .rpa files

Post by bugmenot »

Do I use it as usual or is there something specific about it?

Code: Select all

  offset   filesize   filename
--------------------------------------
0x00000000 0x00000052
0x00000001 0x00000050 A-3.0 0000000002c2c978 42424242
Made with Ren'Py.‰PNG


Error: unknown opcode 0x00000000 at offset 0x0000003c

- 0 files found in 0 seconds
  coverage file 0     0%   61         46336039   . offset 0000003d
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: One Thousand Lies .rpa files

Post by aluigi »

The script works perfectly with the 2 archives you provided.
Are you using the script with other archives?
bugmenot
Posts: 45
Joined: Sun Oct 09, 2016 6:27 pm

Re: One Thousand Lies .rpa files

Post by bugmenot »

Yes, here is an example: https://gofile.io/?c=YEiXjX

P.S. The old RPA archives (ren.py) (no python version) (script 0.1.2) is working fine for that one.
Last edited by bugmenot on Fri Mar 03, 2017 7:58 am, edited 1 time in total.
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: One Thousand Lies .rpa files

Post by aluigi »

Ok I have updated pickle.bms to version 0.1.1:
http://aluigi.org/bms/pickle.bms

Anyway I have not found the same error you reported, here the only error was the offset/size because LONG1 and LONG4 were not correctly converted to number while in your example I see also problems with the filename.
bugmenot
Posts: 45
Joined: Sun Oct 09, 2016 6:27 pm

Re: One Thousand Lies .rpa files

Post by bugmenot »

The same error with version 0.1.1, here is the file I'm testing with: https://gofile.io/?c=YEiXjX
I'm using quickbms v0.7.7.0 by dragging the bms file over the exe and then selecting the rpa file and the output folder.

Code: Select all

- GUI mode activated, remember that the tool works also from command-line
  where are available various options like folder scanning, filters and so on

- select the input archives/files to extract, type * or "" for whole folder and
subfolders
- select the output folder where extracting the files
- open input file D:\TEMP\archive.rpa
- open script D:\Tools\BMS\Python Pickle parser.bms
- set output folder D:\TEMP\OUT

  offset   filesize   filename
--------------------------------------
0x00000000 0x00000052
0x00000001 0x00000050 A-3.0 0000000002c2f67e 42424242
Made with Ren'Py.‰PNG


Error: unknown opcode 0x00000000 at offset 0x0000003c

- 0 files found in 0 seconds
  coverage file 0     0%   61         46347521   . offset 0000003d

Press ENTER or close the window to quit


Here is an example where the code is partially working: https://gofile.io/?c=pHcQEZ

Code: Select all

SauzerBracers   Armgear Bracers Of Truth        True    0       1       5
0       0       0       0       0.0     0.0     0.0     0.0     0.0     0.0
0.0     0.0     0.0     0.0     0.0     2       ['Sauzer']      100     clothbra
cers01  Cloth armor     True    0
SauzerLeggings  Greaves Leggings Of Truth       True    0       1       8
1       0       0       0       0.0     0.0     0.0     0.0     0.0     0.0
0.0     0.0     0.0     0.0     0.0     4       ['Sauzer']      250     clothleg
gings01 Cloth armor     True    0
ApoCloak        Pauldron        Gwen's Mantle   True    0       0       8
0       10      5       0       0.0     0.0     0.0     0.0     0.0     0.0
0.0     0.0     0.0     0.0     0.0     2       ['Apolimesho']  1500    clothsho
ulder04 Unique cloak usable only by Apolimesho. True    0
AmuShield       Shield  Shield Of The Bear      True    0       -4      25
0       0       0       2       0.0     0.0     0.0     0.0     0.0     0.0
-0.5    0.0     0.0     0.0     0.0     9       ['Amukiki']     1500    roundshi
eld13   Unique shield usable only by Amukiki.   True    0
Made with Ren'Py.‰PNG


Error: unknown opcode 0x00000000 at offset 0x0000f92f

- 0 files found in 0 seconds
  coverage file 0     0%   63792      106762879  . offset 0000f930

Press ENTER or close the window to quit


Here is another example with a different error: https://gofile.io/?c=jUGRZG

Code: Select all

- GUI mode activated, remember that the tool works also from command-line
  where are available various options like folder scanning, filters and so on

- select the input archives/files to extract, type * or "" for whole folder and
subfolders
- select the output folder where extracting the files
- open input file D:\TEMP\archive.rpa
- open script D:\Tools\BMS\Python Pickle parser.bms
- set output folder D:\TEMP\OUT

  offset   filesize   filename
--------------------------------------
0x00000000 0x00000052
0x00000001 0x00000050 A-3.0 00000000032f6413 42424242
Made with Ren'Py.ÿØÿà
Error: unknown opcode 0x00000010 at offset 0x00000038

- 0 files found in 0 seconds
  coverage file 0     0%   57         53454902   . offset 00000039

Press ENTER or close the window to quit


P.S. Links that might be helpful:
https://www.taricorp.net/2014/reverse-engineering-renpy-packages/
https://bitbucket.org/tari/renpy-rv
https://github.com/Lattyware/unrpa/blob/master/unrpa
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: One Thousand Lies .rpa files

Post by aluigi »

Here I have no errors. Everything works perfectly.
I have also checked the md5 of the online scripts and they are correct:
35cf4d7e8d4d31cdd24ea7cd4dcef228 *rpa_renpy_nopython.bms
48d376c5d5849c680f1bbd3779572e33 *pickle.bms
bugmenot
Posts: 45
Joined: Sun Oct 09, 2016 6:27 pm

Re: One Thousand Lies .rpa files

Post by bugmenot »

Now i see what the problem was - I had to use the two files together.

Can you check what's the problem with the attached file (might be corrupt although I don't think so - I used offzip -a file folder 0 to unpack it from the zlib compressed version)

Code: Select all

- GUI mode activated, remember that the tool works also from command-line
  where are available various options like folder scanning, filters and so on

- select the input archives/files to extract, type * or "" for whole folder and
subfolders
- select the output folder where extracting the files
- open input file D:\TEMP\00000000.dat
- open script D:\TEMP\BMS\rpa_renpy_nopython.bms
- set output folder D:\TEMP

  offset   filesize   filename
--------------------------------------
- enter in folder D:\TEMP
- open input file D:\TEMP\00000000.dat
- enter in folder .
  coverage file 0   100%   54479      54471      . offset 00000008
- open input file D:\TEMP\TEMPORARY_FILE
Error: unknown opcode 0x00000000 at offset 0x00000057

- 1 files found in 0 seconds
  coverage file 0     0%   88         54471      . offset 00000058
  coverage file 1     0%   0          54471      . offset 00000000


Code: Select all

- select the input archives/files to extract, type * or "" for whole folder and
subfolders
- select the output folder where extracting the files
- open input file D:\TEMP\00000000.dat
- open script D:\TEMP\BMS\pickle.bms
- set output folder D:\TEMP

  offset   filesize   filename
--------------------------------------
0x00000000 0x00000080 2
0x00000002 0x00000063
0x00000003 0x00000072 2037411429
0x00000008 0x0000002e
0x00000009 0x00000070 ersistent
Persistent
q)q}q(U_seen_translatesqc__builtin__
set
q]q(X
Error: unknown opcode 0x00000000 at offset 0x00000057

- 0 files found in 0 seconds
  coverage file 0     0%   88         54471      . offset 00000058


P.S. Thanks for all the time you spent on this.
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: One Thousand Lies .rpa files

Post by aluigi »

bugmenot wrote:Now i see what the problem was - I had to use the two files together.

What you mean?
Both rpa_renpy_nopython.bms and pickle.bms must be in the same folder yes.

Just a note, I did a test by using quickbms in GUI mode (double click on quickbms.exe) and the only error I had was with the (re)loading of the input file, something that I'm going to fix in the next version.

What's the file 00000000.dat you attached and why did you try to open it with quickbms?
It's not a rpa file.
If you got it from the extraction of the rpa archives, it's ok. I noticed it too and in fact there is a nameless file as first file. You get the same result by using the python version of the script.
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: One Thousand Lies .rpa files

Post by aluigi »

Ah ok probably that file you attached is directly the TOC.
Let me check.
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: One Thousand Lies .rpa files

Post by aluigi »

pickle.bms 0.1.2, there was an opcode (GLOBAL) not instructed to read data
bugmenot
Posts: 45
Joined: Sun Oct 09, 2016 6:27 pm

Re: One Thousand Lies .rpa files

Post by bugmenot »

aluigi wrote:Both rpa_renpy_nopython.bms and pickle.bms must be in the same folder yes.
Yes but I had renamed the pickle one so it wasn't working with ether one of them.

Great work, thanks but it seems there is more opcode's missing: Error: unknown opcode 0x00000088 at offset 0x000011d1
aluigi
Site Admin
Posts: 12984
Joined: Wed Jul 30, 2014 9:32 pm

Re: One Thousand Lies .rpa files

Post by aluigi »

Yes, you are right.
pickle.bms 0.1.3 and I have also changed one word in rpa_renpy_nopython.bms 0.2a due to a modification of the pickle script to avoid problems with the variable names of other scripts using it (currently none).
bugmenot
Posts: 45
Joined: Sun Oct 09, 2016 6:27 pm

Re: One Thousand Lies .rpa files

Post by bugmenot »

Shouldn't OPCODE PICKLE_NEWTRUE be DATA = 1 instead of 0?