remove item from .dat file with PHP script
Hello , we trying remove item with php script from .dat file but its hard , maybe anyone have any idea about it?
this php show's what item have char , name and level
Quote:
name: testwamp (1lvl)
face: char\tmABCD\tmh-b02.inf
body: char\tmABCD\b001.ini
----item: SilverVamp +0
Re: remove item from .dat file with PHP script
From the descriptions of others, I would guess you need to read all data, remove one element in memory, and then re-compress the file back again. (or at least the elements after the item you want to delete)
These files are a kind of compressed memory dump, not a random-access file. More like a .tar.gz than most .pak / .dat files.
Re: remove item from .dat file with PHP script
for u do that just need to 'rename' the name of item, i don't know the codes os PHP to do that, but the way is it, just rename the item name like :"DeletVamp" the server will delete the item. ( becouse you change the checksun of item )
Re: remove item from .dat file with PHP script
That's an excellent example of a positive exploit.
You want the item deleted, but there's no function for that. You know that hacked items get deleted, so you make a random and innocuous item hack in order to force the item to be deleted.
Well done. I like your thinking. :wink:
Re: remove item from .dat file with PHP script
It should be easy enough to do that once I get the item compression algorithm done ^_^
Re: remove item from .dat file with PHP script
does not have any 'compression' , just find the name inside the dat.. you will find it easy... just need to take the 'offset' inside dat file, and you can try use fwrite function of PHP to do the 'delet' function.
for the php function i am not you guy, but just need to 'rename' or change anything about item inside .dat file...
if u not understend yet, when i talk about .dat file, ofcourse i mean, dataserver, dat file.
Re: remove item from .dat file with PHP script
Quote:
Originally Posted by
SheenBR
It should be easy enough to do that once I get the item compression algorithm done ^_^
can you show me it algorithm or ???
Re: remove item from .dat file with PHP script
Quote:
Originally Posted by
microamazing
does not have any 'compression' , just find the name inside the dat.. you will find it easy... just need to take the 'offset' inside dat file, and you can try use fwrite function of PHP to do the 'delet' function.
for the php function i am not you guy, but just need to 'rename' or change anything about item inside .dat file...
if u not understend yet, when i talk about .dat file, ofcourse i mean, dataserver, dat file.
Yes, they are compressed :wink:
I have almost fully understanding of the character dat file, so when I say it is compressed, I am pretty sure I know what I am talking about :D: and many other people already knew that aswell.
And forgive me, this is an horrible way of doing it... as bobsobol said, a positive exploit. I don't like to make use of such things, as it could generate bugs or other things, who knows?
It's simple to delete the item: decompress the entire item table in the dat file, find and remove the desired item block of the table, re-compress, change a few other things, and your item is "deleted", correctly. :): (theory, not tested since I'm still working on the compression algorithm.) Exactly like bobsobol said XD.
I mean, the item is not deleted, since it would have the *.itm file, what it would do is simply remove the item from your iventory.
@Kakdela
It is not ready yet.
Re: remove item from .dat file with PHP script
I feel I must mediate here. I think that the "exploit" idea has zero chance of introducing bugs, though it may highlight some which already exist in the server. Actually modifying the .dat file may introduce a bug, if it is done in any way different from normal server operation.
Compression is a valid term, and it was Gregoo who figured out this method, and described it as being "like" zip compression. (IMS, quoted from memory) In his code, it's clear that it is "tokenised", so "compiled" (like Java, .Net or MSVBVM Byte-code) would be an equally valid term. Effectively, all these things are looking at reducing redundancy by tokenising tabulated data elements. So you could also consider it as "randomizing" a sequential stream, or creating a "relational" data-set from a "flat-file".
It really doesn't matter what term you use. The fact is that all the information is there, in a form which is smaller, by virtue of being distributed in a manner which makes it difficult to read sequentially.
.itm files exist for most items which no longer exist on the server, and their presence is often essential for making sense of the log files. If the .itm where also removed, when the item is removed from inventory, the administrators job may become considerably harder. I used to "archive" very old .itm files and .log files, so that I still had them from "way-back" but they didn't take up masses of space.
Sheens method has more potential, and could allow logging of who deleted which item from what inventory, how, and maybe even why. But the microamazing method, I still see as very positive and beneficial, for very little effort.
Well done to both.
Re: remove item from .dat file with PHP script
http://img189.imageshack.us/img189/8853/semttuloxla.jpg
this is a example for \DataServer\userdata\30\Leeh.dat
this simple modification will delete the item.
again, i prefere the server delete item for me... this will make a free bug way!!!
just need to do it in php.
Re: remove item from .dat file with PHP script
@microamazing
we already make it delete by name but php can't find if need items delete 2 times like
1) item named (kakdela) is deleted with change name like (deldela)
2) if he pick up again (kakdela) item script can't delete it again
Re: remove item from .dat file with PHP script
Quote:
Originally Posted by
Kakdela
@microamazing
we already make it delete by name but php can't find if need items delete 2 times like
1) item named (kakdela) is deleted with change name like (deldela)
2) if he pick up again (kakdela) item script can't delete it again
ok, so re-write any code until 10 Bytes of item name =D and don't change item name =D...
and i don't understent this part: "can't find if need items delete 2 times like"
Re: remove item from .dat file with PHP script
Quote:
Originally Posted by
microamazing
ok, so re-write any code until 10 Bytes of item name =D and don't change item name =D...
and i don't understent this part: "can't find if need items delete 2 times like"
i mean with php , if you delete from Test.dat item named "Fadeo" , then if you try do it secound time script will not delete it , its bug , becouse .dat file save alot item names , better is write with unpack , remove item , then pack
Re: remove item from .dat file with PHP script
What if you have several "Stone Axe" and want to delete on of them? You aren't searching for the name are you? You should be looking by item index and offset. I hope. ^_^
Re: remove item from .dat file with PHP script
Thats why my method is so much better ^_^ Decompressing the block would give you all the item status so you can easily identify it. But that algorithm is a pain...
Re: remove item from .dat file with PHP script
Quote:
Originally Posted by
SheenBR
Thats why my method is so much better ^_^ Decompressing the block would give you all the item status so you can easily identify it. But that algorithm is a pain...
yes i think so your way will be better , but maybe you give algorithm start and if we finish it faster i will help you too
Re: remove item from .dat file with PHP script
What kind of fields the records inside the dat files has? how the struct looks like?
Re: remove item from .dat file with PHP script
I see you guys are struggling with that. Here's my work about that particular topic: https://github.com/gregoo/pt.inventory.php
The repo contains a set of class that can unpack and pack the inventory of a .dat file.
There's also a little demo that display the content of my very own char and buttons to delete items.
Have some fun you guys!
EDIT: I must confess I've tested the theory (checking if unpacking - packing produced the exact same file) but I didn't try to launch the character afterwards (too lazy to launch a test server). Do backup your character before checking this stuff!