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,228
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
46
Location
Engine room, learning
XP
15,662
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: 339

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • K3Nv2 @ K3Nv2:
    For a kids aspect Anbernic would be the better option they'd probably melt over the price on a good 4k display
    +1
  • BigOnYa @ BigOnYa:
    For that texasroo guy, I'd recommend the Spell and speak as his first system.
    +1
  • K3Nv2 @ K3Nv2:
    So they buy a pi5 kit for about $150 and say a 28" 4k display probably looking around $400 total
  • K3Nv2 @ K3Nv2:
    They'll be getting in the territory of portable Pcs anyway
    +1
  • BigOnYa @ BigOnYa:
    Again you get what you pay for, its like buying a S series for $300 but its only 1440p native, if you want true 4k, gotta get the X model for $500. But yea you right, when moms buying it anyways, you gotta stay cheap.
  • K3Nv2 @ K3Nv2:
    They could use HD out on their TV no real need for a monitor these days tbh the purists will disagree
  • K3Nv2 @ K3Nv2:
    I'm kind of phasing out on the need for wanting all these consoles cool to have but they just become dust build ups
  • BigOnYa @ BigOnYa:
    I here ya there, I have too many myself, and have hard time letting them go, since most of mine I've modded at some point. Anymore I just play Switch on the go, seriesx at home.
  • Xdqwerty @ Xdqwerty:
    ack my throat
  • K3Nv2 @ K3Nv2:
    I need to invest in some storage totes tbh
  • BigOnYa @ BigOnYa:
    Tots?
  • K3Nv2 @ K3Nv2:
    Tootles
  • BigOnYa @ BigOnYa:
    Tootles? Wtf
  • K3Nv2 @ K3Nv2:
    Oh tootles
  • BigOnYa @ BigOnYa:
    Oh totes , lol, like Tupperware storage, I gotcha
  • BigOnYa @ BigOnYa:
    I'm designing my own entertainment cabinet for my man cave, to store all my systems, then I'm also designing a power supply/HDMI switcher so I can switch to whichever system I want, and power it also. Already picked up the cabinet board, but tinkering with my drawings before start
  • BigOnYa @ BigOnYa:
    But yea, I have frogger arcade cabinet that I gutted and put a Pi4 then Pi5 into, but it never gets played much anymore, should sell it. Even when the kids come over, they don't want to play on it, just the xbox. TMNT and Simpson's arcade is still so fun on it, esp w 2 players.
  • K3Nv2 @ K3Nv2:
    Gonna check out the new Garfield looks like garbage
  • BigOnYa @ BigOnYa:
    Can't wait to see the new "stick" that can actually play Ps3 or 360 games. I know they are getting close.
  • BigOnYa @ BigOnYa:
    @Xdqwerty didn't you see the new garfield?
  • K3Nv2 @ K3Nv2:
    Ah it's all animated I was hoping for some live action
    +1
  • Xdqwerty @ Xdqwerty:
    @BigOnYa, yes i did
  • T @ TheSusKing:
    does anyone know if you can run android apps on a usb
  • K3Nv2 @ K3Nv2:
    You mean use a external usb thumb drive as storage? Yeah it depends on the phone
  • T @ TheSusKing:
    no, i mean if i could store the app on the usb so it doesnt take up my storage
    T @ TheSusKing: no, i mean if i could store the app on the usb so it doesnt take up my storage