I want to create a program in C that displays the router password using telnet protocol. The instruction to do that from cmd is:
- open CMD
- Type
telnet <router ip>
- Type the router dashboard User
- Type the router dashboard password
- Type wireless default
I try with
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(int argc, char *argv[])
{
system("telnet 192.168.1.1");
system("Menara");
system("Menara");
system("wireless default");
system("PAUSE");
return 0;
}
but the program stops at the second argument so I assume that system()
cannot communicate with telnet. Can someone give me the correct code?