Ejemplo n.º 1
0
        private static void Reboot()
        {
            Console.WriteLine("Wait rebooting...");

            Telnet.Send("reboot");
            Telnet.Close();
            // If success than connection true, so next exceptions will be depended on booting device

            System.Threading.Thread.Sleep(rebootTimeOutS * 1000);
            while (!Telnet.IsConnected)
            {
                try
                {
                    Telnet.Connect();
                }
                catch
                {
                    // wait when router boot
                    System.Threading.Thread.Sleep(1000);
                }
            }
            Console.WriteLine("Successful reboot!");

            ChangeTtl();
        }
Ejemplo n.º 2
0
 private static void ChangeTtl()
 {
     Console.WriteLine("TTL changing...");
     // Firewall command for set TTL
     Telnet.Send("iptables -t mangle -I POSTROUTING -o \"${WAN_IF}\" -j TTL --ttl-set 128");
     Telnet.Send("iptables -I PREROUTING -t mangle -d 8.8.8.8 -j TTL --ttl-set 128");
     Console.WriteLine("TTL changed!");
 }