Skip to content

Instantly share code, notes, and snippets.

@shafzhr
Created July 25, 2019 22:13
Show Gist options
  • Select an option

  • Save shafzhr/6144959cc6bb6a1276e8aca98de2aacd to your computer and use it in GitHub Desktop.

Select an option

Save shafzhr/6144959cc6bb6a1276e8aca98de2aacd to your computer and use it in GitHub Desktop.
Open Door With Modem
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