MH4U DLC and savefile encryption

Discussion in '3DS - ROM Hacking, Translations and Utilities' started by moghedien, Jul 4, 2015.

  1. moghedien
    OP

    moghedien GBAtemp Fan

    Member
    411
    247
    Mar 9, 2015
    United States
    I've been working on the encryption for Monster Hunter games for a long time (since Monster Hunter Portable 2nd G).
    I haven't really spread my code around much but it's always been available on my github and I feel like more people might be interested in it now.

    Here's my repo dealing with the encryption:
    https://github.com/svanheulen/mhef

    It's has code for decrypting/encrypting DLC and saves from Monster Hunter 4 Ultimate and all the the Monster Hunter games from the PSP.


    Here's my repo for code dealing with the various file formats:
    https://github.com/svanheulen/mhff

    The code there is all experimental and not very user friendly but the wiki in that repo has information about the MH4U quest file format which would help you make custom quests.


    Here's my repo for a proxy server for hosting DLC quests:
    https://github.com/svanheulen/mhqs/tree/dev

    The mh4u_proxy.py file is the one for MH4U but it's not user friendly, and you need Twisted. I'll be working on improving it so it's easier for anyone to use. Edit: I made this script much easier to use, please view the README for details.

    All my code it's licensed under GPLv3. I would love for people to extend my code, make it better, and contribute. Pull requests are always welcome and I'm often available to chat on freenode using the nick svanheulen.
     
    Last edited by moghedien, Jul 5, 2015


  2. Kaizerfreak

    Kaizerfreak Member

    Newcomer
    18
    1
    Apr 12, 2015
    United States
    Hope to see you take this further!
     
  3. SaagiBols

    SaagiBols The AnalSavior

    Member
    319
    101
    Jan 29, 2015
    Serbia, Republic of
    Here, There, and Everywhere!..
    hope some1 will finally make an easy2use mh4u save decrypt/encrypt tool with this:)
    ...but until that happens could some1 be kind enough to post the specific commands i need to input with n3ds.py to decrypt and then encrypt the save????
     
    Last edited by SaagiBols, Jul 5, 2015
  4. moghedien
    OP

    moghedien GBAtemp Fan

    Member
    411
    247
    Mar 9, 2015
    United States
    First install the module then use the example script (examples/n3ds/savedata.py)
     
  5. SaagiBols

    SaagiBols The AnalSavior

    Member
    319
    101
    Jan 29, 2015
    Serbia, Republic of
    Here, There, and Everywhere!..
    c =SavedataCipher(MH4G_EU)

    c.decrypt_file('filename.crypted','filename.decrypted')

    c.encrypt_file('filename.decrypted', 'filename.crypted')

    the 2.x python plus 2.x pycrypto give errors, but it works fine with 3.4 python+ pycrypto for 3.4 that i found on some random github repo...
    THANKS ALOT 4 THIS TOOL:>
     
  6. moghedien
    OP

    moghedien GBAtemp Fan

    Member
    411
    247
    Mar 9, 2015
    United States
    Would you mind posting the error you got so that I can fix it?
     
  7. SaagiBols

    SaagiBols The AnalSavior

    Member
    319
    101
    Jan 29, 2015
    Serbia, Republic of
    Here, There, and Everywhere!..
    i removed py 2x now, but the errors it was giving me were something in line 71 buff sum or something... and this (TypeError: unsupported operand type(s) for +: 'int' and 'str')
     
  8. moghedien
    OP

    moghedien GBAtemp Fan

    Member
    411
    247
    Mar 9, 2015
    United States
    Thanks, I found the problem and got it fixed. Should work fine in Python 2.x now.
     
  9. moghedien
    OP

    moghedien GBAtemp Fan

    Member
    411
    247
    Mar 9, 2015
    United States
  10. ness151

    ness151 GBAtemp Fan

    Member
    314
    65
    Jun 2, 2008
    United States
    D:\virus.exe
    What would I use to read the decrypted file?
     
  11. moghedien
    OP

    moghedien GBAtemp Fan

    Member
    411
    247
    Mar 9, 2015
    United States
    Any hex editor. They're binary files, and not easy to edit manually. If you're not a developer it would probably be best to wait until a proper quest editor gets released.
    I'm working on making the encryption/decryption and proxy more user friendly first, after that I'll start working on an editor (assuming no one else has made one by then).
     
  12. ness151

    ness151 GBAtemp Fan

    Member
    314
    65
    Jun 2, 2008
    United States
    D:\virus.exe
    I remember someone attempting a save editor for 4U awhile back, saying that everything was in plaintext.. I can't wait for an much easier solution though. Thank you for the tools.
     
  13. AzuraLove

    AzuraLove Member

    Newcomer
    48
    3
    Jul 6, 2015
    Indonesia
    this are very usefull tolls ...
    can some one, write down step by step for decrypting save file user1 with this tolls ?
    i'm start phyton then install setup.py.. then next i'm completely confuse :v ...
    so please some body, share your kindness knowledge ..... :D
     
  14. moghedien
    OP

    moghedien GBAtemp Fan

    Member
    411
    247
    Mar 9, 2015
    United States
    use the examples/n3ds/savedata.py file
     
  15. AzuraLove

    AzuraLove Member

    Newcomer
    48
    3
    Jul 6, 2015
    Indonesia
    the decryption work nice.. thanks moghedien...
    but, after i decrypt save file then i encrypt it (with or without editing)..
    importing use encrypted save to the game always fail...
     
  16. Death78793

    Death78793 What is this, a first person shooter?

    Member
    251
    156
    Jan 16, 2015
    It's sad to see so many people making a fuss about this :glare:
    There's little to no people making "wrong" (to a pro hunter) use of this, and those who are, they're not really showing off or making any kind of detrimental comments against people who do play. Heck, I've invested a lot in my game and I did use one of those custom DLC quests to raise my HR a bit on a secondary profile I use for training. Keep in mind, I have played many hours and I've done pretty much everything up to this point on my main profile. I wish I could make one for the event tickets, since it's hard to get by 30+ quests to get everything I need for a set that I might not even use at all. Cheers to you guys for making an awesome tool, and I guess I better enjoy the few days I have before capcom either decides to go on a banning spree or patching everything up so it no longer works.
    /rant
     
  17. moghedien
    OP

    moghedien GBAtemp Fan

    Member
    411
    247
    Mar 9, 2015
    United States
    Sorry, I'll look into that.

    Meh, It doesn't bother me :) I've been doing this for every MH game since Freedom 1 and I've always released my code, and I'll probably do the same for MHX :)
     
    Death78793 and SaagiBols like this.
  18. AzuraLove

    AzuraLove Member

    Newcomer
    48
    3
    Jul 6, 2015
    Indonesia
    progress that i do :
    - game to savedatafiler to get user1 ..
    - decrypt user1 with mhef ..
    - open hex editor ..
    - (sees my char name no editing)
    - encript user1 with mhef
    - put it to savedatafiler for import save ...
    - error can not import the decrypted user1 file..

    fyi i'm using GW and use switching 0004000000126300.sav <=> 000400000FF40A00.sav methode
    python 3.4.3 and pycrypto 2.6.1 for 3.4 python , this i use

    sorry for bothering you master ... :D
     
  19. Death78793

    Death78793 What is this, a first person shooter?

    Member
    251
    156
    Jan 16, 2015
    Thanks for the work :)
    Also forgot to add in that I've been straining the python scripts to find any bugs but everything's fine on my end (only once or twice have I gotten an error and it's been my fault, not the script's) :P
     
  20. moghedien
    OP

    moghedien GBAtemp Fan

    Member
    411
    247
    Mar 9, 2015
    United States
    Hmm, I just tried it on mine and it worked fine (I even changed my character's name). I just used Pasta to run SaveDataFiler. I don't have a GW so I'm not sure what that switching method is.