static void Main(string[] args) { // var exploit = new WebExploiter("192.168.1.254", "8894501933"); // exploit.EnableBackdoor(true); var fixer=new ProblemFixer("192.168.1.254", 28, "8894501933"); fixer.DisableDhcp(); //fixer.FactoryReset(); return; //create a new telnet connection to hostname "gobelijn" on port "23" TelnetConnection tc = new TelnetConnection("192.168.1.254", 23); //login with user "root",password "rootpassword", using a timeout of 100ms, //and show server output string s = tc.Login("admin", "0387371392", 1000); Console.Write(s); // server output should end with "$" or ">", otherwise the connection failed string prompt = s.TrimEnd(); prompt = s.Substring(prompt.Length - 1, 1); if (prompt != "$" && prompt != ">") throw new Exception("Connection failed"); prompt = ""; // while connected while (tc.IsConnected) { // display server output Console.Write(tc.Read()); // send client input to server prompt = Console.ReadLine(); tc.WriteLine(prompt); // display server output Console.Write(tc.Read()); } Console.WriteLine("***DISCONNECTED"); Console.ReadLine(); }
void Reboot(string address, string password) { lock(ConnectionLocker) { try { var exploit=new WebExploiter(address, password, Logger); exploit.EnableBackdoorIfNeeded(); var fixer=new ProblemFixer(address, 28, password, Logger); fixer.Reboot(); Logger.Log("Rebooted"); } catch (SocketException e) { Logger.Log("Error: " + e.Message); Logger.Log("It appears that the port 28 backdoor is not installed or not working properly!"); } catch(Exception ex) { Logger.Log("Error: "+ex.Message); } Logger.Log("Done!"); } }
void DumpInfo(string address, string password) { string output = ""; lock(ConnectionLocker) { try { var exploit=new WebExploiter(address, password, Logger); exploit.EnableBackdoorIfNeeded(); var fixer=new ProblemFixer(address, 28, password, Logger); output=fixer.DumpInfo(); } catch (SocketException e) { Logger.Log("Error: " + e.Message); Logger.Log("It appears that the port 28 backdoor is not installed or not working properly!"); } catch(Exception ex) { Logger.Log("Error: "+ex.Message); } Logger.Log("Done!"); RunOnUiThread(() => { ConfigText.Text=output; });; } }
void DisableTelnet(string address, string password) { lock(ConnectionLocker) { try { var fixer = new ProblemFixer(address, 28, password, Logger); fixer.UninstallBackdoor(); Logger.Log("Backdoor will be uninstalled next time your modem is rebooted!"); Logger.Log("To enable the backdoor again, you must first reboot your modem"); Logger.Log("Note: All existing configuration will be persisted until a factory reset is done"); } catch (SocketException e) { Logger.Log("Error: " + e.Message); Logger.Log("It appears that the port 28 backdoor is not installed or not working properly!"); } catch(Exception ex) { Logger.Log("Error: "+ex.Message); } Logger.Log("Done!"); } }