You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
969 B
40 lines
969 B
using System;
|
|
using System.Net;
|
|
using System.Management.Automation;
|
|
|
|
namespace KnockKnock.CLI
|
|
{
|
|
internal class Program
|
|
{
|
|
static void Main(string[] args)
|
|
{
|
|
Lib.Manager m = new Lib.Manager();
|
|
Lib.Proxy p = new Lib.Proxy(new IPEndPoint(IPAddress.Any, 1234), new IPEndPoint(IPAddress.Parse("10.200.0.10"), 3389));
|
|
p.Idle += P_Idle;
|
|
p.Active += P_Active;
|
|
m.AddProxy(p);
|
|
//m.AddProxy(new IPEndPoint(IPAddress.Any, 1234), new IPEndPoint(IPAddress.Parse("172.217.14.195"), 80));
|
|
P_Active(p);
|
|
Console.WriteLine("Running");
|
|
Console.ReadLine();
|
|
m.Close();
|
|
Console.WriteLine("Good night!");
|
|
}
|
|
|
|
private static void P_Active(Lib.Proxy sender)
|
|
{
|
|
Console.WriteLine("Active!");
|
|
PowerShell ps = PowerShell.Create();
|
|
ps.AddScript("Resume-VM Debian");
|
|
foreach (PSObject result in ps.Invoke())
|
|
{
|
|
Console.WriteLine(result);
|
|
}
|
|
}
|
|
|
|
private static void P_Idle(Lib.Proxy sender)
|
|
{
|
|
Console.WriteLine("Idle");
|
|
}
|
|
}
|
|
}
|
|
|