Created
July 25, 2019 22:13
-
-
Save shafzhr/6144959cc6bb6a1276e8aca98de2aacd to your computer and use it in GitHub Desktop.
Open Door With Modem
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| using System.Diagnostics; | |
| using System.Threading; | |
| namespace Door | |
| { | |
| public class OpenDoor | |
| { | |
| public static void Open() | |
| { | |
| ProcessStartInfo startinfo = new ProcessStartInfo | |
| { | |
| FileName = @"C:\Program Files\PuTTY\plink.exe", | |
| Arguments = "-load MODEM" | |
| }; | |
| Process process = new Process { StartInfo = startinfo }; | |
| process.StartInfo.UseShellExecute = false; | |
| process.StartInfo.RedirectStandardInput = true; | |
| process.StartInfo.CreateNoWindow = true; | |
| process.Start(); | |
| process.StandardInput.WriteLine("atz"); | |
| Thread.Sleep(2000); | |
| process.StandardInput.WriteLine("ATX3DT##11"); | |
| Thread.Sleep(3000); | |
| process.StandardInput.WriteLine("atz"); | |
| try | |
| { | |
| Process[] proc = Process.GetProcessesByName("plink"); | |
| proc[0].Kill(); | |
| System.Console.WriteLine("Done."); | |
| } | |
| catch (Exception e) | |
| { | |
| System.Console.WriteLine(e); | |
| } | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment