So I pulled the dsh binary off a firmware image and disassembled it with Ghidra to take a look at this whole Domain Account thing.
Long story short, it uses public key encryption so unless Dahua's private certificate leaks, there's no way to calculate valid check codes.
What happens is that when you run the "shell" command, it collects a bunch of data, mostly random numbers and the current time, as well as the device's MAC address and serial number. This gets encrypted with Dahua's public key, and is passed as the "t" parameter in that URL you get from the QR code.
Dahua decrypt the value, use the third byte in the MAC address (mod 0x18) as an offset, then read four bytes at that offset. They convert those bytes into an 8-digit ASCII hex string and return that, which is what you type in to the "check codes" prompt.
If those eight characters/four bytes match the value originally calculated, and not too much time has passed since the QR code was generated, then it will launch /bin/busybox. It also appears to do some other stuff around alerting as well - maybe just recording the login attempt in the logs or something.
Unfortunately since it is using public key cryptography, it's impractical to decode the values needed from the QR code URL. If we had Dahua's private key then it could be done, but no doubt they guard that very closely.
EDIT: Also, it confirmed that the "diagnose 7" command does nothing. They just have an off-by-one error when they check whether the parameter is valid. The diagnose commands also don't pass any user input into the actual system() call, so there are no injection vulnerabilities available there.