|
You last visited: Today at 18:01
Advertisement
Great Work!!!! Keep it Up!!!!
Discussion on Great Work!!!! Keep it Up!!!! within the Rappelz Private Server forum part of the Rappelz category.
02/04/2013, 14:53
|
#46
|
elite*gold: 0
Join Date: May 2008
Posts: 47
Received Thanks: 10
|
db_stringus(ascii).rdb
Hi all,
in the SPOILER you can find the structorian strs definition for the above rdb file.
[filemask="db_stringus(ascii).rdb"]
struct HEADER {
str [len=128] date;
u32 records;
child ENTRY;
}
struct ENTRY {
u32 code;
i32 group_id;
str [len=1024] name_id;
str [len=1024] value;
if (CurOffset < FileSize) {
sibling;
}
}
More to come...
I am back with a php class for reading binary files according to their struct(orian)...
It is still under heavy development...
<?php
class structorian {
public $fd = NULL;
public $mode = NULL;
public function __construct($filename, $mode = "rb") {
$this->mode = $mode;
switch($mode) {
case "wb":
$this->fd = fopen($filename, $mode);
break;
default:
$this->fd = fopen($filename, $mode);
break;
}
}
public function read($dataType = NULL, $count = NULL) {
$data = NULL;
if((!!$this->fd) && (!feof($this->fd))) {
switch ($dataType) {
case "i8":
$data = unpack("ci8", fread($this->fd, 1))['i8'];
break;
case "i16":
$data = unpack("si16", fread($this->fd, 2))['i16'];
break;
case "i32":
$data = unpack("ii32", fread($this->fd, 4))['i32'];
break;
case "ichar":
$data = chr(unpack("cchar", fread($this->fd, 1))['char']);
break;
case "u8":
$data = unpack("Cu8", fread($this->fd, 1))['u8'];
break;
case "u16":
$data = unpack("Su16", fread($this->fd, 2))['u16'];
break;
case "u32":
$data = unpack("Iu32", fread($this->fd, 4))['u32'];
break;
case "char":
case "uchar":
$data = chr(unpack("Cchar", fread($this->fd, 1))['char']);
break;
case "str":
case "cstr":
$data = unpack("a".$count."str", fread($this->fd, $count))['str'];
break;
case "float":
$data = unpack("ffloat", fread($this->fd, 4))['float'];
break;
case "double":
$data = unpack("ddouble", fread($this->fd, 8))['double'];
break;
default:
break;
}
}
return $data;
}
public function __destruct() {
if(!!$this->fd) return fclose($this->fd);
}
/*
public function x8() {
}
public function x16() {
}
public function x32() {
}
public function bits8() {
}
public function bits16() {
}
public function bits32() {
}
public function enum8() {
}
public function enum16() {
}
public function enum32() {
}
public function set8() {
}
public function set16() {
}
public function set32() {
}
public function wstr() {
}
public function wchar() {
}
*/
}
$a = new structorian("db_string(ascii).rdb");
echo "/* Date: ". $a->read("str", 128). " */\n";
echo "/* Records: ". $a->read("u32"). " */\n";
while(!feof($a->fd)) {
$counter_1 = $a->read("u32");
$counter_2 = $a->read("u32");
echo $a->read("str", $counter_1). "|";
echo $a->read("str", $counter_2). "|";
echo $a->read("u32"). "|";
echo $a->read("i32"). "|";
echo $a->read("u32"). "|";
echo $a->read("u32"). "|";
echo $a->read("u32"). "|";
echo $a->read("u32"). "\n";
}
$b = new structorian("db_stringus(ascii).rdb");
echo "/* Date: ". $b->read("str", 128). " */\n";
echo "/* Records: ". $b->read("u32"). " */\n";
while(!feof($b->fd)) {
echo $b->read("u32"). "|";
echo $b->read("i32"). "|";
echo $b->read("str", 1024). "|";
echo $b->read("str", 1024). "\n";
}
?>
Skamorzo!
|
|
|
02/06/2013, 05:36
|
#47
|
elite*gold: 0
Join Date: Nov 2011
Posts: 103
Received Thanks: 11
|
Skamorzo,
You can use the content of the DB (arcadia) to figure out the structure of the content of the RDBs and other flies on the client, it helps a lot.
Also, if you're really willing to use structorian AND a web language, maybe you should take a look into the c# version of structorian made by Yole (on google code). You might have the full power of structorian combined with whatever web you feel like doing.
|
|
|
02/06/2013, 09:44
|
#48
|
elite*gold: 0
Join Date: May 2008
Posts: 47
Received Thanks: 10
|
Nice info...
@sadkingbilly: Thanks a lot, I will have a look at this proggy later this evening.
uhm... interesting.
Skamorzo.
|
|
|
02/08/2013, 12:26
|
#49
|
elite*gold: 0
Join Date: May 2008
Posts: 47
Received Thanks: 10
|
PHP Binary file read/write
Hi there,
this php class need still some optimization, but it reads and writes binary files using the same (more or less) structorian datatypes...
PHP Code:
<?php class structorian { public $fd = NULL; public $mode = NULL; public function __construct($filename, $mode = "rb") { $this->mode = $mode; switch($mode) { case "wb": $this->fd = fopen($filename, $mode); break; default: $this->fd = fopen($filename, $mode); break; } } public function read($dataType = NULL, $count = NULL) { $data = NULL; if(! feof($this->fd)) { switch ($dataType) { case "i8": $data = @unpack("ci8", @fread($this->fd, 1))['i8']; break; case "i16": $data = @unpack("si16", @fread($this->fd, 2))['i16']; break; case "i32": $data = @unpack("ii32", @fread($this->fd, 4))['i32']; break; case "ichar": $data = chr(@unpack("cchar", @fread($this->fd, 1))['char']); break; case "u8": $data = @unpack("Cu8", @fread($this->fd, 1))['u8']; break; case "u16": $data = @unpack("Su16", @fread($this->fd, 2))['u16']; break; case "u32": $data = @unpack("Iu32", @fread($this->fd, 4))['u32']; break; case "char": case "uchar": $data = chr(@unpack("Cchar", @fread($this->fd, 1))['char']); break; case "str": case "cstr": $data = @unpack("a{$count}str", @fread($this->fd, $count))['str']; break; case "float": $data = @unpack("ffloat", @fread($this->fd, 4))['float']; break; case "double": $data = @unpack("ddouble", @fread($this->fd, 8))['double']; break; case "x8": /* Still not implemented */ case "x16": /* Still not implemented */ case "x32": /* Still not implemented */ case "bits8": /* Still not implemented */ case "bits16": /* Still not implemented */ case "bits32": /* Still not implemented */ case "enum8": /* Still not implemented */ case "enum16": /* Still not implemented */ case "enum32": /* Still not implemented */ case "set8": /* Still not implemented */ case "set16": /* Still not implemented */ case "set32": /* Still not implemented */ case "wstr": /* Still not implemented */ case "wchar": /* Still not implemented */ break; default: /* No default action for now */ break; } } return $data; } public function write($dataType = NULL, $data = NULL, $count = NULL) { $status = NULL; if(($this->fd !== NULL) && ($data !== NULL)) { switch ($dataType) { case "i8": $status = fwrite($this->fd, pack("c", $data)); break; case "i16": $status = fwrite($this->fd, pack("s", $data)); break; case "i32": $status = fwrite($this->fd, pack("i", $data)); break; case "ichar": $status = fwrite($this->fd, pack("c", $data)); break; case "u8": $status = fwrite($this->fd, pack("C", $data)); break; case "u16": $status = fwrite($this->fd, pack("S", $data)); break; case "u32": $status = fwrite($this->fd, pack("I", $data)); break; case "char": case "uchar": $status = fwrite($this->fd, pack("C", $data)); break; case "str": case "cstr": $status = fwrite($this->fd, pack("a{$count}", $data)); break; case "float": $status = fwrite($this->fd, pack("f", $data)); break; case "double": $status = fwrite($this->fd, pack("d", $data)); break; default: break; } } return $status; } public function __destruct() { if($this->fd) { fclose($this->fd); unset($this->fd); unset($this->mode); } return true; } } /* $a = new structorian("db_string(ascii).rdb"); $b = new structorian("db_string(bscii).rdb", "wb"); if(! feof($a->fd)) $b->write("str", $a->read("str", 128), 128); if(! feof($a->fd)) $b->write("u32", $a->read("u32")); while(! feof($a->fd)) { if(! feof($a->fd)) $counter_1 = $a->read("u32"); if(! feof($a->fd)) $counter_2 = $a->read("i32"); if(! feof($a->fd)) $b->write("u32", $counter_1); if(! feof($a->fd)) $b->write("u32", $counter_2); if(! feof($a->fd)) $b->write("str", $a->read("str", $counter_1), $counter_1); if(! feof($a->fd)) $b->write("str", $a->read("str", $counter_2), $counter_2); if(! feof($a->fd)) $b->write("u32", $a->read("u32")); if(! feof($a->fd)) $b->write("i32", $a->read("i32")); if(! feof($a->fd)) $b->write("u32", $a->read("u32")); if(! feof($a->fd)) $b->write("u32", $a->read("u32")); if(! feof($a->fd)) $b->write("u32", $a->read("u32")); if(! feof($a->fd)) $b->write("u32", $a->read("u32")); } unset($b); unset($a); $a = new structorian("db_stringus(ascii).rdb"); $b = new structorian("db_stringus(bscii).rdb", "wb"); if(! feof($a->fd)) $b->write("str", $a->read("str", 128), 128); if(! feof($a->fd)) $b->write("u32", $a->read("u32")); while(! feof($a->fd)) { if(! feof($a->fd)) $b->write("u32", $a->read("u32")); if(! feof($a->fd)) $b->write("i32", $a->read("i32")); if(! feof($a->fd)) $b->write("str", $a->read("str", 1024), 1024); if(! feof($a->fd)) $b->write("str", $a->read("str", 1024), 1024); } unset($b); unset($a); */ ?>
Ciao,
Skamorzo...
|
|
|
02/26/2013, 11:42
|
#50
|
elite*gold: 0
Join Date: May 2008
Posts: 47
Received Thanks: 10
|
Strs wanted...
Hi all,
I need an helping hand from you: what is the right flow to get all the database fields named right? As you know I am playing with RDB... trying to find out their structure, but now I need to know the way to name these fields I am discovering.
CaptainHerlockServer.pdb and then ???
Thanks a lot for your answers.
Regards,
Skamorzo.
PS. I am playing with 6.2 server files... and if it is possible, may I have the .strs files for 6.2? ^.^
Ciao...
|
|
|
02/26/2013, 23:24
|
#51
|
elite*gold: 0
Join Date: Oct 2010
Posts: 2,555
Received Thanks: 2,458
|
The RDB's normally follow a similar if not precise database structure. But some rdb's do not play nice (quest.rdb etc..)
The only way to build an RDB reader is to literally go into the rdb and translate it as you go using the DB counterpart as a pseudo-guide. Contact me via Skype and I'll let you at our Senior Tool Programmer he should be able to provide you in-depth insight into creating methods of reading the rdbs.
|
|
|
02/27/2013, 18:00
|
#52
|
elite*gold: 0
Join Date: May 2008
Posts: 47
Received Thanks: 10
|
Thank you as always!!!!
Thanks iSmokedRow...
I will try to contact you once at home.
The problem for me is the jetleg: I am at least 6 hours ahead from you.
As always,
Ciao... Skamorzo.
|
|
|
02/27/2013, 23:25
|
#53
|
elite*gold: 0
Join Date: Nov 2011
Posts: 103
Received Thanks: 11
|
Nulled;
|
|
|
03/11/2013, 10:54
|
#54
|
elite*gold: 0
Join Date: May 2008
Posts: 47
Received Thanks: 10
|
[Release] RappelzHash php class...
Hi all,
I have taken the work of and recoded it into a php class...
Keep up the great Work!!!! And this community... of course.
PHP Code:
<?php /* Author: Skamorzo */ /* To: elitepvpers.com - Rappelz Private Server Teams */ /* This code is intended only for educational use. Use it at your own risk! */ /* All trademarks and copyrights belong to their respective owners */ define("LEGACY_SEED", -1); define("ENCRYPT", 0x00, true); define("DECRYPT", 0x01, true); class rappelzHash { public $name = NULL; public $hash = NULL; private $decryptLastCharTable = "^&T_Nsd{xo5v`rOYV+,iIU#kCJq8$'~L0P]FeBn-Au(pXHZhwDy2}agWG7K=bQ;SRt)46l@jE%9!c1[3fmMz"; /* private $decryptLastCharTable = array ( 0x5e, 0x26, 0x54, 0x5f, 0x4e, 0x73, 0x64, 0x7b, 0x78, 0x6f, 0x35, 0x76, 0x60, 0x72, 0x4f, 0x59, 0x56, 0x2b, 0x2c, 0x69, 0x49, 0x55, 0x23, 0x6b, 0x43, 0x4a, 0x71, 0x38, 0x24, 0x27, 0x7e, 0x4c, 0x30, 0x50, 0x5d, 0x46, 0x65, 0x42, 0x6e, 0x2d, 0x41, 0x75, 0x28, 0x70, 0x58, 0x48, 0x5a, 0x68, 0x77, 0x44, 0x79, 0x32, 0x7d, 0x61, 0x67, 0x57, 0x47, 0x37, 0x4b, 0x3d, 0x62, 0x51, 0x3b, 0x53, 0x52, 0x74, 0x29, 0x34, 0x36, 0x6c, 0x40, 0x6a, 0x45, 0x25, 0x39, 0x21, 0x63, 0x31, 0x5b, 0x33, 0x66, 0x6d, 0x4d, 0x7a ); */ private $decryptTablePhase2 = array( 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x67, 0x20, 0x00, 0x26, 0x77, 0x2C, 0x6C, 0x4E, 0x58, 0x4F, 0x00, 0x37, 0x2E, 0x25, 0x65, 0x00, 0x38, 0x5F, 0x5D, 0x23, 0x50, 0x31, 0x2D, 0x24, 0x56, 0x5B, 0x00, 0x59, 0x00, 0x5E, 0x00, 0x00, 0x4B, 0x7D, 0x6A, 0x30, 0x40, 0x47, 0x53, 0x29, 0x41, 0x78, 0x79, 0x36, 0x39, 0x45, 0x46, 0x7B, 0x57, 0x62, 0x3D, 0x52, 0x76, 0x74, 0x68, 0x32, 0x34, 0x4D, 0x28, 0x6B, 0x00, 0x6D, 0x61, 0x2B, 0x7E, 0x44, 0x27, 0x43, 0x21, 0x4A, 0x49, 0x64, 0x42, 0x55, 0x60, 0x71, 0x66, 0x70, 0x48, 0x51, 0x33, 0x4C, 0x6E, 0x6F, 0x5A, 0x69, 0X72, 0x73, 0x75, 0x3B, 0x7A, 0x63, 0x00, 0x54, 0x35, 0x00 ); public function __construct($what, $action) { switch($action) { case 0x01: $this->hash = $what; $reducedHash = substr($this->hash, 1, -1); $this->swapPositions($reducedHash); echo "reducedHash: $reducedHash, decryptLastChar: ". $this->decryptLastChar($what[strlen($what)-1]). "\n"; $this->decryptHash($reducedHash, $this->decryptLastChar($what[strlen($what)-1])); echo "reducedHash: $reducedHash\n"; $this->name = $reducedHash; break; case 0x00: $this->name = $what; $encodeSeed = $this->computeLegacySeed($what); $reducedHash = $this->name; $this->encryptName($reducedHash, $encodeSeed); $this->swapPositions($reducedHash); $this->hash = $reducedHash. $this->decryptLastCharTable[$encodeSeed]; $this->hash = $this->computeFirstChar($reducedHash). $this->hash; for($i = 0; $i < strlen($this->decryptLastCharTable); $i++) { echo "decryptLastCharTable[$i]= ". sprintf("%x", ord($this->decryptLastCharTable[$i])). "(". $this->decryptLastCharTable[$i]. ")\n"; } break; } } private function swapPositions(&$hash) { echo "medianPt13: ". ($medianPt13 = (int)floor(0.33*strlen($hash))). "[". $hash[$medianPt13]. "]\n"; echo "medianPt23: ". ($medianPt23 = (int)floor(0.66*strlen($hash))). "[". $hash[$medianPt23]. "]\n"; $val1 = $hash[$medianPt23]; $val2 = $hash[$medianPt13]; $hash[$medianPt23] = $hash[0]; $hash[$medianPt13] = $hash[1]; $hash[0] = $val1; $hash[1] = $val2; } private function decryptLastChar($c) { for($i = 0; $i < 0x55; $i++) if($this->decryptLastCharTable[$i] == $c) break; return $i; } private function decryptHash(&$hash, $decodeSeed) { $computeLoop = $decodeSeed; for($i = 0; $i < strlen($hash); $i++) { $computeVar = ord($hash[$i]); for($j = 0; $j < $computeLoop; $j++) { for($k = 0; $k < 0x80; $k++) if($this->decryptTablePhase2[$k] == $computeVar) break; if($k < 0x80) $computeVar = $k; else $computeVar = 0xFF; } $hash[$i] = chr($computeVar); echo "Hash: $hash\n"; $computeLoop = (1 + $computeLoop + 17 * $computeVar) & 0x1F; if($computeLoop == 0) $computeLoop = 0x20; echo " computeLoop: $computeLoop, computeVar: $computeVar\n"; } } private function encryptName(&$name, $encodeSeed) { $computeLoop = $encodeSeed; for($i = 0; isset($name[$i]); $i++) { $computeVar = ord($name[$i]); for($j =0; $j < $computeLoop; $j++) $computeVar = $this->decryptTablePhase2[$computeVar]; $computeLoop = (1 + $computeLoop + 17 * ord($name[$i])) & 0x1F; if($computeLoop == 0) $computeLoop = 0x20; $name[$i] = chr($computeVar); echo " computeVar: $computeVar, computeLoop: $computeLoop\n"; } } private function computeLegacySeed(&$name) { for($i = 0, $computeVar = 0; isset($name[$i]); $i++) $computeVar = ord($name[$i]) * 17 + $computeVar + 1; $computeVar = ($i + $computeVar) & 0x1F; echo " computeVar: $computeVar\n"; if($computeVar == 0) return 0x20; else return $computeVar; } private function computeFirstChar(&$reducedHash) { for($i = 0, $computeVar = 0; isset($reducedHash[$i]); $i++) $computeVar = ord($reducedHash[$i]) + $computeVar; echo " computeVar: ". $computeVar. "[". ($computeVar % 0x54). "]{". $this->decryptLastCharTable[$computeVar % 0x54]. "}\n"; return $this->decryptLastCharTable[$computeVar % 0x54]; } } $prova = new rappelzHash($id_enc, DECRYPT); echo "\n$prova->name: $prova->hash\n"; unset($prova); $avorp = new rappelzHash("db_string(ascii).rdb", ENCRYPT); echo "\n$avorp->hash: $avorp->name\n"; unset($avorp); ?>
Ciao,
Skamorzo!
|
|
|
03/15/2013, 10:47
|
#55
|
elite*gold: 0
Join Date: May 2008
Posts: 47
Received Thanks: 10
|
To Xijezu...
Quote:
Originally Posted by Xijezu
Yup, I do.
It is released somewhere, but useless since 7.3.
Think about it, maybe you'll know what I mean, I won't support cash shops.
|
I have tried all types of decrypt function I know... but without any success... I give up, unless you can give me some starting point...
id=16EE69E8CE61B4468B5DC542276EC958697554C8
Thanks,
Ska...
|
|
|
03/19/2013, 11:51
|
#56
|
elite*gold: 0
Join Date: May 2008
Posts: 47
Received Thanks: 10
|
[RELEASE]: rdb_discoverer.php
Hi there,
I would like to share with you this interface I wrote in order to discover the rdb structure to test it with structorian.
structorian.php - Binary File READ/WRITE functions Main class
PHP Code:
<?php /* Author: Skamorzo */ /* To: elitepvpers.com - Rappelz Private Server Teams */ /* This code is intended only for educational use. Use it at your own risk! */ /* All trademarks and copyrights belong to their respective owners */ class structorian { public $fd = NULL; public $mode = NULL; public function __construct($filename, $mode = "rb") { $this->mode = $mode; switch($mode) { case "wb": $this->fd = fopen($filename, $mode); break; default: $this->fd = fopen($filename, $mode); break; } } public function read($dataType = NULL, $count = NULL) { $data = NULL; if(! feof($this->fd)) { switch ($dataType) { case "i8": $data = @unpack("ci8", @fread($this->fd, 1))['i8']; break; case "i16": $data = @unpack("si16", @fread($this->fd, 2))['i16']; break; case "i32": $data = @unpack("ii32", @fread($this->fd, 4))['i32']; break; case "ichar": $data = chr(@unpack("cchar", @fread($this->fd, 1))['char']); break; case "u8": $data = @unpack("Cu8", @fread($this->fd, 1))['u8']; break; case "u16": $data = @unpack("Su16", @fread($this->fd, 2))['u16']; break; case "u32": $data = @unpack("Iu32", @fread($this->fd, 4))['u32']; break; case "char": case "uchar": $data = chr(@unpack("Cchar", @fread($this->fd, 1))['char']); break; case "str": case "cstr": $data = @unpack("a{$count}str", @fread($this->fd, $count))['str']; break; case "float": $data = @unpack("ffloat", @fread($this->fd, 4))['float']; break; case "double": $data = @unpack("ddouble", @fread($this->fd, 8))['double']; break; case "x8": /* Still not implemented */ case "x16": /* Still not implemented */ case "x32": /* Still not implemented */ case "bits8": /* Still not implemented */ case "bits16": /* Still not implemented */ case "bits32": /* Still not implemented */ case "enum8": /* Still not implemented */ case "enum16": /* Still not implemented */ case "enum32": /* Still not implemented */ case "set8": /* Still not implemented */ case "set16": /* Still not implemented */ case "set32": /* Still not implemented */ case "wstr": /* Still not implemented */ case "wchar": /* Still not implemented */ break; default: /* No default action for now */ break; } } return $data; } public function write($dataType = NULL, $data = NULL, $count = NULL) { $status = NULL; if(($this->fd !== NULL) && ($data !== NULL)) { switch ($dataType) { case "i8": $status = fwrite($this->fd, pack("c", $data)); break; case "i16": $status = fwrite($this->fd, pack("s", $data)); break; case "i32": $status = fwrite($this->fd, pack("i", $data)); break; case "ichar": $status = fwrite($this->fd, pack("c", $data)); break; case "u8": $status = fwrite($this->fd, pack("C", $data)); break; case "u16": $status = fwrite($this->fd, pack("S", $data)); break; case "u32": $status = fwrite($this->fd, pack("I", $data)); break; case "char": case "uchar": $status = fwrite($this->fd, pack("C", $data)); break; case "str": case "cstr": $status = fwrite($this->fd, pack("a{$count}", $data)); break; case "float": $status = fwrite($this->fd, pack("f", $data)); break; case "double": $status = fwrite($this->fd, pack("d", $data)); break; case "x8": /* Still not implemented */ case "x16": /* Still not implemented */ case "x32": /* Still not implemented */ case "bits8": /* Still not implemented */ case "bits16": /* Still not implemented */ case "bits32": /* Still not implemented */ case "enum8": /* Still not implemented */ case "enum16": /* Still not implemented */ case "enum32": /* Still not implemented */ case "set8": /* Still not implemented */ case "set16": /* Still not implemented */ case "set32": /* Still not implemented */ case "wstr": /* Still not implemented */ case "wchar": /* Still not implemented */ break; default: /* No default action for now */ break; } } return $status; } public function seek($count) { return fseek($this->fd, $count); } public function get($count) { return fread($this->fd, $count); } public function __destruct() { if($this->fd) { fclose($this->fd); unset($this->fd); unset($this->mode); } return true; } } ?>
rdb_discoverer.php - WEB Interface for structorian.php RDB Read/Write
PHP Code:
<HTML> <HEAD> <TITLE>RDB Structure Discoverer</TITLE> </HEAD> <BODY> <?php /* Author: Skamorzo */ /* To: elitepvpers.com - Rappelz Private Server Teams */ /* This code is intended only for educational use. Use it at your own risk! */ /* All trademarks and copyrights belong to their respective owners */ require "structorian.php"; if(! isset($_POST['rdb_filename'])) { echo "<SCRIPT type='text/javascript'>\n"; echo " function update(value) {\n"; echo " return(value.substring(12));\n"; echo " }\n"; echo " </SCRIPT>\n"; echo "<FORM action='". $_SERVER['PHP_SELF']. "' method='POST'>\n"; echo " <INPUT type='file' name='rdb_filename' onchange='update(this.value)'></INPUT><BR>\n"; echo " <INPUT type='submit' value='Submit'></INPUT><BR>\n"; echo "</FORM>\n"; } else { if(! isset($_POST['rdb_type'])) { $rdb_filename= urldecode($_POST['rdb_filename']); $rdb_format= ""; $rdb_header= 132; $rdb_size= filesize($rdb_filename); $rdb_file= new structorian($rdb_filename, "rb"); $rdb_file->seek(128); $rdb_records= $rdb_file->read("i32"); $rdb_bytes= ($rdb_size - $rdb_header) / $rdb_records; $rdb_record= bin2hex($rdb_file->get($rdb_bytes)); unset($rdb_file); } else { $rdb_type= $_POST['rdb_type']; $rdb_bytes= $_POST['rdb_bytes']; $rdb_record= $_POST['rdb_record']; $rdb_format= $_POST['rdb_format']; $rdb_filename= urldecode($_POST['rdb_filename']); if(empty($rdb_format)) { $rdb_format= $rdb_type; } else { $rdb_format.= "/". $rdb_type; } } if(isset($rdb_filename)) echo "<H1>File in use: $rdb_filename</H1>\n"; echo "<H1>Format in use:</H1>\n"; $structure= $rdb_record; $rdb_length= 0; $idx= 1; echo "<B>struct ENTRY {<BR>\n"; foreach(split('[/]', $rdb_format) as $entry) { $offset= 0; $value= @unpack($entry, hex2bin($structure)); switch ($entry) { case "ci8": $offset= 1; break; case "si16": $offset= 2; break; case "ii32": $offset= 4; break; case "Cu8": $offset= 1; break; case "Su16": $offset= 2; break; case "Iu32": $offset= 4; break; case "achar": $offset= 1; break; case "a32str": $offset= 32; break; case "a64str": $offset= 64; break; case "a128str": $offset= 128; break; case "a256str": $offset= 256; break; case "a512str": $offset= 512; break; case "a1024str": $offset= 1024; break; case "ffloat": $offset= 4; break; case "ddouble": $offset= 8; break; case "x8": /* Still not implemented */ case "x16": /* Still not implemented */ case "x32": /* Still not implemented */ case "bits8": /* Still not implemented */ case "bits16": /* Still not implemented */ case "bits32": /* Still not implemented */ case "enum8": /* Still not implemented */ case "enum16": /* Still not implemented */ case "enum32": /* Still not implemented */ case "set8": /* Still not implemented */ case "set16": /* Still not implemented */ case "set32": /* Still not implemented */ case "wstr": /* Still not implemented */ case "wchar": /* Still not implemented */ break; default: /* No default action for now */ break; } foreach($value as $key=>$val) { echo " <FONT stype='font-size: 0.8em'> $key ". ($offset > 8 ? "[len=$offset]" : ""). "datum_$idx; // <CODE>$val</CODE></FONT><BR>\n"; $idx++; } $rdb_length+= $offset; while($offset > 0) { $structure= substr($structure, 2); $offset--; } } echo " if (CurOffset < FileSize) {<BR>\n sibling;<BR>\n }<BR>\n}<BR>\n</B>"; echo "<H2>Record length= $rdb_length/$rdb_bytes bytes (". ($rdb_bytes-$rdb_length). " left)</H2>\n"; echo "<H3>Record data= <CODE style='font-size: 0.8em'>"."\\x". substr(chunk_split($structure, 2, "\\x"), 0, -2). "</CODE></H3>\n"; echo "<FORM action='rdb_view.php' method='POST'>\n"; echo " <INPUT type='hidden' name='rdb_filename' value='$rdb_filename'></INPUT><BR>\n"; echo " <INPUT type='text' size='256' name='rdb_format' value='$rdb_format'></INPUT><BR>\n"; echo " <INPUT type='radio' name='rdb_type' value='ci8'><FONT stype='font-size: 0.8em'>Reading signed byte= <CODE>". @unpack('ci8', hex2bin($structure))['i8']. "</CODE></FONT></INPUT><BR>\n"; echo " <INPUT type='radio' name='rdb_type' value='si16'><FONT stype='font-size: 0.8em'>Reading signed integer= <CODE>". @unpack('si16', hex2bin($structure))['i16']. "</CODE></FONT></INPUT><BR>\n"; echo " <INPUT type='radio' name='rdb_type' value='ii32'><FONT stype='font-size: 0.8em'>Reading signed long= <CODE>". @unpack('ii32', hex2bin($structure))['i32']. "</CODE></FONT></INPUT><BR>\n"; echo " <INPUT type='radio' name='rdb_type' value='ffloat'><FONT stype='font-size: 0.8em'>Reading float= <CODE>". @unpack('ffloat', hex2bin($structure))['float']. "</CODE></FONT></INPUT><BR>\n"; echo " <INPUT type='radio' name='rdb_type' value='ddouble'><FONT stype='font-size: 0.8em'>Reading double= <CODE>". @unpack('ddouble', hex2bin($structure))['double']. "</CODE></FONT></INPUT><BR>\n"; echo " <INPUT type='radio' name='rdb_type' value='achar'><FONT stype='font-size: 0.8em'>Reading char= <CODE>". @unpack('achar', hex2bin($structure))['char']. "</CODE></FONT></INPUT><BR>\n"; echo " <INPUT type='radio' name='rdb_type' value='a32str'><FONT stype='font-size: 0.8em'>Reading str[32]= <CODE>". @unpack('a32str', hex2bin($structure))['str']. "</CODE></FONT></INPUT><BR>\n"; echo " <INPUT type='radio' name='rdb_type' value='a64str'><FONT stype='font-size: 0.8em'>Reading str[64]= <CODE>". @unpack('a64str', hex2bin($structure))['str']. "</CODE></FONT></INPUT><BR>\n"; echo " <INPUT type='radio' name='rdb_type' value='a128str'><FONT stype='font-size: 0.8em'>Reading str[128]= <CODE>". @unpack('a128str', hex2bin($structure))['str']. "</CODE></FONT></INPUT><BR>\n"; echo " <INPUT type='radio' name='rdb_type' value='a256str'><FONT stype='font-size: 0.8em'>Reading str[256]= <CODE>". @unpack('a256str', hex2bin($structure))['str']. "</CODE></FONT></INPUT><BR>\n"; echo " <INPUT type='radio' name='rdb_type' value='a512str'><FONT stype='font-size: 0.8em'>Reading str[512]= <CODE>". @unpack('a512str', hex2bin($structure))['str']. "</CODE></FONT></INPUT><BR>\n"; echo " <INPUT type='radio' name='rdb_type' value='a1024str'><FONT stype='font-size: 0.8em'>Reading str[1024]= <CODE>". @unpack('a1024str', hex2bin($structure))['str']. "</CODE></FONT></INPUT><BR>\n"; echo " <INPUT type='hidden' name='rdb_bytes' value='$rdb_bytes'></INPUT>\n"; echo " <INPUT type='hidden' name='rdb_record' value='$rdb_record'></INPUT>\n"; echo " <INPUT type='submit' value='Submit'></INPUT><BR>\n"; echo "</FORM>\n"; } ?> </BODY> </HTML>
These classes still need to be optimized, but they are all functional.
The RDB file need to be in the same folder as the structorian.php and the rdb_discoverer.php files.
I will PM all the structure I discover to from now on.
Enjoy,
Skamorzo.
|
|
|
All times are GMT +2. The time now is 18:01.
|
|