Jump to content

What exactly IS random.dat?


Recommended Posts

Posted

I have done some trials to see exactly what random.dat is. I'm still not 100% sure what it is, but hopefully this helps some people:

  • random.dat stays the same until it is deleted
  • It is always length 24 (the client will make an entire new random.dat if it is above length 25)
  • In the RS client, it is a RandomAccessFile object
  • It is always opened with the read and write permissions

The process when making a new random.dat:

  • If there is no random.dat, on client launch it will create one
  • At this point, it will contain a single character -  ÿ (hex -> 255/FF)
  • When your client logs in, it will increase in size from a single character to 24.
  • This file is never altered from then onwards, however there is something weird that I found that does write to the RandomAccessFile handler that holds the random.dat

 

Pseudocode:

random.dat is a "ht"

A ht ->
new ht(file, string, long)

IF (file.length >= long) delete file

b = new RandomAccessFile(file, string)
n = b.read();
if (n != -1 || !string.equals("r")) {
	write n in the first position
}

seek to 0

I believe that what this does is essentially make sure that the file is valid - if "n" was -1, it would mean that the read operation failed.

 

From what I have seen, I believe it might be better if, instead of fully removing random.dat or making a new, empty, read-only one, you should create a read-only random.dat with the hex character FF written inside. This is because it is written like so by the game itself, and therefore is a valid format (or so it thinks), and doesn't look as suspicious (considering it could just very well be a failed write operation after login - there are no stages where random.dat is empty). I will continue my espionage within the OSRS client to see if I can find anything else of interest regarding random.dat.

 

Good luck everyone!

  • Like 4

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...