Cubic Ninja QR-CODE

Discussion in '3DS - Homebrew Development and Emulators' started by jl1990, Sep 2, 2014.

  1. jl1990
    OP

    jl1990 Member

    Newcomer
    12
    5
    Sep 2, 2014
    Hi all,

    I've been doing some tests trying to understand the format of the data contained in the qr codes of cubic ninja.
    I developed a program that extracts the data from them as byte array using open source zxing library.
    The data don't seem to follow any obvious pattern, and it looks like it's compressed. Do you guys know what type of data does it use?

    Edit1:

    Warning: Spoilers inside!

    Edit2:

    Warning: Spoilers inside!

    Edit3:
    Warning: Spoilers inside!

    Ok, I made a quick GUI for you (and quite ugly), so you don't have to use console (I didn't take care with GUI errors, so probably the program will throw errors pretty easily if you do strange things).

    About the program
    -------------------------
    Last version: 1.0b

    1. What it does right now:

    Give the program an image input file
    Select where to save the binary output file.
    Press Run
    The program generates a .bin file (it contains the bytes contained in the QR Code) and a clean QR Code.

    2. Objetives

    - Understand the Cubic Ninja QR Format.
    - Understand other games format (AC new leaf is already solved, but there are other games that would be ok to get info about)

    3. Requeriments:

    - Java virtual machine: The program should work in any enviroment with java >= 6, but I've tested it only with oracle java 8 and openjdk 7.

    4. FAQ

    - ¿What do I mean with a clean QR Code?

    You can take a photo with your mobile phone in bad quality and the program will generate a clean and equivalent output image for you.

    - It is broken/ I get error ...

    Please, tell me what you did (Screenshots would be awesome) and I will try to help you

    - Does it only work with Cubic Ninja?

    Right now I've only tested it with Cubic Ninja.

    - The QR Code it generates it's different

    The QR Code it generates contains the same data, it's an equivalent QR-code, QR Codes can vary depending on Size, Mask etc. There are more than many outputs for the same input (they all contain the same data).

    5. Known problems/Errors:

    - It only admits jpg images

    - Sometimes it doesn't recognize the image QR Code

    - Problems with Java 7? (try to use console and if it prints an error post it here!)

    6. Tested on:

    - OpenJDK 7, Oracle Java 8, Oracle Java 7

    - Image types: JPG, PNG

    7.Downloads:

    GUI-Version: https://dl.dropboxusercontent.com/u/4593493/QR_BinExtractor.jar

    Console Version: https://dl.dropboxusercontent.com/u/4593493/QBE_NOGUI.jar
    Use -> java -jar QBE_NOGUI.jar inputFile.jpg outputFile.bin

    Thanks
     


  2. Kaphotics

    Kaphotics badc0ded

    Member
    611
    460
    Sep 10, 2010
    United States
  3. jl1990
    OP

    jl1990 Member

    Newcomer
    12
    5
    Sep 2, 2014
    I'm just taking the data contained in the QR-Code as a byte array. QR-Codes allows many encoding modes, one of them is byte-encoding which I'm using to get the data. Right now the data that I got from the QR is untouched, I did not modify its contents.
    The idea is to understand the format of the QR-Codes to be able to try things, create levels without needing a 3Ds etc.

    PD: The format you posted does not look like the one I posted. My file is much bigger (exactly 1201 bytes). Mii format is 112 bytes... Anyway thanks for trying :lol:
     
  4. NCDyson

    NCDyson Hello Boys...

    Member
    271
    113
    Nov 9, 2009
    United States
    its more than likely encrypted. i dunno much about QR codes and the encoding, so it could be something more simple
     
  5. YoshiInAVoid

    YoshiInAVoid GBAtemp Advanced Fan

    Banned
    560
    336
    Jan 10, 2011
    Good work. I think you should also post the image of the actual level; and give more examples so we can see the similarities and differences. Just having 1 isn't that useful for reverse engineering.

    I don't think Cubic Ninja is the game. But this is interesting research none the less.
     
  6. lemonmeister

    lemonmeister Member

    Newcomer
    18
    10
    Apr 7, 2013
    Italy
    A quick look reveals a recurring pattern, I'd say its just some simple for encryption. Or maybe its just the good old misused aes-ecb
     
  7. gamesquest1

    gamesquest1 Nabnut

    Member
    14,134
    9,477
    Sep 23, 2013
    yeah i noticed an awful lot of EFBFBD

    but then again i have no idea how all this stuff works :lol:
     
  8. hippy dave

    hippy dave Butts Butts Megabutts

    Member
    2,587
    1,802
    Apr 30, 2012
    From a brief glance I think I've got it worked out - if you XOR the data with 0xb00b you get a nude J-Law selfie.
     
    Margen67, Nurio and piratesephiroth like this.
  9. jl1990
    OP

    jl1990 Member

    Newcomer
    12
    5
    Sep 2, 2014
    Funny, but this is not a funny thread. This is a serious post, try to keep it clean please.

    Yeah, looks like 0xEF 0xBF 0xBD bytes repeats constantly. it's some kind of pattern.

    I will continue experimenting with the files, I will have a look into AES (I have a library I made time ago) and hopefully I can find something interesting.

    Thank guys!

    I updated the main post, keep an eye on it ;)
     
  10. VinsCool

    VinsCool Comfortably Numb

    Member
    GBAtemp Patron
    VinsCool is a Patron of GBAtemp and is helping us stay independent!

    Our Patreon
    11,851
    28,343
    Jan 7, 2014
    Canada
    Another World
    Interesting, if you need help for whatever level editing or any experimentation, I also have the game ;)
     
  11. jl1990
    OP

    jl1990 Member

    Newcomer
    12
    5
    Sep 2, 2014
    Thanks, I just got it working! :P.

    It extracts data from any kind of QR-Code (and maybe others...). it generates a clean image of the QR Code and the byte buffer file.
    I'm going to do some tests and the GUI and I will post it here if I don't find any error meanwhile.
    Later I have to understand the format (the hard part)
     
  12. Cyan

    Cyan GBATemp's lurking knight

    Global Moderator
    18,272
    8,745
    Oct 27, 2002
    France
    Engine room, learning
    Elisherer worked on a QR generator/Level editor for multiple games.
    Maybe he could help you with the format.

    look for "Inteligent Level Editor". (old name was Pyramid Level editor, but it's now multi-games)

    Or you could search and accomplish it yourself, it's providing good knowledge to try and understand things.
     
  13. jl1990
    OP

    jl1990 Member

    Newcomer
    12
    5
    Sep 2, 2014
    Just uploaded the first version, I will come back later, I'm going to have dinner :P
     
    VinsCool likes this.
  14. VinsCool

    VinsCool Comfortably Numb

    Member
    GBAtemp Patron
    VinsCool is a Patron of GBAtemp and is helping us stay independent!

    Our Patreon
    11,851
    28,343
    Jan 7, 2014
    Canada
    Another World
    It doesn't work for me. It loads, I select one of your test qr codes (in jpeg format) the I selected the output file ( a test.bin) but if I press "run" it did nothing O.o
     
  15. jl1990
    OP

    jl1990 Member

    Newcomer
    12
    5
    Sep 2, 2014
    Java version problem, it happened to me before too with Java SE 7. I am having dinner, but try with openjdk meanwhile, I will have a look at it later.
     
  16. VinsCool

    VinsCool Comfortably Numb

    Member
    GBAtemp Patron
    VinsCool is a Patron of GBAtemp and is helping us stay independent!

    Our Patreon
    11,851
    28,343
    Jan 7, 2014
    Canada
    Another World
    Okay thanks :)
     
  17. jl1990
    OP

    jl1990 Member

    Newcomer
    12
    5
    Sep 2, 2014
    Ok, I'm back. Let's have a look to that error with Java 7 :wtf:

    Edit:

    Looks like some weird error with "Oracle Java 7 Runtime" and the swing GUI or something like that. I didn't have any problems once I selected another java version or tried by console.
    To reproduce the error and because always is better, I'm uploading a console version. Try with that one, it should work. If it just prints an error post it here so I can fix it. Thanks ^^


    Thank you, I'm looking at the project right now. Does he usually post here? He does xD
     
  18. elisherer

    elisherer I ♥ 3DS

    Member
    778
    153
    Dec 16, 2009
    Iceland
    3dbrew.org
    Your QR code decoder is not working well... it tries to translarte the data to text and creates those EFBFBD for unknown letters. (UTF8)
    looks like the last byte changes (suggesting CRC-8?)
    Anyway, There is nothing similiar about the first qr and the last empty ones. I think it might be encrypted even with a xorpad. (if the checksum is xor based it can still be found)

    Edit: BTW, you can use 3ds explorer to extract bin files from QR codes (Tools->QR tool), and there is a XOR tool for XOR operations as well

    Edit2: I'm assuming it isn't compressed because the 3 files you uploaded are aligned to 8 bytes (suggesting int32), needs more qr codes (maybe some more information about what's in there like if there is a title for the empty ones, change it by one letter)
     
  19. jl1990
    OP

    jl1990 Member

    Newcomer
    12
    5
    Sep 2, 2014
    That files are wrong, I didn't upload new files since I fixed the program (Edit 3).
    These ones I've just upload are good. Take a look at them please.

    edit: Files of the same type (for example typeC_1 and typeC_2) are the same level, only the timestamp changes. In the file you can see four important changes. The first byte, the last byte, and two intervals of 6 and 8 bytes that starts in different places depending of the type of the level.
     

    Attached Files:

  20. clemull
    This message by clemull has been removed from public view by Sicklyboy, Nov 19, 2014, Reason: One word post.
    Nov 19, 2014
  21. jl1990
    OP

    jl1990 Member

    Newcomer
    12
    5
    Sep 2, 2014
    Looks like this can be too useful now :P