Created
August 15, 2023 18:03
-
-
Save exelix11/94d1f87b66ce2468f67fa1f17b7bc829 to your computer and use it in GitHub Desktop.
Reolink NVR super password
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Calculates the password reset "super password" that reolink support can give you if you forget your NVR password. | |
// May work only on specific models. | |
// Original code can be found in the router binary in the firmware files, look for constant 3703 or string "MSG_AUTH_FORGET_PWD_LOGIN" | |
var key = "1987304876298745017645449830875611094356923076019854398671285463"; | |
string find_key(string seed) | |
{ | |
char[] pass = new char[4 * 8]; | |
pass[0] = key[seed[0] >> 2]; | |
pass[1] = key[((16 * seed[0]) & 0x30) + (seed[1] >> 4)]; | |
pass[2] = key[((4 * seed[1]) & 0x3C) + (seed[2] >> 6)]; | |
pass[3] = key[seed[2] & 0x3F]; | |
pass[4] = key[seed[3] >> 2]; | |
pass[5] = key[((16 * seed[3]) & 0x30) + (seed[4] >> 4)]; | |
pass[6] = key[((4 * seed[4]) & 0x3C) + (seed[5] >> 6)]; | |
pass[7] = key[seed[5] & 0x3F]; | |
pass[8] = key[seed[6] >> 2]; | |
pass[9] = key[((16 * seed[6]) & 0x30) + (seed[7] >> 4)]; | |
pass[10] = key[(4 * seed[7]) & 0x3C]; | |
var sum = seed.Select(x => (int)x).Sum(); | |
pass[11] = key[sum % 10]; | |
for (int i = 0; i != 12; ++i) | |
pass[i] = key[(pass[i]) % 10]; | |
pass[12] = '\0'; | |
return new string(pass); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment