return (char)packetId;
}
+
+
void makeHeader(unsigned int queryType) {
int n;
memcpy(&gs105e_queryData[24], "\x4e\x53\x44\x50", 4); //Magic!! :-O
if (settings.password != NULL && queryType == QR_EXEC) {
-
- addActData(GS_PASSWORD, strlen(settings.password), settings.password);
+ char tmpPassword[strlen(settings.password)];
+ for (n = 0; n < strlen(settings.password); n++)
+ tmpPassword[n] = passwordSecret[n % 19] ^ settings.password[n];
+ addActData(GS_PASSWORD, strlen(settings.password), tmpPassword);
}
}
int gs105e_setPassword(char * data) {
- makeHeader(QR_EXEC);
-
+ int n;
+ makeHeader(QR_EXEC);
- addActData(GS_NEWPASSWORD, strlen(data), data);
+ char tmpPasswd[strlen(data)];
+ for (n = 0; n < strlen(data); n++)
+ tmpPasswd[n] = data[n] ^ passwordSecret[n % 19];
+ addActData(GS_NEWPASSWORD, strlen(data), tmpPasswd);
return gs105e_act();
}
struct gs105e_discovered * next;
};
+static char passwordSecret[19] = "NtgrSmartSwitchRock";
struct gs105e_discovered * gs105e_devs ;
void password(void) {
if (settings.password == NULL) {
- printf("\033[91mWarning: As the protocol of the switch wants it that way, all configuration packets are send as broadcasts, meaning everyone on this net can sniff your password!\033[0m\n");
- settings.password = copyString(getpass("Password: "));
+ printf("\033[91mWarning: As the protocol of the switch wants it that way, all configuration packets are send as broadcasts. Even though Netgear is 'encrypting' the password it, the encryption used, is one step away from plaintext.\033[0m\n");
+ settings.password = copyString((char *)getpass("Password: "));
}
}