dji-log-parser
dji-log-parser copied to clipboard
Phantom 4 compatibility
Hello,
It seem's to not be compatible with Phantom 4 FlightRecord. How to make it compatible ?
Thanks,
Regards.
FlightRecords are now encrypted by the DJI Go app (since 2.8.4)
More info here
- http://reverseengineering.stackexchange.com/questions/13409/help-me-reverse-this/13429
- http://www.phantompilots.com/threads/tool-win-offline-txt-flightrecord-to-csv-converter.70428/page-16
Was there ever an update on this? Any publicly available way to decode them?
Unfortunately I don't have a drone available at the moment in order to check this out.
If you've got any encrypted log files, feel free to send them over and i'll take a look.
Here's a couple from the Mavic Pro - encrypted using the same app as the Phantom 4 and Inspire 2.
@mikeemoo i already rewrite some part of the lib to work properly with encrypted dataframes. My only missing piece is the getKey() function which i understand the logic but doesn't work...
I also collect some frames on which the key is easy to reverse (frames containing fields with zero values, which a xor return the key)
Feel free to contact me in private.
Hi @lvauvillier I would like to help you with this, but I am unfamiliar with the new DJI format. Any pointers to get going?
@tonymorris
- The "detail" frame remains unchanged and raw.
- For the others, the logic of parsing the frame type and frame length remains also the same, but there is is two more bytes in the data frame : one at the beginning and one at the end. Each data frames are encrypted with a specific key.
- To decode the frame, the 8 bytes key is simply XORed across the data.
The getKey() function is my only missing part. The key is computed from the first byte, a fixed seed and the frame length using a CRC64. I'm not sure for the frame length, but i can say that two different frames with the same first byte may have not the same key. This is my only missing part.
To go further i suggest you to read the two linked posts in my previous reply.
@lvauvillier I was planning on going public with my (free) website for DJI logs just when DJI started encrypting logs. I got as far as you did and have observed:
- Position of frame within file is not relevant, only the parameters you have mentioned are needed to generate the key, e.g. frames with same message type and length have always the same key
- Identical frames have the same additional second byte, but frames of same message type and different data have not. Makes me believe it is some kind of checksum
- I've asked one of the guys who managed to decode the encryption in the phantom pilots forum for help, but they won't provide the solution nor did he answer a PN for hints. I personally find that a bit annoying since ot was the same group who asked for public help on the reverse engineering site.
- The fact that it did not take them very long to decode the messages as soon as they knew what we know here makes me think it can't be too complicated but I could be wrong.
- Happy to support so that we can solve this
I'm interested in getting the flight data logs decoded as well.
Anyone have any luck with this?
The XOR key is generated for every possible value so you have 4096 possibilities. Which can be obtained by calling the function in the C lib. Hope it helps :)
Now fixed by #15 !
Thanks a lot @TecHunter for the tip !
Hi @lvauvillier how to get your #15 release ? (sorry I don't realy know GitHub)
I'm not the owner. I cannot release it on npm. You can download the working project from my repo and add it manually to your project.
Great thanks. Did you succeed in decoding a recent encrypted DJI log ? I don't succeed in it with your update.
Can you send me your log file ? I'll give a try.
It works for me. Are you running it within your browser or using nodejs ?
Good new thanks :) I'm running it with my browser
@skylow48 Fixed !
It works :) thanks a lot
Sorry I tested the wrong file... it doesn't work, but I'm not sure to run the right function : I test it from "exemples/browser-example.html" : is it correct ?
Yes it is correct. But the sample use a compiled version of the library (browser.js) and i push only the modified source files.
I just add a build script and an updated browser.js version to my repo.
Everything should work for you now.
You are the best, thanks :)
I also update my online visualisation demo with the new parser version : https://flighttrack.now.sh
You can easily check your encrypted flight logs and report bug if it is not working.
Very nice! Did you manage to recover the battery SN ? And the pictures ? How to report a bug out of Github (do you have a bug reporting tool ?)
Pictures are my next step. Stay tuned
First Image extraction is working :) You can test it with my repo's code. (code sample in example.js)
@skylow48 you can report bugs opening issues here or on my repo. @mikeemoo are you still working on this project ? If you have no time for it, i propose to help you to maintain this library.
Nice ! :) But I don't know how to use node.js, do you have a way to test your code in HTML/javascript or better : in C# ?
I update the browser sample with an image extraction code
That works perfectly :) thanks ! Do you have an easy way to convert your script into C# to run it in a winform ?