X-Git-Url: https://git.sur5r.net/?p=gsconf;a=blobdiff_plain;f=shell.c;h=8f32679f4eda10aa26c7dd2bdf0fc02aef4d4ce3;hp=eceb152184c93961feefddc1128a9671fb8de511;hb=HEAD;hpb=bdf95351d3563e4039ee2cc229452d78b3b6a612 diff --git a/shell.c b/shell.c index eceb152..8f32679 100644 --- a/shell.c +++ b/shell.c @@ -67,7 +67,6 @@ void printError(int errCode) { void shell_set(char ** argv, int elem) { - int n; if (strncmp(argv[1], "name", 4) == 0) { if (elem != 3) { printf("set name [name]\n"); @@ -77,10 +76,17 @@ void shell_set(char ** argv, int elem) { } } +char * copyString(char * data) { + char * ret = (char * )malloc(strlen(data) + 1); + memcpy(ret, data, strlen(data) + 1); + ret[strlen(data)] = 0; + return ret; +} + 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 = 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: ")); } } @@ -209,6 +215,14 @@ int shell (void) { shell_port(argv, elem); } + if (strncmp(argv[0], "sys", 3) == 0) { + shell_sys(argv, elem); + } + + if (strncmp(argv[0], "help", 4) == 0) { + printf("Available commands: \n"); + printf("[discover|select|nodev|ip|vlan|port|sys] \n"); + }