matrixane
11-11-07, 06:16 AM
hi to all..well take here the new and complete fixed ACV PACK/UNPACK
ALL CREDITS FOR "MAGICBEAR" RZ USER.
Success make a new acv unpacker
Author: MagicBear
My English is not so good, so grammer may have many bugs. ^^
I am a Chinese. If you have any problem can ask me.
<b><font color=red>[Chỉ có thành viên mới xem link được. <a href="register.php"> Nhấp đây để đăng ký thành viên......</a>]</font></b>
QQ: 130012321
Finish in 2007-11-10 21:11 GMT+8
Format for acv file:
First 4 byte is file num
Continue is a block
each block size is 176 byte
Block Struct:
first 160 char: filename with path
160: DWORD (Unknow what meaning, all is same, may be a flag)
164: DWORD (compressed length, use this to set read data length)
168: DWORD (decompressed length, use this for zlib decompress length)
172: DWORD (pointer for data start)
pointer for data start is from 0-xxxxxxx
pointer need to fix:
so real pointer = 4+file_num*176+ori pointer
read compress data:
char *compdata = (char *)malloc(compress_len);
fseek(fp,4+file_num*176+ptr,SEEK_SET);
fread(compdata,compress_len,sizeof(char),fp);
and then make a standard gzip file with following step:
Add \x1F\x8B\x08\x00\x00\x00\x00\x00\x00\x03 to header
Drop first two byte for compress data and drop last five byte for compress data, ok.
and then now can decompress it with a without file length and crc hash check's decompresser. (like php's gzopen gzread function, you can download php's source code to see how to implement)
program write in php success. Suggest write it in C in real environment. Because using C to include zlib too many step, so i use php to make the demo program. when you finish the C source, I hope you can send the source code to me.
SOURCE CODE FOR PHP
$avc = "021.acv";
$favc = fopen($avc,"rb");
extract(unpack("Lfile_num",fread($favc,4)));
for ($i=0;$i<$file_num;$i++)
{
fseek($favc,4+$i*176,SEEK_SET);
$data = fread($favc,176);
$filename = substr($data,0,strpos($data,"\0"));
extract(unpack("Lcomplen/Lunknow/Lptr",substr($data,164,12)));
fseek($favc,4+$file_num*176+$ptr,SEEK_SET);
$comp_data = fread($favc, $complen);
gendir($filename);
$fp = fopen("tmp.gz", "wb");
fputs($fp, "\x1F\x8B\x08\x00\x00\x00\x00\x00\x00\x03");
fputs($fp,substr($comp_data,2,$complen-5-2));
fclose($fp);
// Load Compress File
$zp = gzopen("tmp.gz", "r");
$content = gzread($zp, $unknow);
//gzpassthru($zp);
gzclose($zp);
// Save Decompressed File
$fp = fopen("decompress/".$filename, "wb");
fwrite($fp, $content);
fclose($fp);
echo $filename." $ptr<br />";
}
fclose($favc);
function gendir($dirname)
{
$x = explode("\\",$dirname);
unset($x[count($x)-1]);
$xcount = count($x);
for ($i=0;$i<$xcount;$i++)
{
$joinstr = "";
for ($j=0;$j<=$i;$j++)
{
$joinstr .= $x[$j]."/";
}
if (!is_dir("decompress/".$joinstr))
{
mkdir("decompress/".$joinstr,0777);
}
}
}
Basic Frame for C++ (only get the data, no decompress function)
int main(int argc, char* argv[])
{
printf("avc file list viewer...\n");
<b><font color=red>[Chỉ có thành viên mới xem link được. <a href="register.php"> Nhấp đây để đăng ký thành viên......</a>]</font></b>
if (argc == 0)
{
printf("usage: avc_list [avcfilename]\n");
return 0;
}
DWORD file_num = 0;
FILE *fp = fopen(argv[1],"rb");
if (fp == NULL)
{
printf("read file error!\n");
return 0;
}
fread(&file_num,sizeof(DWORD),1,fp);
printf("file num: %u\n",file_num);
int i = 0;
char filename[176];
DWORD addr1,compress_len,addr3,ptr;
for (i=0;i<file_num;i++)
{
//fseek(fp,4+i*176,SEEK_SET);
fread(filename,sizeof(char),176,fp);
memcpy(&addr1,filename+160,4);
memcpy(&compress_len,filename+164,4);
memcpy(&addr3,filename+168,4);
memcpy(&ptr,filename+172,4);
/*char *compdata = (char *)malloc(compress_len);
fseek(fp,4+file_num*176+ptr,SEEK_SET);
fread(compdata,compress_len,sizeof(char),fp);
printf("file: %s Flag: %x Len: %u unknow: %u Ptr: %u\n",filename,addr1,compress_len,addr3,ptr);
free(compdata);*/
printf("%s\n",filename);
}
fclose(fp);
return 0;
}
ALL CREDITS FOR "MAGICBEAR" RZ USER.
Success make a new acv unpacker
Author: MagicBear
My English is not so good, so grammer may have many bugs. ^^
I am a Chinese. If you have any problem can ask me.
<b><font color=red>[Chỉ có thành viên mới xem link được. <a href="register.php"> Nhấp đây để đăng ký thành viên......</a>]</font></b>
QQ: 130012321
Finish in 2007-11-10 21:11 GMT+8
Format for acv file:
First 4 byte is file num
Continue is a block
each block size is 176 byte
Block Struct:
first 160 char: filename with path
160: DWORD (Unknow what meaning, all is same, may be a flag)
164: DWORD (compressed length, use this to set read data length)
168: DWORD (decompressed length, use this for zlib decompress length)
172: DWORD (pointer for data start)
pointer for data start is from 0-xxxxxxx
pointer need to fix:
so real pointer = 4+file_num*176+ori pointer
read compress data:
char *compdata = (char *)malloc(compress_len);
fseek(fp,4+file_num*176+ptr,SEEK_SET);
fread(compdata,compress_len,sizeof(char),fp);
and then make a standard gzip file with following step:
Add \x1F\x8B\x08\x00\x00\x00\x00\x00\x00\x03 to header
Drop first two byte for compress data and drop last five byte for compress data, ok.
and then now can decompress it with a without file length and crc hash check's decompresser. (like php's gzopen gzread function, you can download php's source code to see how to implement)
program write in php success. Suggest write it in C in real environment. Because using C to include zlib too many step, so i use php to make the demo program. when you finish the C source, I hope you can send the source code to me.
SOURCE CODE FOR PHP
$avc = "021.acv";
$favc = fopen($avc,"rb");
extract(unpack("Lfile_num",fread($favc,4)));
for ($i=0;$i<$file_num;$i++)
{
fseek($favc,4+$i*176,SEEK_SET);
$data = fread($favc,176);
$filename = substr($data,0,strpos($data,"\0"));
extract(unpack("Lcomplen/Lunknow/Lptr",substr($data,164,12)));
fseek($favc,4+$file_num*176+$ptr,SEEK_SET);
$comp_data = fread($favc, $complen);
gendir($filename);
$fp = fopen("tmp.gz", "wb");
fputs($fp, "\x1F\x8B\x08\x00\x00\x00\x00\x00\x00\x03");
fputs($fp,substr($comp_data,2,$complen-5-2));
fclose($fp);
// Load Compress File
$zp = gzopen("tmp.gz", "r");
$content = gzread($zp, $unknow);
//gzpassthru($zp);
gzclose($zp);
// Save Decompressed File
$fp = fopen("decompress/".$filename, "wb");
fwrite($fp, $content);
fclose($fp);
echo $filename." $ptr<br />";
}
fclose($favc);
function gendir($dirname)
{
$x = explode("\\",$dirname);
unset($x[count($x)-1]);
$xcount = count($x);
for ($i=0;$i<$xcount;$i++)
{
$joinstr = "";
for ($j=0;$j<=$i;$j++)
{
$joinstr .= $x[$j]."/";
}
if (!is_dir("decompress/".$joinstr))
{
mkdir("decompress/".$joinstr,0777);
}
}
}
Basic Frame for C++ (only get the data, no decompress function)
int main(int argc, char* argv[])
{
printf("avc file list viewer...\n");
<b><font color=red>[Chỉ có thành viên mới xem link được. <a href="register.php"> Nhấp đây để đăng ký thành viên......</a>]</font></b>
if (argc == 0)
{
printf("usage: avc_list [avcfilename]\n");
return 0;
}
DWORD file_num = 0;
FILE *fp = fopen(argv[1],"rb");
if (fp == NULL)
{
printf("read file error!\n");
return 0;
}
fread(&file_num,sizeof(DWORD),1,fp);
printf("file num: %u\n",file_num);
int i = 0;
char filename[176];
DWORD addr1,compress_len,addr3,ptr;
for (i=0;i<file_num;i++)
{
//fseek(fp,4+i*176,SEEK_SET);
fread(filename,sizeof(char),176,fp);
memcpy(&addr1,filename+160,4);
memcpy(&compress_len,filename+164,4);
memcpy(&addr3,filename+168,4);
memcpy(&ptr,filename+172,4);
/*char *compdata = (char *)malloc(compress_len);
fseek(fp,4+file_num*176+ptr,SEEK_SET);
fread(compdata,compress_len,sizeof(char),fp);
printf("file: %s Flag: %x Len: %u unknow: %u Ptr: %u\n",filename,addr1,compress_len,addr3,ptr);
free(compdata);*/
printf("%s\n",filename);
}
fclose(fp);
return 0;
}