Homebrew Cubic Ninja QR-CODE

jl1990

Member
OP
Newcomer
Joined
Sep 2, 2014
Messages
12
Trophies
0
Age
34
XP
155
Country
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:

This is how the file that I have looks like in hex (the byte array that I extracted from QR):

2ql8wld.jpg


PD: The QR I used:

rs6ddf.jpg

Edit2:

Ok, Cubic Ninja QR-Codes contains a timestamp, so for each level every time you generate a QR-Code you get a new different QR-Code.
The game allows you to create 3 kinds of levels (Type A, Type B or Type C). I have created an empty A type level and generated two QR-Codes from it, so the only data that can change is the timestamp.

QR 1:
Image:
dhftbs.jpg


Data:
r03t6c.jpg

QR 2:
Image:
14dq9s3.jpg


Data:
1zzg607.jpg

I uploaded the QR binaries so you can see the data more easily.

Edit3:
I got it working, now I can make equivalent and clean QR-Codes. I was getting the bytes as UTF-8 and looks like it should be ISO-8859-1 codification.

Now the data has quite more sense.

I'm going to refactor my code to give you my Java QR Extract tool. See you in a while!

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
 

jl1990

Member
OP
Newcomer
Joined
Sep 2, 2014
Messages
12
Trophies
0
Age
34
XP
155
Country
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:
 

NCDyson

Hello Boys...
Member
Joined
Nov 9, 2009
Messages
278
Trophies
1
XP
319
Country
United States
its more than likely encrypted. i dunno much about QR codes and the encoding, so it could be something more simple
 

YoshiInAVoid

Banned!
Banned
Joined
Jan 10, 2011
Messages
560
Trophies
1
Website
google.com
XP
465
Country
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.
 

lemonmeister

Member
Newcomer
Joined
Apr 7, 2013
Messages
18
Trophies
0
XP
160
Country
United States
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
 

jl1990

Member
OP
Newcomer
Joined
Sep 2, 2014
Messages
12
Trophies
0
Age
34
XP
155
Country
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.

Funny, but this is not a funny thread. This is a serious post, try to keep it clean please.

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

yeah i noticed an awful lot of EFBFBD

but then again i have no idea how all this stuff works :lol:

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 ;)
 

VinsCool

Persona Secretiva Felineus
Global Moderator
Joined
Jan 7, 2014
Messages
14,600
Trophies
4
Location
Another World
Website
www.gbatemp.net
XP
25,204
Country
Canada
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 ;)

Interesting, if you need help for whatever level editing or any experimentation, I also have the game ;)
 

jl1990

Member
OP
Newcomer
Joined
Sep 2, 2014
Messages
12
Trophies
0
Age
34
XP
155
Country
Interesting, if you need help for whatever level editing or any experimentation, I also have the game ;)

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)
 

Cyan

GBATemp's lurking knight
Former Staff
Joined
Oct 27, 2002
Messages
23,749
Trophies
4
Age
45
Location
Engine room, learning
XP
15,646
Country
France
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.
 

jl1990

Member
OP
Newcomer
Joined
Sep 2, 2014
Messages
12
Trophies
0
Age
34
XP
155
Country
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
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.
 

jl1990

Member
OP
Newcomer
Joined
Sep 2, 2014
Messages
12
Trophies
0
Age
34
XP
155
Country
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 ^^


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.

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

elisherer

I ♥ 3DS
Member
Joined
Dec 16, 2009
Messages
778
Trophies
0
Location
3dbrew.org
Website
www.sherer.co.il
XP
392
Country
Iceland
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)
 

jl1990

Member
OP
Newcomer
Joined
Sep 2, 2014
Messages
12
Trophies
0
Age
34
XP
155
Country
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)

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.
 

Attachments

  • QR3DS.rar
    2.1 KB · Views: 334

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
    The Real Jdbye @ The Real Jdbye: i always pee in the water