diff --git a/ControlApp/Utils.cs b/ControlApp/Utils.cs index f6b92f5..0e0848f 100644 --- a/ControlApp/Utils.cs +++ b/ControlApp/Utils.cs @@ -28,7 +28,7 @@ internal class Utils private const int SPIF_SENDWININICHANGE = 2; - private string[] bannedlist = new string[6] { "booru.allthefallen.moe", "mega.nz", "thecontrolapp.co.uk/Pages/ControlPC", "paradroid-gamma.vercel", "imagekit.io/tools/asset-public-link", "paradroid-gamma.web.app" }; + private string[] bannedlist = new string[1] { "thecontrolapp.co.uk/Pages/ControlPC", }; private string[] bannedref = new string[2] { "money", "pay" }; @@ -36,19 +36,21 @@ internal class Utils public void writetolog(string shortvr, string longvr) { - shortvr = shortvr + "~~" + Decrypt(shortvr); - longvr = longvr + "~~" + Decrypt(longvr); - if (ConfigurationManager.AppSettings["Logging"] == "On") + writetolog(shortvr, longvr, false); + } + + public void writetolog(string shortvr, string longvr, bool isDecrypted) + { + if (!isDecrypted) { - if (ConfigurationManager.AppSettings["Logging"] == "On") - { - File.AppendAllText("log.txt", shortvr); - } - else - { - File.AppendAllText("log.txt", longvr); - } + shortvr = Decrypt(shortvr); + longvr = Decrypt(longvr); } + shortvr = shortvr + "\n"; + longvr = longvr + "\n"; + File.AppendAllText("log.txt", shortvr); + File.AppendAllText("log.txt", longvr); + Console.WriteLine($"{shortvr}: {longvr}"); } public string[] GetLatestItem() @@ -68,7 +70,7 @@ internal class Utils } catch (Exception ex) { - writetolog("Error running process \n\r", ex.Message); + writetolog("Error running process", ex.Message); } return ret; } @@ -206,7 +208,7 @@ internal class Utils { ret = false; new CustomMessage("Sending file to server failed", "", 4, tts: false).ShowDialog(); - writetolog("Error sending ftp process \n\r", ex.Message); + writetolog("Error sending ftp process", ex.Message); } return ret; } @@ -255,7 +257,7 @@ internal class Utils } catch (Exception ex) { - writetolog("Error getting outstanding \n\r", ex.Message); + writetolog("Error getting outstanding", ex.Message); } return returned; } @@ -314,10 +316,11 @@ internal class Utils ToReturn = ToReturn.Replace("]", "aaa"); ToReturn = ToReturn.Replace("G0", "ppp"); ToReturn = ToReturn.Replace("0x", "lll"); + writetolog("Encrypted: " + Line , ToReturn, true); } catch (Exception ex) { - writetolog("Error enrypt " + Line + "\n\r", ex.Message); + writetolog("Error enrypt " + Line , ex.Message, true); } return ToReturn; } @@ -346,10 +349,11 @@ internal class Utils cryptoStream.Write(inputbyteArray, 0, inputbyteArray.Length); cryptoStream.FlushFinalBlock(); ToReturn = Encoding.UTF8.GetString(ms.ToArray()); + writetolog("Decrypted: " + Line , ToReturn, true); } catch (Exception ex) { - writetolog("Decrypt error for : " + Line + "\n\r", ex.Message); + writetolog("Decrypt error for : " + Line , ex.Message, true); } return ToReturn; } @@ -379,7 +383,7 @@ internal class Utils catch (Exception ex) { filename = "FAILED"; - writetolog("Error getting file for : " + url + "\n\r", ex.Message); + writetolog("Error getting file for : " + url , ex.Message); } return filename; } @@ -618,8 +622,8 @@ internal class Utils if (inbanned) { new CustomMessage("Message contains potential bad stuff closing", "", 4, tts: false).ShowDialog(); - writetolog("Banned content found in message", what); - break; + writetolog("Banned content found in message", what); + break; } if (what.Substring(0, 3) == "FTP") { @@ -640,167 +644,167 @@ internal class Utils } switch (which) { - case "D=": - { - string thefile3 = ""; - if (!isfile) - { - Process.Start(new ProcessStartInfo + case "D=": { - FileName = what, - UseShellExecute = true - }); - } - else - { - thefile3 = Get_File(what); - } - if (thefile3 != "FAILED") - { - new CustomMessage("File downloaded! Find it here : " + thefile3, "", 4, tts: false).ShowDialog(); - } - goto end_IL_0064; - } - case "P=": - { - if (!isfile) - { - Process.Start(new ProcessStartInfo - { - FileName = what, - UseShellExecute = true - }); - continue; - } - string thefile4 = ""; - thefile4 = Get_File(what); - if (thefile4 != "FAILED") - { - Change_Wallpaper(thefile4); - } - goto end_IL_0064; - } - case "L=": - { - bool done2 = false; - foreach (Form fm2 in Application.OpenForms) - { - if (fm2.GetType() == typeof(SubLoop)) - { - ((SubLoop)fm2).additem(what); - done2 = true; - } - } - if (done2) - { - continue; - } - string appDirectory = AppDomain.CurrentDomain.BaseDirectory + "\\ConstantSubList.txt"; - string filetype = Path.GetExtension(what); - if (new string[9] { ".jpg", ".jpeg", ".gif", ".mov", ".mpg", ".mpeg", ".avi", ".png", ".mp4" }.Contains(filetype)) - { - what = Get_File(what); - if (what != "FAILED") - { - using StreamWriter writer = File.AppendText(appDirectory); - writer.WriteLine("[m],[" + what + "]"); - } - continue; - } - if (!IsWebPage(what) && what != "FAILED") - { - using (StreamWriter writer2 = File.AppendText(appDirectory)) - { - writer2.WriteLine("[t],[" + what + "]"); - } - continue; - } - what = Get_File(what); - if (what != "FAILED") - { - using StreamWriter writer3 = File.AppendText(appDirectory); - writer3.WriteLine("[m],[" + what + "]"); - } - goto end_IL_0064; - } - case "R=": - { - if (!isfile) - { - continue; - } - string thefile2 = ""; - thefile2 = Get_File(what); - if (thefile2 != "FAILED") - { - if (ConfigurationManager.AppSettings["AutoRun"] == "True") - { - Process.Start(thefile2); - } - else - { - new CustomMessage("Exe downloaded! Find it here : " + thefile2, "", 4, tts: false).ShowDialog(); - } - } - goto end_IL_0064; - } - case "W=": - Process.Start(new ProcessStartInfo - { - FileName = what, - UseShellExecute = true - }); - goto end_IL_0064; - case "O=": - if (what.IndexOf("static") <= 0) - { - break; - } - goto case "U="; - case "U=": - { - if (!isfile) - { - Process.Start(new ProcessStartInfo - { - FileName = what, - UseShellExecute = true - }); - continue; - } - string thefile = ""; - thefile = Get_File(what); - if (!(thefile != "FAILED")) - { - continue; - } - string popstyle = "Serial"; - if (ConfigurationManager.AppSettings["PopStyle"] != null) - { - popstyle = ConfigurationManager.AppSettings["PopStyle"].ToString(); - } - if (popstyle == "Serial") - { - bool done = false; - foreach (Form fm in Application.OpenForms) - { - if (fm.GetType() == typeof(PopUp)) + string thefile3 = ""; + if (!isfile) { - ((PopUp)fm).add_url(thefile); - done = true; + Process.Start(new ProcessStartInfo + { + FileName = what, + UseShellExecute = true + }); } + else + { + thefile3 = Get_File(what); + } + if (thefile3 != "FAILED") + { + new CustomMessage("File downloaded! Find it here : " + thefile3, "", 4, tts: false).ShowDialog(); + } + goto end_IL_0064; } - if (!done) + case "P=": { - new PopUp(thefile).Show(); + if (!isfile) + { + Process.Start(new ProcessStartInfo + { + FileName = what, + UseShellExecute = true + }); + continue; + } + string thefile4 = ""; + thefile4 = Get_File(what); + if (thefile4 != "FAILED") + { + Change_Wallpaper(thefile4); + } + goto end_IL_0064; + } + case "L=": + { + bool done2 = false; + foreach (Form fm2 in Application.OpenForms) + { + if (fm2.GetType() == typeof(SubLoop)) + { + ((SubLoop)fm2).additem(what); + done2 = true; + } + } + if (done2) + { + continue; + } + string appDirectory = AppDomain.CurrentDomain.BaseDirectory + "\\ConstantSubList.txt"; + string filetype = Path.GetExtension(what); + if (new string[9] { ".jpg", ".jpeg", ".gif", ".mov", ".mpg", ".mpeg", ".avi", ".png", ".mp4" }.Contains(filetype)) + { + what = Get_File(what); + if (what != "FAILED") + { + using StreamWriter writer = File.AppendText(appDirectory); + writer.WriteLine("[m],[" + what + "]"); + } + continue; + } + if (!IsWebPage(what) && what != "FAILED") + { + using (StreamWriter writer2 = File.AppendText(appDirectory)) + { + writer2.WriteLine("[t],[" + what + "]"); + } + continue; + } + what = Get_File(what); + if (what != "FAILED") + { + using StreamWriter writer3 = File.AppendText(appDirectory); + writer3.WriteLine("[m],[" + what + "]"); + } + goto end_IL_0064; + } + case "R=": + { + if (!isfile) + { + continue; + } + string thefile2 = ""; + thefile2 = Get_File(what); + if (thefile2 != "FAILED") + { + if (ConfigurationManager.AppSettings["AutoRun"] == "True") + { + Process.Start(thefile2); + } + else + { + new CustomMessage("Exe downloaded! Find it here : " + thefile2, "", 4, tts: false).ShowDialog(); + } + } + goto end_IL_0064; + } + case "W=": + Process.Start(new ProcessStartInfo + { + FileName = what, + UseShellExecute = true + }); + goto end_IL_0064; + case "O=": + if (what.IndexOf("static") <= 0) + { + break; + } + goto case "U="; + case "U=": + { + if (!isfile) + { + Process.Start(new ProcessStartInfo + { + FileName = what, + UseShellExecute = true + }); + continue; + } + string thefile = ""; + thefile = Get_File(what); + if (!(thefile != "FAILED")) + { + continue; + } + string popstyle = "Serial"; + if (ConfigurationManager.AppSettings["PopStyle"] != null) + { + popstyle = ConfigurationManager.AppSettings["PopStyle"].ToString(); + } + if (popstyle == "Serial") + { + bool done = false; + foreach (Form fm in Application.OpenForms) + { + if (fm.GetType() == typeof(PopUp)) + { + ((PopUp)fm).add_url(thefile); + done = true; + } + } + if (!done) + { + new PopUp(thefile).Show(); + } + } + else + { + new PopUp(thefile).Show(); + } + goto end_IL_0064; } - } - else - { - new PopUp(thefile).Show(); - } - goto end_IL_0064; - } } if (which == "O=" && what.IndexOf("static") == -1) { @@ -842,192 +846,192 @@ internal class Utils } switch (which) { - case "M=": - { - string[] split = what.Split("&&&"); - CustomMessage cm = ((split.Length <= 1) ? new CustomMessage(split[0], "", 0, tts: false) : new CustomMessage(split[0], split[1], 0, tts: false)); - cm.ShowDialog(); - goto end_IL_0064; - } - case "S=": - { - if (!isfile) - { - Process.Start(new ProcessStartInfo + case "M=": { - FileName = what, - UseShellExecute = true - }); - continue; - } - string thefile5 = ""; - thefile5 = Get_File(what); - if (thefile5 != "FAILED") - { - new Subliminal(thefile5, message: false); - } - goto end_IL_0064; - } - case "V=": - new Subliminal(what, message: true); - goto end_IL_0064; - case "A=": - { - if (!isfile) - { - Process.Start(new ProcessStartInfo - { - FileName = what, - UseShellExecute = true - }); - continue; - } - string thefile6 = ""; - thefile6 = Get_File(what); - if (thefile6 != "FAILED") - { - new Audiopop(thefile6).ShowDialog(); - } - goto end_IL_0064; - } - case "F=": - { - bool found = false; - array2 = bannedref; - foreach (string bref in array2) - { - if (what.Contains(bref)) - { - found = true; + string[] split = what.Split("&&&"); + CustomMessage cm = ((split.Length <= 1) ? new CustomMessage(split[0], "", 0, tts: false) : new CustomMessage(split[0], split[1], 0, tts: false)); + cm.ShowDialog(); + goto end_IL_0064; } - } - if (!found) - { - string[] split2 = what.Split("&&&"); - new WriteForMe(split2[0], split2[1], from).ShowDialog(); - } - goto end_IL_0064; - } - case "1=": - { - if (!(what == "Yes")) - { - break; - } - string filename = "scr" + ConfigurationManager.AppSettings["UserName"].ToString() + from + DateTime.Now.Date.ToString().Replace("/", "").Replace(" ", "") - .Replace(":", "") + ".jpg"; - string filePath = ConfigurationManager.AppSettings["LocalDrive"] + filename; - using (Bitmap bmpScreenCapture = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height)) - { - using (Graphics g = Graphics.FromImage(bmpScreenCapture)) + case "S=": { - g.CopyFromScreen(Screen.PrimaryScreen.Bounds.X, Screen.PrimaryScreen.Bounds.Y, 0, 0, bmpScreenCapture.Size, CopyPixelOperation.SourceCopy); + if (!isfile) + { + Process.Start(new ProcessStartInfo + { + FileName = what, + UseShellExecute = true + }); + continue; + } + string thefile5 = ""; + thefile5 = Get_File(what); + if (thefile5 != "FAILED") + { + new Subliminal(thefile5, message: false); + } + goto end_IL_0064; } - new Bitmap(bmpScreenCapture, new Size(bmpScreenCapture.Width / 2, bmpScreenCapture.Height / 2)).Save(filePath, ImageFormat.Jpeg); - } - if (sendftpfile(filePath)) - { - sendcmd(from, Ecrypt("U=FTP" + filename) + "|||", all: false); - MessageBox.Show("Screen shot taken :D"); - } - goto end_IL_0064; - } - } - switch (which) - { - case "2=": - new WatchForMe(what, from).Show(); - goto end_IL_0064; - case "3=": - what = what.Replace(" ", "%20"); - Process.Start(new ProcessStartInfo - { - FileName = "https://x.com/intent/tweet?text=" + what + " [Posted by :]&url=www.thecontrolapp.co.uk", - UseShellExecute = true - }); - goto end_IL_0064; - case "4=": - if (!(what == "Yes")) - { - break; - } - new SendOrDelete(from).Show(); - goto end_IL_0064; - } - switch (which) - { - case "5=": - new CustomMessage(what, "", 4, tts: true).Show(); - break; - case "6=": - try - { - string filename2 = ""; - string filePath2 = ""; - if (ConfigurationManager.AppSettings["WebCnt"] != null && ConfigurationManager.AppSettings["WebCnt"].ToString() == "True") + case "V=": + new Subliminal(what, message: true); + goto end_IL_0064; + case "A=": { - new CustomMessage("Webcam picture in 5...4...3...2...1...", "", 5, tts: false).Show(); + if (!isfile) + { + Process.Start(new ProcessStartInfo + { + FileName = what, + UseShellExecute = true + }); + continue; + } + string thefile6 = ""; + thefile6 = Get_File(what); + if (thefile6 != "FAILED") + { + new Audiopop(thefile6).ShowDialog(); + } + goto end_IL_0064; } - using (VideoCapture capture = new VideoCapture(0, VideoCapture.API.Any)) + case "F=": { - using Bitmap image = capture.QueryFrame().ToBitmap(); - filename2 = "web" + ConfigurationManager.AppSettings["UserName"].ToString() + from + DateTime.Now.Date.ToString().Replace("/", "").Replace(" ", "") + bool found = false; + array2 = bannedref; + foreach (string bref in array2) + { + if (what.Contains(bref)) + { + found = true; + } + } + if (!found) + { + string[] split2 = what.Split("&&&"); + new WriteForMe(split2[0], split2[1], from).ShowDialog(); + } + goto end_IL_0064; + } + case "1=": + { + if (!(what == "Yes")) + { + break; + } + string filename = "scr" + ConfigurationManager.AppSettings["UserName"].ToString() + from + DateTime.Now.Date.ToString().Replace("/", "").Replace(" ", "") .Replace(":", "") + ".jpg"; - filePath2 = ConfigurationManager.AppSettings["LocalDrive"] + filename2; - new Bitmap(image, new Size(Convert.ToInt16((double)image.Width / 1.5), Convert.ToInt16((double)image.Height / 1.5))).Save(filePath2); + string filePath = ConfigurationManager.AppSettings["LocalDrive"] + filename; + using (Bitmap bmpScreenCapture = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height)) + { + using (Graphics g = Graphics.FromImage(bmpScreenCapture)) + { + g.CopyFromScreen(Screen.PrimaryScreen.Bounds.X, Screen.PrimaryScreen.Bounds.Y, 0, 0, bmpScreenCapture.Size, CopyPixelOperation.SourceCopy); + } + new Bitmap(bmpScreenCapture, new Size(bmpScreenCapture.Width / 2, bmpScreenCapture.Height / 2)).Save(filePath, ImageFormat.Jpeg); + } + if (sendftpfile(filePath)) + { + sendcmd(from, Ecrypt("U=FTP" + filename) + "|||", all: false); + MessageBox.Show("Screen shot taken :D"); + } + goto end_IL_0064; } - if (sendftpfile(filePath2)) - { - sendcmd(from, Ecrypt("U=FTP" + filename2) + "|||", all: false); - } - } - catch (Exception ex) - { - writetolog("Error getting webcam \n\r", ex.Message); - } - break; - case "7=": + } + switch (which) { - bool found3 = false; - foreach (Form fm5 in Application.OpenForms) - { - if (fm5.GetType() == typeof(Blank)) + case "2=": + new WatchForMe(what, from).Show(); + goto end_IL_0064; + case "3=": + what = what.Replace(" ", "%20"); + Process.Start(new ProcessStartInfo { - ((Blank)fm5).add_time(1); - found3 = true; + FileName = "https://x.com/intent/tweet?text=" + what + " [Posted by :]&url=www.thecontrolapp.co.uk", + UseShellExecute = true + }); + goto end_IL_0064; + case "4=": + if (!(what == "Yes")) + { + break; } - } - if (!found3) - { - new Blank(1).Show(); - Cursor.Show(); - } - break; + new SendOrDelete(from).Show(); + goto end_IL_0064; } - case "8=": + switch (which) { - bool found2 = false; - foreach (Form fm4 in Application.OpenForms) - { - if (fm4.GetType() == typeof(Blank)) + case "5=": + new CustomMessage(what, "", 4, tts: true).Show(); + break; + case "6=": + try { - ((Blank)fm4).add_time(1); - found2 = true; + string filename2 = ""; + string filePath2 = ""; + if (ConfigurationManager.AppSettings["WebCnt"] != null && ConfigurationManager.AppSettings["WebCnt"].ToString() == "True") + { + new CustomMessage("Webcam picture in 5...4...3...2...1...", "", 5, tts: false).Show(); + } + using (VideoCapture capture = new VideoCapture(0, VideoCapture.API.Any)) + { + using Bitmap image = capture.QueryFrame().ToBitmap(); + filename2 = "web" + ConfigurationManager.AppSettings["UserName"].ToString() + from + DateTime.Now.Date.ToString().Replace("/", "").Replace(" ", "") + .Replace(":", "") + ".jpg"; + filePath2 = ConfigurationManager.AppSettings["LocalDrive"] + filename2; + new Bitmap(image, new Size(Convert.ToInt16((double)image.Width / 1.5), Convert.ToInt16((double)image.Height / 1.5))).Save(filePath2); + } + if (sendftpfile(filePath2)) + { + sendcmd(from, Ecrypt("U=FTP" + filename2) + "|||", all: false); + } + } + catch (Exception ex) + { + writetolog("Error getting webcam", ex.Message); + } + break; + case "7=": + { + bool found3 = false; + foreach (Form fm5 in Application.OpenForms) + { + if (fm5.GetType() == typeof(Blank)) + { + ((Blank)fm5).add_time(1); + found3 = true; + } + } + if (!found3) + { + new Blank(1).Show(); + Cursor.Show(); + } + break; + } + case "8=": + { + bool found2 = false; + foreach (Form fm4 in Application.OpenForms) + { + if (fm4.GetType() == typeof(Blank)) + { + ((Blank)fm4).add_time(1); + found2 = true; + } + } + if (!found2) + { + new Blank(2).Show(); + Cursor.Show(); + } + break; } - } - if (!found2) - { - new Blank(2).Show(); - Cursor.Show(); - } - break; } - } - end_IL_0064:; + end_IL_0064:; } catch (Exception ex2) { - writetolog("Error proccessing for : " + line + "\n\r", ex2.Message); + writetolog("Error proccessing for : " + line , ex2.Message); } } }