Rappelz Data unpack/pack (beta, sources included)

04/24/2012 22:07 glandu2#1
After some data exploration and launcher disassemble i discover how to decrypt rappelz data files

After disassemble/ildasm Folder2Name from Xijezu ([Only registered and activated users can see links. Click Here To Register...]) i also found how to decrypt rappelz hash to file names (and name to hash)

Xijezu thanks a lot for your program else i would not have discovered hash & name convertion so quickly :)

With these algorithm, i was able to unpack any files in data.00x so i made a [Only registered and activated users can see links. Click Here To Register...] plugin (TCPlugin.wcx in the archive)

Here is all sources used to open rappelz files (compile ok with [Only registered and activated users can see links. Click Here To Register...])

Algorithm for hash to name is in HashToName.c
Algorithm for name to hash is in NameToHash.c
Algorithm for decrypt encrypted files is in RappelzDecrypt.c

ConvertNameHash, RappelzDataUnpacker, RappelzDecryptFile is source for an .exe
HashToName, NameToHash, RappelzDataManager.c, RappelzDecrypt.c are source for static library files
TCPlugin.c is the source of the plugin for Total commander (dynamic link library, rename it .WCX to use it with Total commander)

RappelzDataManager.c need HashToName.lib, NameToHash.lib, RappelzDecrypt.lib
RappelzDecryptFile.c need RappelzDecrypt.lib
ConvertNameHash.c need HashToName.lib, NameToHash.lib
TCPlugin.c need RappelzDataManager.lib
RappelzDataUnpacker.c need RappelzDataManager.lib

The doc/html folder contains documentation (mostly RappelzDataManager.c) in french only (sorry, didn't translated it yet) (Created with [Only registered and activated users can see links. Click Here To Register...])


Hope this help :)

If you have any suggestion, please post :cool:
04/25/2012 07:07 ptifou78#2
Bien joué mec =) Si tu veux je traduirais le fichier d'aide en anglais quand j'aurais le temps. En tout cas beau taff et merci beaucoup =D
04/25/2012 10:31 haxti#3
Quote:
Originally Posted by ptifou78 View Post
Bien joué mec =) Si tu veux je traduirais le fichier d'aide en anglais quand j'aurais le temps. En tout cas beau taff et merci beaucoup =D
I don't think you need to translate this. Ppl who know how to write a program will know how to use the stuff provided.

(Im impressed. I'm still able to read some french stuff, but I won't try to write anything xD)
04/25/2012 17:07 DrakuLL777#4
Than to open format rdb files?
04/25/2012 19:00 glandu2#5
Yes these rdb files should be easy to read, i didn't see if there is column's names, but this would be a different project, i would begin to convert these rdb files to csv files (or tsv) allowing easy data processing with openoffice (or other spreadsheet) and then other file type and direct database table creation/modif

A rappelz data defragmenter would be nice also, for who add and remove many files ^^ The addFile function may be improved more by checking if there is empty space in the data files before adding it at the end

Thanks for your posts

[EDIT]
I just see what does look like rdb files, there are like this:

8 char: modification date ? (YYYYDDMM)
120 bytes with value 0
4 byte integer: record number in the file
record_number*[record]

where [record] is a line in the database, there is no info about what columns there is in a record, maybe these information is in another file ...

(db_localcommand.rdb does not seems to follow these rules)
04/26/2012 12:02 DrakuLL777#6
hmm I tried to open rdb in SQLiteManager, asks the password!
04/26/2012 14:20 glandu2#7
a rdb file does not provide columns information, with only the rdb file, you cant extract columns name and data because you don't even know if the data is a string are integers, ..., you can only know how many records there is and the size of a record but not how the data is organized so i doubt that SQLiteManager could open these file even with a password
04/26/2012 15:37 DrakuLL777#8
In any case it is necessary to open rdb files, it is possible still to try to open in Oralcle as it too works with rdb files and I consider that rdb are database files, let know if at you that be it will turn out!
04/26/2012 16:28 glandu2#9
rdb seems to be only a special database file created by rappelz devs, i think also that the server do not use columns name so there would no need to know columns names, that would explain why there is no column name in rdb files

using arcadia database from private servers it's possible to recognize how data is saved in rdb files. That would be surprising for me to know a non rappelz related program able to open these files
04/26/2012 16:39 |\| /\ /< `/ ()#10
first 128 byte is header, next 4 bytes is row count, rest is data, mostly if not all begin with id or sid as in db, though it doesnt have to be the same colum order as in db, they kinda mixed up :)
04/26/2012 16:46 ptifou78#11
nulled
04/26/2012 20:33 glandu2#12
yetersday and today i worked on the db_item.rdb, many columns, i hope others have less columns x)

and the record for db_item.rdb is (with maybe some error but it should not):

Code:
INT32 id;
INT32 name_id;
INT32 type;
INT32 group;
INT32 class;
INT32 set_id;
INT32 set_part_flag;
INT8 grade;
INT32 rank;
INT32 level;
INT32 enhance;
INT32 socket;
INT32 status_flag;
INT8 job_depth;
INT32 use_min_level;
INT32 use_max_level;
INT32 target_min_level;
INT32 target_max_level;
INT32 range;	// value/100 = range
FLOAT32 weight;
INT32 price;
INT32 huntaholic_point;
INT32 ethereal_durability;
INT32 endurance;
INT32 wear_type;
union {	//the wear_limit_bits and the struct share the same bits
	UINT32 wear_limit_bits;
	struct {
		unsigned int : 1;
		unsigned int : 1;
		unsigned int limit_deva : 1;
		unsigned int limit_asura : 1;
		unsigned int limit_gaia : 1;
		unsigned int : 1;
		unsigned int : 1;
		unsigned int : 1;
		unsigned int : 1;
		unsigned int : 1;
		unsigned int limit_fighter : 1;
		unsigned int limit_hunter : 1;
		unsigned int limit_magician : 1;
		unsigned int limit_summoner : 1;
		unsigned int : 1;
		unsigned int : 1;
		unsigned int : 16;
	};
};

INT32 item_use_flag;
INT32 item_use_flag2;
INT32 material;
INT32 summon_id;
INT32 throw_range;
INT16 base_type_0;
INT16 base_type_1;
INT16 base_type_2;
INT16 base_type_3;
FLOAT64 base_var1_0;
FLOAT64 base_var1_1;
FLOAT64 base_var1_2;
FLOAT64 base_var1_3;
FLOAT64 base_var2_0;
FLOAT64 base_var2_1;
FLOAT64 base_var2_2;
FLOAT64 base_var2_3;
INT16 opt_type_0;
INT16 opt_type_1;
INT16 opt_type_2;
INT16 opt_type_3;
FLOAT64 opt_var1_0;
FLOAT64 opt_var1_1;
FLOAT64 opt_var1_2;
FLOAT64 opt_var1_3;
FLOAT64 opt_var2_0;
FLOAT64 opt_var2_1;
FLOAT64 opt_var2_2;
FLOAT64 opt_var2_3;
INT32 effect_id;
INT16 enhance_0_id;
INT16 enhance_1_id;
FLOAT32 enhance_0_01;
FLOAT32 enhance_0_02;
FLOAT32 enhance_0_03;
FLOAT32 enhance_0_04;
FLOAT32 enhance_1_01;
FLOAT32 enhance_1_02;
FLOAT32 enhance_1_03;
FLOAT32 enhance_1_04;
INT32 skill_id;
INT32 state_id;
INT32 state_level;
INT32 state_time;
INT32 cool_time;
INT16 cool_time_group;
INT32 available_period;
INT8 decrease_type;	//maybe INT16 as unknownValue0 is always 0 in db_item.rdb)
INT8 unknownValue0;	//always 0
INT16 unknownValue1; //always 49
INT32 model_type_dem;
INT32 model_type_def;
INT32 model_type_asm;
INT32 model_type_asf;
INT32 model_type_gam;
INT32 model_type_gaf;
INT8 deco_model_change;
char model_00[256];
char model_01[256];
char model_02[256];
char model_03[256];
char model_04[256];
char model_05[256];
char model_06[256];
char model_07[256];
char model_08[256];
char model_09[256];
char model_10[256];
char model_11[256];
char model_12[256];
char model_13[256];
char model_14[256];
char model_15[256];
char model_16[256];
char model_17[256];
char texture_filename[256];
char drop_type[256];
char unknownValue2[3];	//always 'Cat'
INT32 icon_id;
char icon_file_name[256];
char script_text[512];
INT32 tooltip_id;
04/26/2012 21:26 fouad1979#13
i see we have another xijezu here :) good work brother keep it up
04/26/2012 21:56 glandu2#14
i simple, just have brain, eyes with OCR, hands, pc with screen and keyboard, internet connection (optional but recommended) :D
*already far far away*

Xijezu has decrypted rappelz i think without any other programs than launcher.exe and sframe.exe so he has done harder job, but rappelz internals remains secret ... that's not cool, why work on things that someone else has already done, progress is difficult without knowledge sharing

so, open source ftw


db_string.rdb record:
Code:
INT32 name_length;
INT32 value_length;
char *name;	//name size in byte = name_length (including ending 0)
char *value;	//value size in byte = value_length (including ending 0)
INT32 code;
INT32 group_id;
INT32 unknownValue0[4];	//seems to be always 0
04/26/2012 22:14 Xijezu#15
Quote:
Originally Posted by glandu2 View Post
i simple, just have brain, eyes with OCR, hands, pc with screen and keyboard, internet connection (optional but recommended) :D
so, open source ftw
The Problem is:
How many people do understand this from e*pvp (excluded NCarbon-Members and myself)?
You, Pitfou, 2-3 other, that's it.

What are they gonna do when you finished giving them things which are working?
They're kickin' your ass and say that you should gtfo.

But when they need help again, they come back and beg again. ;)