960 lines
27 KiB
C#
960 lines
27 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Configuration;
|
|
using System.Diagnostics;
|
|
using System.Drawing;
|
|
using System.Drawing.Imaging;
|
|
using System.IO;
|
|
using System.Media;
|
|
using System.Net;
|
|
using System.Net.Http;
|
|
using System.Runtime.InteropServices;
|
|
using System.Security.Cryptography;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Windows.Forms;
|
|
using Emgu.CV;
|
|
using HtmlAgilityPack;
|
|
using Microsoft.Win32;
|
|
|
|
namespace ControlApp;
|
|
|
|
internal class Utils
|
|
{
|
|
private const int SPI_SETDESKWALLPAPER = 20;
|
|
|
|
private const int SPIF_UPDATEINIFILE = 1;
|
|
|
|
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[] bannedref = new string[2] { "money", "pay" };
|
|
|
|
public string[] blist = new string[1] { "" };
|
|
|
|
public void writetolog(string shortvr, string longvr)
|
|
{
|
|
shortvr = CleanStringForLog(shortvr);
|
|
longvr = CleanStringForLog(longvr);
|
|
|
|
if (ConfigurationManager.AppSettings["Logging"] == "On")
|
|
{
|
|
File.AppendAllText("log.txt", shortvr+ "\n");
|
|
}
|
|
else
|
|
{
|
|
File.AppendAllText("log.txt", longvr+ "\n");
|
|
}
|
|
}
|
|
|
|
public string CleanStringForLog(string stringinput)
|
|
{
|
|
stringinput = Decrypt(stringinput);
|
|
if (stringinput.EndsWith("&&&"))
|
|
{
|
|
stringinput = stringinput.Substring(0, stringinput.Length - 3);
|
|
}
|
|
return stringinput;
|
|
}
|
|
|
|
public string[] GetLatestItem()
|
|
{
|
|
try
|
|
{
|
|
string[] ret = new string[2] { "", "" };
|
|
string user = ConfigurationManager.AppSettings["UserName"].ToString();
|
|
string pwd = ConfigurationManager.AppSettings["Password"].ToString();
|
|
string vrs = "012";
|
|
string result = getcmd(user, pwd, vrs, "Content");
|
|
ret = seperate_string(result);
|
|
string[] runcode = ret[1].Split("|||");
|
|
try
|
|
{
|
|
run_process(runcode, ret[0]);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
writetolog("Error running process \n\r", ex.Message);
|
|
}
|
|
return ret;
|
|
}
|
|
catch
|
|
{
|
|
return new string[1] { "" };
|
|
}
|
|
}
|
|
|
|
public string[] GetRelations()
|
|
{
|
|
_ = new string[2] { "", "" };
|
|
string user = ConfigurationManager.AppSettings["UserName"].ToString();
|
|
string pwd = ConfigurationManager.AppSettings["Password"].ToString();
|
|
string vrs = "012";
|
|
string result = getcmd(user, pwd, vrs, "Relations");
|
|
return seperate_string(result);
|
|
}
|
|
|
|
public void AcceptInvite(string dom)
|
|
{
|
|
string user = ConfigurationManager.AppSettings["UserName"].ToString();
|
|
string pwd = ConfigurationManager.AppSettings["Password"].ToString();
|
|
string vrs = "012";
|
|
getcmd(user, pwd, vrs, "Accept" + dom);
|
|
}
|
|
|
|
public void ThumbsUp(string dom)
|
|
{
|
|
string user = ConfigurationManager.AppSettings["UserName"].ToString();
|
|
string pwd = ConfigurationManager.AppSettings["Password"].ToString();
|
|
string vrs = "012";
|
|
getcmd(user, pwd, vrs, "Thumbs" + dom);
|
|
}
|
|
|
|
public void RejectInvite(string dom)
|
|
{
|
|
string user = ConfigurationManager.AppSettings["UserName"].ToString();
|
|
string pwd = ConfigurationManager.AppSettings["Password"].ToString();
|
|
string vrs = "012";
|
|
getcmd(user, pwd, vrs, "Reject" + dom);
|
|
}
|
|
|
|
public string[] GetInvites()
|
|
{
|
|
string[] ret = new string[2] { "", "" };
|
|
string user = ConfigurationManager.AppSettings["UserName"].ToString();
|
|
string pwd = ConfigurationManager.AppSettings["Password"].ToString();
|
|
string vrs = "012";
|
|
string result = getcmd(user, pwd, vrs, "Invite");
|
|
int start = result.IndexOf("\"result\">");
|
|
if (start > 0)
|
|
{
|
|
int end = result.IndexOf("</span>", start);
|
|
if (end - (start + 9) >= 0)
|
|
{
|
|
string fullres = result.Substring(start + 9, end - (start + 9));
|
|
if (fullres.Length > 3)
|
|
{
|
|
ret = seperate_string(fullres);
|
|
}
|
|
}
|
|
}
|
|
return ret;
|
|
}
|
|
|
|
public string[] seperate_string(string seperate)
|
|
{
|
|
if (seperate != "")
|
|
{
|
|
string[] strings = new string[1] { "" };
|
|
if (seperate[0] == '[' && seperate[seperate.Length - 1] == ']')
|
|
{
|
|
strings = seperate.Split("],[");
|
|
if (strings.Length > 1)
|
|
{
|
|
int count = 0;
|
|
string[] array = strings;
|
|
foreach (string s in array)
|
|
{
|
|
if (count == 0)
|
|
{
|
|
strings[count] = s.Substring(1, s.Length - 1);
|
|
}
|
|
else if (count == strings.Length - 1)
|
|
{
|
|
strings[count] = s.Substring(0, s.Length - 1);
|
|
}
|
|
count++;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
strings = new string[1] { seperate.Substring(1, seperate.Length - 2) };
|
|
}
|
|
return strings;
|
|
}
|
|
return strings;
|
|
}
|
|
return new string[1] { "" };
|
|
}
|
|
|
|
public string getcmd(string UserNm, string Pwd, string version, string what)
|
|
{
|
|
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;
|
|
string downloadString = "";
|
|
try
|
|
{
|
|
using ComForm wf = new ComForm("https://www.thecontrolapp.co.uk/AppCommand.aspx?UserNm=" + UserNm + "&Pwd=" + Ecrypt(Pwd) + "&vrs=" + version + "&cmd=" + what, "Normal");
|
|
wf.ShowDialog();
|
|
downloadString = wf.ReturnedData[0];
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
writetolog("Error getting command", ex.Message.ToString());
|
|
}
|
|
return downloadString;
|
|
}
|
|
|
|
public bool sendftpfile(string FileName)
|
|
{
|
|
bool ret = true;
|
|
try
|
|
{
|
|
new CustomMessage("Sending file to server", "", 4, tts: false).Show();
|
|
string justfilename = Path.GetFileName(FileName);
|
|
string ftpUsername = "acc929431981";
|
|
string ftpPassword = "6scM67YJ+Ezzz0RKCeIxbT9TAfSbRE++1T";
|
|
FtpWebRequest request = (FtpWebRequest)WebRequest.Create("ftp://home240474283.1and1-data.host/" + justfilename);
|
|
request.Method = "STOR";
|
|
request.Credentials = new NetworkCredential(ftpUsername, Decrypt(ftpPassword));
|
|
byte[] fileContents;
|
|
using (StreamReader sourceStream = new StreamReader(FileName))
|
|
{
|
|
fileContents = Encoding.UTF8.GetBytes(sourceStream.ReadToEnd());
|
|
}
|
|
request.ContentLength = fileContents.Length;
|
|
using Stream requestStream = request.GetRequestStream();
|
|
requestStream.Write(fileContents, 0, fileContents.Length);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
ret = false;
|
|
new CustomMessage("Sending file to server failed", "", 4, tts: false).ShowDialog();
|
|
writetolog("Error sending ftp process \n\r", ex.Message);
|
|
}
|
|
return ret;
|
|
}
|
|
|
|
public void deleteoutstanding(string UserNm, string Pwd, string version)
|
|
{
|
|
try
|
|
{
|
|
string user = ConfigurationManager.AppSettings["UserName"].ToString();
|
|
string pwd = ConfigurationManager.AppSettings["Password"].ToString();
|
|
string vrs = "012";
|
|
getcmd(user, pwd, vrs, "Delete");
|
|
}
|
|
catch
|
|
{
|
|
}
|
|
}
|
|
|
|
public string[] getoutstanding(string UserNm, string Pwd, string version)
|
|
{
|
|
string[] returned = new string[3] { "", "", "" };
|
|
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;
|
|
string downloadString = "";
|
|
try
|
|
{
|
|
using HttpClient client = new HttpClient();
|
|
string geturl = "https://www.thecontrolapp.co.uk/GetCount.aspx?UserNm=" + UserNm + "&Pwd=" + Ecrypt(Pwd) + "&vrs=" + version;
|
|
downloadString = client.GetStringAsync(geturl).Result;
|
|
HtmlAgilityPack.HtmlDocument htmlDocument = new HtmlAgilityPack.HtmlDocument();
|
|
htmlDocument.LoadHtml(downloadString);
|
|
HtmlNode labelNode = htmlDocument.GetElementbyId("result");
|
|
if (labelNode != null)
|
|
{
|
|
returned[0] = labelNode.InnerText;
|
|
}
|
|
labelNode = htmlDocument.GetElementbyId("next");
|
|
if (labelNode != null)
|
|
{
|
|
returned[1] = labelNode.InnerText;
|
|
}
|
|
labelNode = htmlDocument.GetElementbyId("vari");
|
|
if (labelNode != null)
|
|
{
|
|
returned[2] = labelNode.InnerText;
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
writetolog("Error getting outstanding \n\r", ex.Message);
|
|
}
|
|
return returned;
|
|
}
|
|
|
|
public void sendcmd(string UserNm, string comm, bool all)
|
|
{
|
|
string user = ConfigurationManager.AppSettings["UserName"].ToString();
|
|
string pwd = ConfigurationManager.AppSettings["Password"].ToString();
|
|
if (user == null || pwd == null)
|
|
{
|
|
user = "";
|
|
pwd = "";
|
|
}
|
|
int allint = 0;
|
|
if (all)
|
|
{
|
|
allint = 1;
|
|
}
|
|
using sendcmd sendc = new sendcmd("https://www.thecontrolapp.co.uk/AppSendContent.aspx?UserNm=" + UserNm + "&comm=" + comm.Replace("G0", "PPP") + "&all=" + allint + "&fromuser=" + user + "&frompword=" + Ecrypt(pwd).Replace("G0", "PPP"));
|
|
sendc.ShowDialog();
|
|
}
|
|
|
|
public void SendBlockReport(string senderid, string command, string report)
|
|
{
|
|
string user = ConfigurationManager.AppSettings["UserName"].ToString();
|
|
string pwd = Ecrypt(ConfigurationManager.AppSettings["Password"].ToString());
|
|
string what = "https://www.thecontrolapp.co.uk/BlockReport.aspx?usernm=" + user + "&pwd=" + pwd + "&vrs=012&sender=" + senderid + "&report=" + report + "&content=" + command;
|
|
Process.Start(new ProcessStartInfo
|
|
{
|
|
FileName = what,
|
|
UseShellExecute = true
|
|
});
|
|
}
|
|
|
|
public string Ecrypt(string Line)
|
|
{
|
|
string ToReturn = "";
|
|
try
|
|
{
|
|
string publickey = "santhosh";
|
|
string secretkey = "engineer";
|
|
byte[] secretkeyByte = Encoding.UTF8.GetBytes(secretkey);
|
|
byte[] publickeybyte = Encoding.UTF8.GetBytes(publickey);
|
|
byte[] inputbyteArray = Encoding.UTF8.GetBytes(Line);
|
|
using (DESCryptoServiceProvider des = new DESCryptoServiceProvider())
|
|
{
|
|
MemoryStream memoryStream = new MemoryStream();
|
|
CryptoStream cryptoStream = new CryptoStream(memoryStream, des.CreateEncryptor(publickeybyte, secretkeyByte), CryptoStreamMode.Write);
|
|
cryptoStream.Write(inputbyteArray, 0, inputbyteArray.Length);
|
|
cryptoStream.FlushFinalBlock();
|
|
ToReturn = Convert.ToBase64String(memoryStream.ToArray());
|
|
}
|
|
ToReturn = ToReturn.Replace("\\", "xxx");
|
|
ToReturn = ToReturn.Replace("&", "yyy");
|
|
ToReturn = ToReturn.Replace("/", "zzz");
|
|
ToReturn = ToReturn.Replace("]", "aaa");
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
writetolog("Error enrypt " + Line + "\n\r", ex.Message);
|
|
}
|
|
return ToReturn;
|
|
}
|
|
|
|
public string Decrypt(string Line)
|
|
{
|
|
string ToReturn = "";
|
|
try
|
|
{
|
|
Line = Line.Replace("xxx", "\\");
|
|
Line = Line.Replace("yyy", "&");
|
|
Line = Line.Replace("zzz", "/");
|
|
Line = Line.Replace("aaa", "]");
|
|
string publickey = "santhosh";
|
|
string privatekey = "engineer";
|
|
byte[] privatekeyByte = Encoding.UTF8.GetBytes(privatekey);
|
|
byte[] publickeybyte = Encoding.UTF8.GetBytes(publickey);
|
|
MemoryStream ms = null;
|
|
byte[] inputbyteArray = new byte[Line.Replace(" ", "+").Length];
|
|
inputbyteArray = Convert.FromBase64String(Line.Replace(" ", "+"));
|
|
using DESCryptoServiceProvider des = new DESCryptoServiceProvider();
|
|
ms = new MemoryStream();
|
|
CryptoStream cryptoStream = new CryptoStream(ms, des.CreateDecryptor(publickeybyte, privatekeyByte), CryptoStreamMode.Write);
|
|
cryptoStream.Write(inputbyteArray, 0, inputbyteArray.Length);
|
|
cryptoStream.FlushFinalBlock();
|
|
ToReturn = Encoding.UTF8.GetString(ms.ToArray());
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
writetolog("Decrypt error for : " + Line + "\n\r", ex.Message);
|
|
}
|
|
return ToReturn;
|
|
}
|
|
|
|
public string Get_File(string url)
|
|
{
|
|
string filename = "";
|
|
url.Substring(0, url.LastIndexOf('/'));
|
|
Uri trueuri = new Uri(url);
|
|
filename = url.Substring(url.LastIndexOf("/") + 1, url.Length - url.LastIndexOf("/") - 1);
|
|
filename = ConfigurationManager.AppSettings["LocalDrive"] + filename;
|
|
filename.Replace(".webp", "");
|
|
try
|
|
{
|
|
using CustomMessage cm = new CustomMessage("Downloading Image please wait", "", 0, tts: false);
|
|
cm.Show();
|
|
using HttpClient client = new HttpClient();
|
|
using Task<Stream> s = client.GetStreamAsync(trueuri);
|
|
s.Wait();
|
|
using (FileStream fs = new FileStream(filename, FileMode.Create))
|
|
{
|
|
s.Result.CopyTo(fs);
|
|
}
|
|
s.Dispose();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
filename = "FAILED";
|
|
writetolog("Error getting file for : " + url + "\n\r", ex.Message);
|
|
}
|
|
return filename;
|
|
}
|
|
|
|
[DllImport("user32.dll", CharSet = CharSet.Auto)]
|
|
private static extern int SystemParametersInfo(int uAction, int uParam, string lpvParam, int fuWinIni);
|
|
|
|
public void Change_Wallpaper(string filename)
|
|
{
|
|
string style = ConfigurationManager.AppSettings["PaperStyle"];
|
|
RegistryKey key = Registry.CurrentUser.OpenSubKey("Control Panel\\Desktop", writable: true);
|
|
if (key != null)
|
|
{
|
|
if (style == "Stretch")
|
|
{
|
|
key.SetValue("WallpaperStyle", 2.ToString());
|
|
key.SetValue("TileWallpaper", 0.ToString());
|
|
}
|
|
if (style == "Fit")
|
|
{
|
|
key.SetValue("WallpaperStyle", 1.ToString());
|
|
key.SetValue("TileWallpaper", 0.ToString());
|
|
}
|
|
SystemParametersInfo(20, 0, filename, 3);
|
|
}
|
|
}
|
|
|
|
public string[] remove_notneeded(string[] lines)
|
|
{
|
|
List<string> ret = new List<string>();
|
|
foreach (string line in lines)
|
|
{
|
|
if (line == "")
|
|
{
|
|
break;
|
|
}
|
|
string decrip = Decrypt(line);
|
|
string which = decrip.Substring(0, 2);
|
|
string what = decrip.Substring(2, decrip.Length - 2).Trim();
|
|
if (which == "D=" && (ConfigurationManager.AppSettings["Downloads"] == null || !Convert.ToBoolean(ConfigurationManager.AppSettings["Downloads"].ToString())))
|
|
{
|
|
ret.Add(line);
|
|
}
|
|
if (which == "P=" && (ConfigurationManager.AppSettings["Wallpapers"] == null || !Convert.ToBoolean(ConfigurationManager.AppSettings["Wallpapers"].ToString())))
|
|
{
|
|
ret.Add(line);
|
|
}
|
|
if (which == "R=" && (ConfigurationManager.AppSettings["Runables"] == null || !Convert.ToBoolean(ConfigurationManager.AppSettings["Runables"].ToString())))
|
|
{
|
|
ret.Add(line);
|
|
}
|
|
if (which == "W=" && (ConfigurationManager.AppSettings["OpenWeb"] == null || !Convert.ToBoolean(ConfigurationManager.AppSettings["OpenWeb"].ToString())))
|
|
{
|
|
ret.Add(line);
|
|
}
|
|
if ((which == "U=" || (which == "O=" && what.IndexOf("static") > 0)) && (ConfigurationManager.AppSettings["PopUps"] == null || !Convert.ToBoolean(ConfigurationManager.AppSettings["PopUps"].ToString())))
|
|
{
|
|
ret.Add(line);
|
|
}
|
|
if (which == "O=" && what.IndexOf("static") == -1 && (ConfigurationManager.AppSettings["PopUps"] == null || !Convert.ToBoolean(ConfigurationManager.AppSettings["PopUps"].ToString())))
|
|
{
|
|
ret.Add(line);
|
|
}
|
|
if (which == "M=" && (ConfigurationManager.AppSettings["Messages"] == null || !Convert.ToBoolean(ConfigurationManager.AppSettings["Messages"].ToString())))
|
|
{
|
|
bool found = false;
|
|
string[] array = bannedref;
|
|
foreach (string bref in array)
|
|
{
|
|
if (what.Contains(bref))
|
|
{
|
|
found = true;
|
|
}
|
|
}
|
|
if (!found)
|
|
{
|
|
ret.Add(line);
|
|
}
|
|
}
|
|
if (which == "S=" && (ConfigurationManager.AppSettings["Subliminals"] == null || !Convert.ToBoolean(ConfigurationManager.AppSettings["Subliminals"].ToString())))
|
|
{
|
|
ret.Add(line);
|
|
}
|
|
if (which == "V=" && (ConfigurationManager.AppSettings["Subliminals"] == null || !Convert.ToBoolean(ConfigurationManager.AppSettings["Subliminals"].ToString())))
|
|
{
|
|
ret.Add(line);
|
|
}
|
|
if (which == "A=" && (ConfigurationManager.AppSettings["Audios"] == null || !Convert.ToBoolean(ConfigurationManager.AppSettings["Audios"].ToString())))
|
|
{
|
|
ret.Add(line);
|
|
}
|
|
if (which == "F=" && (ConfigurationManager.AppSettings["Writeformes"] == null || !Convert.ToBoolean(ConfigurationManager.AppSettings["Writeformes"].ToString())))
|
|
{
|
|
ret.Add(line);
|
|
}
|
|
if (which == "1=" && (ConfigurationManager.AppSettings["ScreenShots"] == null || !Convert.ToBoolean(ConfigurationManager.AppSettings["ScreenShots"].ToString())))
|
|
{
|
|
ret.Add(line);
|
|
}
|
|
if (which == "2=" && (ConfigurationManager.AppSettings["Watch4me"] == null || !Convert.ToBoolean(ConfigurationManager.AppSettings["Watch4me"].ToString())))
|
|
{
|
|
ret.Add(line);
|
|
}
|
|
if (which == "3=" && (ConfigurationManager.AppSettings["twitter"] == null || !Convert.ToBoolean(ConfigurationManager.AppSettings["twitter"].ToString())))
|
|
{
|
|
bool found2 = false;
|
|
string[] array = bannedref;
|
|
foreach (string bref2 in array)
|
|
{
|
|
if (what.Contains(bref2))
|
|
{
|
|
found2 = true;
|
|
}
|
|
}
|
|
array = blist;
|
|
foreach (string bref3 in array)
|
|
{
|
|
if (what.Contains(bref3))
|
|
{
|
|
found2 = true;
|
|
}
|
|
}
|
|
if (!found2)
|
|
{
|
|
ret.Add(line);
|
|
}
|
|
}
|
|
if (which == "4=" && (ConfigurationManager.AppSettings["SendDelete"] == null || !Convert.ToBoolean(ConfigurationManager.AppSettings["SendDelete"].ToString())))
|
|
{
|
|
ret.Add(line);
|
|
}
|
|
if (which == "5=" && (ConfigurationManager.AppSettings["TTS"] == null || !Convert.ToBoolean(ConfigurationManager.AppSettings["TTS"].ToString())))
|
|
{
|
|
bool found3 = false;
|
|
string[] array = bannedref;
|
|
foreach (string bref4 in array)
|
|
{
|
|
if (what.Contains(bref4))
|
|
{
|
|
found3 = true;
|
|
}
|
|
}
|
|
array = blist;
|
|
foreach (string bref5 in array)
|
|
{
|
|
if (what.Contains(bref5))
|
|
{
|
|
found3 = true;
|
|
}
|
|
}
|
|
if (!found3)
|
|
{
|
|
ret.Add(line);
|
|
}
|
|
}
|
|
if (which == "6=" && (ConfigurationManager.AppSettings["Webcam"] == null || !Convert.ToBoolean(ConfigurationManager.AppSettings["Webcam"].ToString())))
|
|
{
|
|
ret.Add(line);
|
|
}
|
|
if (which == "7=" && (ConfigurationManager.AppSettings["DisM"] == null || !Convert.ToBoolean(ConfigurationManager.AppSettings["DisM"].ToString())))
|
|
{
|
|
ret.Add(line);
|
|
}
|
|
if (which == "8=" && (ConfigurationManager.AppSettings["DisM"] == null || !Convert.ToBoolean(ConfigurationManager.AppSettings["DisM"].ToString())))
|
|
{
|
|
ret.Add(line);
|
|
}
|
|
}
|
|
return ret.ToArray();
|
|
}
|
|
|
|
public void run_process(string[] lines, string from)
|
|
{
|
|
lines = remove_notneeded(lines);
|
|
if (lines.Length != 0)
|
|
{
|
|
SystemSounds.Beep.Play();
|
|
}
|
|
string[] array = lines;
|
|
foreach (string line in array)
|
|
{
|
|
if (line == "")
|
|
{
|
|
break;
|
|
}
|
|
string decrip = Decrypt(line);
|
|
writetolog(line + "\n", line + "\n");
|
|
if (decrip.Length <= 2)
|
|
{
|
|
continue;
|
|
}
|
|
try
|
|
{
|
|
string which = decrip.Substring(0, 2);
|
|
string what = decrip.Substring(2, decrip.Length - 2).Trim();
|
|
bool inbanned = false;
|
|
string[] array2 = bannedlist;
|
|
foreach (string banned in array2)
|
|
{
|
|
if (what.Contains(banned))
|
|
{
|
|
inbanned = true;
|
|
}
|
|
}
|
|
if (inbanned)
|
|
{
|
|
new CustomMessage("Message contains potential bad stuff closing", "", 4, tts: false).ShowDialog();
|
|
writetolog("Banned content found in message", what);
|
|
break;
|
|
}
|
|
if (what.Substring(0, 3) == "FTP")
|
|
{
|
|
what = (what = "https://www.thecontrolapp.co.uk/storage/" + what.Substring(3, what.Length - 3));
|
|
}
|
|
string type = "";
|
|
try
|
|
{
|
|
type = Path.GetExtension(what);
|
|
}
|
|
catch
|
|
{
|
|
}
|
|
bool isfile = false;
|
|
if (type != "")
|
|
{
|
|
isfile = true;
|
|
}
|
|
switch (which)
|
|
{
|
|
case "D=":
|
|
{
|
|
string thefile2 = "";
|
|
if (!isfile)
|
|
{
|
|
Process.Start(new ProcessStartInfo
|
|
{
|
|
FileName = what,
|
|
UseShellExecute = true
|
|
});
|
|
}
|
|
else
|
|
{
|
|
thefile2 = Get_File(what);
|
|
}
|
|
if (thefile2 != "FAILED")
|
|
{
|
|
new CustomMessage("File downloaded! Find it here : " + thefile2, "", 4, tts: false).ShowDialog();
|
|
}
|
|
goto end_IL_0064;
|
|
}
|
|
case "P=":
|
|
{
|
|
if (!isfile)
|
|
{
|
|
Process.Start(new ProcessStartInfo
|
|
{
|
|
FileName = what,
|
|
UseShellExecute = true
|
|
});
|
|
continue;
|
|
}
|
|
string thefile3 = "";
|
|
thefile3 = Get_File(what);
|
|
if (thefile3 != "FAILED")
|
|
{
|
|
Change_Wallpaper(thefile3);
|
|
}
|
|
goto end_IL_0064;
|
|
}
|
|
case "R=":
|
|
{
|
|
if (!isfile)
|
|
{
|
|
continue;
|
|
}
|
|
string thefile4 = "";
|
|
thefile4 = Get_File(what);
|
|
if (thefile4 != "FAILED")
|
|
{
|
|
if (ConfigurationManager.AppSettings["AutoRun"] == "True")
|
|
{
|
|
Process.Start(thefile4);
|
|
}
|
|
else
|
|
{
|
|
new CustomMessage("Exe downloaded! Find it here : " + thefile4, "", 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;
|
|
}
|
|
}
|
|
if (which == "O=" && what.IndexOf("static") == -1)
|
|
{
|
|
if (!isfile)
|
|
{
|
|
Process.Start(new ProcessStartInfo
|
|
{
|
|
FileName = what,
|
|
UseShellExecute = true
|
|
});
|
|
continue;
|
|
}
|
|
string popstyle2 = "Serial";
|
|
if (ConfigurationManager.AppSettings["PopStyle"] != null)
|
|
{
|
|
popstyle2 = ConfigurationManager.AppSettings["PopStyle"].ToString();
|
|
}
|
|
if (popstyle2 == "Serial")
|
|
{
|
|
bool done2 = false;
|
|
foreach (Form fm2 in Application.OpenForms)
|
|
{
|
|
if (fm2.GetType() == typeof(PopUp))
|
|
{
|
|
((PopUp)fm2).add_url(what);
|
|
done2 = true;
|
|
}
|
|
}
|
|
if (!done2)
|
|
{
|
|
new PopUp(what).Show();
|
|
}
|
|
}
|
|
else
|
|
{
|
|
new PopUp(what).Show();
|
|
}
|
|
continue;
|
|
}
|
|
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
|
|
{
|
|
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;
|
|
}
|
|
}
|
|
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))
|
|
{
|
|
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;
|
|
}
|
|
}
|
|
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://twitter.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).ShowDialog();
|
|
break;
|
|
case "6=":
|
|
try
|
|
{
|
|
Bitmap image = new VideoCapture(0, VideoCapture.API.Any).QueryFrame().ToBitmap();
|
|
string filename2 = "web" + ConfigurationManager.AppSettings["UserName"].ToString() + from + DateTime.Now.Date.ToString().Replace("/", "").Replace(" ", "")
|
|
.Replace(":", "") + ".jpg";
|
|
string filePath2 = ConfigurationManager.AppSettings["LocalDrive"] + filename2;
|
|
new Bitmap(image, new Size(image.Width / 2, image.Height / 2)).Save(filePath2);
|
|
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=":
|
|
{
|
|
bool found3 = false;
|
|
foreach (Form fm4 in Application.OpenForms)
|
|
{
|
|
if (fm4.GetType() == typeof(Blank))
|
|
{
|
|
((Blank)fm4).add_time(1);
|
|
found3 = true;
|
|
}
|
|
}
|
|
if (!found3)
|
|
{
|
|
new Blank(1).Show();
|
|
Cursor.Show();
|
|
}
|
|
break;
|
|
}
|
|
case "8=":
|
|
{
|
|
bool found2 = false;
|
|
foreach (Form fm3 in Application.OpenForms)
|
|
{
|
|
if (fm3.GetType() == typeof(Blank))
|
|
{
|
|
((Blank)fm3).add_time(1);
|
|
found2 = true;
|
|
}
|
|
}
|
|
if (!found2)
|
|
{
|
|
new Blank(2).Show();
|
|
Cursor.Show();
|
|
}
|
|
break;
|
|
}
|
|
}
|
|
end_IL_0064:;
|
|
}
|
|
catch (Exception ex2)
|
|
{
|
|
writetolog("Error proccessing for : " + line + "\n\r", ex2.Message);
|
|
}
|
|
}
|
|
}
|
|
}
|