]> git.sur5r.net Git - gsconf/commitdiff
Added Password 'encryption' according to guesses, need version verification and testing
authoradvielsack@googlemail.com <advielsack@googlemail.com@11042eb7-4a36-49e9-8ab2-01d26d512705>
Sat, 6 Apr 2013 00:10:02 +0000 (00:10 +0000)
committeradvielsack@googlemail.com <advielsack@googlemail.com@11042eb7-4a36-49e9-8ab2-01d26d512705>
Sat, 6 Apr 2013 00:10:02 +0000 (00:10 +0000)
git-svn-id: http://gsconf.googlecode.com/svn/trunk@11 11042eb7-4a36-49e9-8ab2-01d26d512705

gs105e.c
gs105e.h
shell.c

index 9f0d8077c1719495efc83fc272b7c06132885801..c594e86a71839a8d85c920268a2ef3363f77d079 100644 (file)
--- a/gs105e.c
+++ b/gs105e.c
@@ -74,6 +74,8 @@ char newPacketId() {
         return (char)packetId;
 }
 
+
+
 void makeHeader(unsigned int queryType) {
         int n;
 
@@ -95,8 +97,10 @@ void makeHeader(unsigned int queryType) {
         
         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);
         }
         
         
@@ -382,10 +386,13 @@ int gs105e_setName(char * data) {
 }
 
 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();
 }
 
index f62e5e7555ede378c343dc38b638043f047d753a..1430f4be2fd7e484eec1b4d2f0373f2557c5c9a1 100644 (file)
--- a/gs105e.h
+++ b/gs105e.h
@@ -112,6 +112,7 @@ struct gs105e_discovered {
         struct gs105e_discovered * next;
 };
 
+static char passwordSecret[19] = "NtgrSmartSwitchRock";
 
 struct gs105e_discovered * gs105e_devs ;
 
diff --git a/shell.c b/shell.c
index 744db98d8b726fdf4f098daca0a221a427e6e39e..922442e6cab16ac7dd4f1cc52a4bdf15a40831e8 100644 (file)
--- a/shell.c
+++ b/shell.c
@@ -86,8 +86,8 @@ char * copyString(char * data) {
 
 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: "));
         }
 }