DJI Mavic, Air and Mini Drones
Friendly, Helpful & Knowledgeable Community
Join Us Now

[Mavic Mini] Re enable developer tools in DJI Assistant 2

Droning on and on...

Well-Known Member
Joined
Feb 11, 2018
Messages
2,840
Reactions
2,442
Location
Santa Cruz, CA
I've been playing around with the DJI Assistant 2 with the Mini and figured out how to enable the developer tools back. I wasn't able to do much with them but maybe someone can figure out how to write the config params like in the other Mavics?

Assistant still is an Electron based application but now everything is "compiled" into an asar file. So first you need to decompile it with:

npx asar extract app.asar app

Then you'll have to edit two lines in main.js

var debug = false

Change it to true.
And uncomment the developer tools line:

mainWindow.webContents.openDevTools()

If you compile this folder into an asar, replace the original asar file and run Assistant , you'll see a new button onthe top left corner that says "Developer tools":

2cXUe0Y.png


If you click it and open electron's dev tools (CTRL SHIFT I if im not mistaken) you'll see it's trying to find the file "tools.html". It's is not packaged anymore with Assistant. But you can import it from Assistant 1.1.2! Google it, unpack the asar and import the following files:


Code:
./build/base.css
./build/a3.css
./build/tools.css
./build/locale.js
./build/utils.js
./build/ws.js
./build/dass.js
./build/tools.js

Some files might already exist in your newer asar file, don't replace them. Once you added those files, repackage the folder with

asar pack ./app app-tools-hack.asar

Replace the original asar folder, start assistant, plug your mini and click developer tools.

You'll see somehting like this:


Bj0tXf8.png


Click on open connection and send this payload:

{“SEQ”:“123456”,“CMD”:“}

You'll get back a base64 string that seems to be encrypted.

Things to think about:

1) How to decrypt what assistant sends back
2) Can we send parameters and write to the mini?
3) Can we enable/disable cool things?

Hopefully someone smarter than me can figure this out. Let me know if something is not clear to you.
 
Nope, nothing happens when you plug the mini while running 1.1.2.

I tried to import all the wm160 files to the 1.1.2 asar and still nothing
 
Found the decryption key, its right there inside ws-v2.js. Search for secret_key_dec. Mini returns a huge list of functions, some of them start with "preHash". No references to nfz or airport. Wonder if we can do something interesting with that.
 
secret_key_enc can be used to send commands to the mini. So far when trying to read anything ({"SEQ":"123456","CMD":"read","INDEX":"g_config_go_home_fixed_go_home_altitude"}) I'm getting "ERROR_STEP_CODE":1,"ERROR_SUB_CODE":10,"ERROR_TYPE_CODE":4
 
  • Like
Reactions: Sali
Hoping this leads somewhere. I just got my Mini today and I'm already interested in hacking it...waypoints anyone? Maybe higher bitrates and use of the full 4k sensor?

Brand new to DJI so I'm not sure how they handle these things yet.
 
Me too I try to modify the assistant 2.08 or 2.010 unpacking asar and write mod , but better another way:
With Python command : a) install python on your pc , b) install dji-firmware-tools o-gs/dji-firmware-tools , inside you found the latest comm_og_service_tool.py updated with mavic 2 and mini mavic (wm160) then sending command from window , using python you can read parameter and change .
in order to read : C:\........\dji-firmware-tools-master\comm_og_service_tool.py -vvv com5 WM160 FlycParam getvert_vel_down_adding_max --alt
In order to write : C:\.........\dji-firmware-tools-master\comm_og_service_tool.py -vvv com5 WM160 FlycParam setvert_vel_down_adding_max -7 --alt as example to write -7 at the vel_down parameter ......same for other parameter including battery_type
Default Value Min Max Parameter index
battery_type 1 0 3 960
 
Here an example of mini parameter extracted with python
 

Attachments

  • DA8E6BB1-A446-4918-8459-DCA052D1CECA.png
    DA8E6BB1-A446-4918-8459-DCA052D1CECA.png
    307.3 KB · Views: 427
This is interesting! I got a feeling that the MM has alot more to give. Like signal strength and so on. Sometimes it is so rocksolid on the signal and sometimes it is not. And this is in the same place?

My other drones that I built myself act like this if I change the watt on the signal. Wondering if Dji have a SW that regulate this?
 
In any case me too I try to found the way1575370004597.png to enter in debug mode ....but until now I arrived only here
 
Me too I try to modify the assistant 2.08 or 2.010 unpacking asar and write mod , but better another way:
With Python command : a) install python on your pc , b) install dji-firmware-tools o-gs/dji-firmware-tools , inside you found the latest comm_og_service_tool.py updated with mavic 2 and mini mavic (wm160) then sending command from window , using python you can read parameter and change .
in order to read : C:\........\dji-firmware-tools-master\comm_og_service_tool.py -vvv com5 WM160 FlycParam getvert_vel_down_adding_max --alt
In order to write : C:\.........\dji-firmware-tools-master\comm_og_service_tool.py -vvv com5 WM160 FlycParam setvert_vel_down_adding_max -7 --alt as example to write -7 at the vel_down parameter ......same for other parameter including battery_type
Default Value Min Max Parameter index
battery_type 1 0 3 960


Smart! Have you tried this on linux? For some reason I cannot connect to the websocket in linux.
I'll try it out today. Thanks!
 
In any case me too I try to found the wayView attachment 87175 to enter in debug mode ....but until now I arrived only here

Thats all you can enable! You can send commands in the window weith the "socket url" box. Theres a box next to it that allows you to send stuff to the drone. Bear in mind that i has to be necrypted first with the secret_key_enc key
 
Do you kn
I've been playing around with the DJI Assistant 2 with the Mini and figured out how to enable the developer tools back. I wasn't able to do much with them but maybe someone can figure out how to write the config params like in the other Mavics?

Assistant still is an Electron based application but now everything is "compiled" into an asar file. So first you need to decompile it with:

npx asar extract app.asar app

Then you'll have to edit two lines in main.js

var debug = false

Change it to true.
And uncomment the developer tools line:

mainWindow.webContents.openDevTools()

If you compile this folder into an asar, replace the original asar file and run Assistant , you'll see a new button onthe top left corner that says "Developer tools":

2cXUe0Y.png


If you click it and open electron's dev tools (CTRL SHIFT I if im not mistaken) you'll see it's trying to find the file "tools.html". It's is not packaged anymore with Assistant. But you can import it from Assistant 1.1.2! Google it, unpack the asar and import the following files:


Code:
./build/base.css
./build/a3.css
./build/tools.css
./build/locale.js
./build/utils.js
./build/ws.js
./build/dass.js
./build/tools.js

Some files might already exist in your newer asar file, don't replace them. Once you added those files, repackage the folder with

asar pack ./app app-tools-hack.asar

Replace the original asar folder, start assistant, plug your mini and click developer tools.

You'll see somehting like this:


Bj0tXf8.png


Click on open connection and send this payload:

{“SEQ”:“123456”,“CMD”:“}

You'll get back a base64 string that seems to be encrypted.

Things to think about:

1) How to decrypt what assistant sends back
2) Can we send parameters and write to the mini?
3) Can we enable/disable cool things?

Hopefully someone smarter than me can figure this out. Let me know if something is not clear to you.
Do you know that you don't need to repack asar file is enought to replace one string in tha package.json

{
"name": "DJIAssistant2",
"version": "0.0.1",
"main": "main.js",
"scripts": {
"start": "electron ."
}
}

in this case you adress to direct to main and not to asar , so will be enough to put all asar file in DJIApp folder see image
but be carful you need to add the mini file wm160
1575370641722.png
 
I hope to found the way with assistant , because i recognize that python for many people is not easy ....but with python is possible to modify all visible mini parameter i can assure you
 
Indeed it's way easier with the script you shared. Of course going above the range of values gets ignored by the drone (I've sent 501 to "g_config.flying_limit.max_height_0" and 500 gets written into that property)
 
  • Like
Reactions: MaverickMavicMark
Unfortunately ...clear not possible to change max height or nfz ...is like air
 
Yeah but they accept user input. There has to be an attack surface we can use :D
 
  • Like
Reactions: Meeko
Lycus Tech Mavic Air 3 Case

DJI Drone Deals

New Threads

Forum statistics

Threads
130,585
Messages
1,554,095
Members
159,585
Latest member
maniac2000