Jump to content
Official BF Editor Forums
wtflol07

[Help] Open/edit "initfs_Win32" File

Recommended Posts

Hey folks, this is my first post and its great to be here :)

I'm kinda noob so i need your help open/modify unknown format file from Battlefield 3 game

in the Alpha trial version, there's a file named "initfs_Win32"

I opened with Hex editor and it worked well:

309iv43.jpg

But unfortunately in final release that file somehow encrypted:

2hdbs3r.jpg

What i'm looking for is the trying to enable commands for console ingame

because in the Alpha trial it was enabled but DICE they disable it in the final release

very disappointed :(

So i'll give it a try, but i need you guys help me with it

initfs_Win32:

sorry for my bad enlgish

Thanks

Edited by wtflol07

Share this post


Link to post
Share on other sites

Where is that file in your alpha folder? I found both the alpha file as well as the retail file to use the same XOR encryption (the encryption used in toc files as well). Here's a script for Python 2.7. Make a file out of it, e.g. name it "xor.py", then drag and drop your initfs_Win32 on the Python file and it will create a initfs_Win32.txt file.

The updated script below creates a file with correct header while stile being unencrypted. So you can use the decrypted file straight away and don't need to encrypt it again to play the game.

import sys

filename = sys.argv[1]

f1=open(filename,"rb")
header=f1.read(296)
magic=[]
for i in range(257):
   magic.append(ord(f1.read(1)))
f1.seek(3,1)
data=f1.read()
f1.close()
f2=open(filename+".txt","wb")
f2.write(header)
f2.write("{"*257)
f2.write("\0"*3)
buff=""
for i in xrange(len(data)):
   buff+=chr(magic[i%257]^ord(data[i])^0x7b)
   if i%128==0:
       f2.write(buff)
       buff=""
f2.write(buff)
f2.close()

Edited by Frankelstner

Share this post


Link to post
Share on other sites

Where is that file in your alpha folder? I found both the alpha file as well as the retail file to use the same XOR encryption (the encryption used in toc files as well). Here's a script for Python 2.7. Make a file out of it, e.g. name it "xor.py", then drag and drop your initfs_Win32 on the Python file and it will create a initfs_Win32.txt file.

I'm confused here

the file i made once i click A cmd window popped up and then disappeared right away

or where exactly should i drop it? is it in python command line?

Share this post


Link to post
Share on other sites

Well XOR itself when applied twice results in the original data again. But of course one needs to put the header back at the right place. This should work, just make sure both files are at the right place because it needs both. Drag and drop the txt.

import string
import binascii
import sys

filename = sys.argv[1]

f1=open(filename[:-4],"rb")
copypasta=f1.read(296)

magic=[]
data=[]


for i in range(257):
   magic.append(int(binascii.hexlify(f1.read(1)),16))
f1.seek(296)
copypasta+=f1.read(260)
f1.close()
f2=open(filename,"rb")
rest=f2.read()

for i in rest:
   data.append(int(binascii.hexlify(i),16))


tempfinal=[]
for i in range(len(data)):
   tempfinal.append(hex(data[i] ^ magic[i%257]^0x7b)[2:])

final=[]
for i in tempfinal:
   if len(i)==1:
       final.append("0"+i)
   else:
       final.append(i)
final=[binascii.unhexlify(i) for i in final]
final=string.join(final,"")

f=open(filename+".txt","wb")
f.write(copypasta)
f.write(final)
f.close()

Share this post


Link to post
Share on other sites

I tried that and worked very well

but didn't walk through the servers, it keep hanging when saying "Joining Server..."

i was so close to enable must usefull Commands for console ingame

Edited by wtflol07

Share this post


Link to post
Share on other sites

I've updated the script, the game apparently doesn't care which key is used for the decryption. So it doesn't mind if the key used doesn't alter the file at all. Thus the second script is not necessary anymore and files can be changed directly.

Share this post


Link to post
Share on other sites

I've updated the script, the game apparently doesn't care which key is used for the decryption. So it doesn't mind if the key used doesn't alter the file at all. Thus the second script is not necessary anymore and files can be changed directly.

Do you know how to modify weapon's damage/magazine capacity.I have already read your post.But I suck,I am noob.I don't understand.

Some Bf3 File Info For Modding

Thank you! :)

Edited by zoologist134

Share this post


Link to post
Share on other sites

Do you know how to modify weapon's damage/magazine capacity.I have already read your post.But I suck,I am noob.I don't understand.

Some Bf3 File Info For Modding

Thank you! :)

It's not possible yet to put the files back together. The only way to mod the game right now is changing individual bytes. You'll need to wait a month or two until the tools are ready.

Share this post


Link to post
Share on other sites

It's not possible yet to put the files back together. The only way to mod the game right now is changing individual bytes. You'll need to wait a month or two until the tools are ready.

okay.I can wait.Hope you release it quickly.

Share this post


Link to post
Share on other sites

Thank you Frankelstner, hope people don't abuse this because it allows the execution of "hidden" console commands.

Edited by aresyx

Share this post


Link to post
Share on other sites

After the patch the file doesn't work, even I changed the size O.O

maybe the file got busted? anyone?

File has been moved to the update folder under battlefield 3

Share this post


Link to post
Share on other sites

Modding BF3 is over, the new expansion patch implemented a md5sum check on game files. Guess someone from DICE reads these boards lol

Encryption is still the same but BF3 refuses to start if a file has been modified.

Edited by aresyx

Share this post


Link to post
Share on other sites

Modding BF3 is over, the new expansion patch implemented a md5sum check on game files. Guess someone from DICE reads these boards lol

Encryption is still the same but BF3 refuses to start if a file has been modified.

I thick Encryption of initfs_Win32 has changed because I cannot use the XOR encryption by Frankelstner to unencrypte it.

By the way,how is your progress,Frankelstner ?

Share this post


Link to post
Share on other sites

damn gentlemen we got busted in our asses lol

tried to trick the server by replacing the original file and the modified at the same time didnt go well

I bet there is a file has the same info but different format "cas.cat"?

Edited by wtflol07

Share this post


Link to post
Share on other sites

I thick Encryption of initfs_Win32 has changed because I cannot use the XOR encryption by Frankelstner to unencrypte it

Using the original scripts frankelstner posted an initfs_win32 file could be unencrypted and re-made which ran fine with BF3. However with the new patch any changes made would cause BF3 to not start.

import string
import binascii
import sys

filename = sys.argv[1]

f1=open(filename,"rb")
f1.seek(296,1)

magic=[]
data=[]


for i in range(257):
   magic.append(int(binascii.hexlify(f1.read(1)),16))
f1.seek(3,1)
rest=f1.read()
f1.close()
for i in rest:
   data.append(int(binascii.hexlify(i),16))


#XORing with magic only gets lots of numbers with 7b, thus xor with 7b to get nullbytes
tempfinal=[]
for i in range(len(data)):
   tempfinal.append(hex(data[i] ^ magic[i%257]^0x7b)[2:])

final=[]
for i in tempfinal:
   if len(i)==1:
       final.append("0"+i)
   else:
       final.append(i)
final=[binascii.unhexlify(i) for i in final]
final=string.join(final,"")

f=open(filename+".txt","wb")
f.write(final)
f.close()

Edited by aresyx

Share this post


Link to post
Share on other sites

Using the original scripts frankelstner posted an initfs_win32 file could be unencrypted and re-made which ran fine with BF3. However with the new patch any changes made would cause BF3 to not start.

Probably a hash check.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...