Beispiel #1
0
        private void Optionstart_DoWork(object sender, DoWorkEventArgs e)
        {
            dynamic data = e.Argument;

            switch (data.action.ToString())
            {
            case "Shutdown":
            {
                Notificare.ShowBalloonTip(1000, "Optimised Cloud", "Sistemul se va opri in 2 secunde.", ToolTipIcon.Info);             //Trimite messajul primit de la actiunea trimisa din Cloud.
                Functii.DownloadString("http://" + Functii.webip + "/notify/" + Key + "/" + token + "/shutdown/");
                Thread.Sleep(2000);
                Shutdown.Shut();
                break;
            }

            case "Restart":
            {
                Notificare.ShowBalloonTip(1000, "Optimised Cloud", "Sistemul se va reseta in 2 secunde.", ToolTipIcon.Info);             //Trimite messajul primit de la actiunea trimisa din Cloud.
                Functii.DownloadString("http://" + Functii.webip + "/notify/" + Key + "/" + token + "/restart/");
                Thread.Sleep(2000);
                Shutdown.Restart();
                break;
            }

            default:
                break;
            }
        }
Beispiel #2
0
        static void LoginAuto(string key)
        {
            dynamic logininfo;

            try
            {
                logininfo = Newtonsoft.Json.JsonConvert.DeserializeObject(Functii.DownloadString("http://" + Functii.webip + "/loginapp/" + key.ToString()));
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
                throw;
            }
            if (logininfo.token.ToString().Length == 60)
            {
                Key    = key;
                tokens = logininfo.token.ToString();
                Id     = logininfo.id.ToString();
                Email  = logininfo.email.ToString();
                statie = logininfo.statie.ToString();
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                Application.Run(new Optimised());
            }
            else
            {
                error = logininfo.error.ToString();
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                Application.Run(new Login());
            }
        }
Beispiel #3
0
 private void Sendonline_DoWork(object sender, DoWorkEventArgs e)
 {
     while (true)
     {
         var sendstats = Functii.DownloadString("http://" + Functii.webip + "/sendonline/" + Key + "/" + token);
         Thread.Sleep(10000);
     }
 }
Beispiel #4
0
        private void Closeproc_DoWork(object sender, DoWorkEventArgs e)
        {
            dynamic data = Newtonsoft.Json.JsonConvert.DeserializeObject(e.Argument.ToString());
            Process p    = Process.GetProcessById(Int32.Parse((string)(data.pid)));
            var     proc = Process.GetProcessById((int)data.pid).ProcessName;

            p.Kill();
            Functii.DownloadString("http://" + Functii.webip + "/notify/" + Key + "/" + token + "/close/" + proc);
        }
Beispiel #5
0
        private void Opensite_DoWork(object sender, DoWorkEventArgs e)
        {
            dynamic data = e.Argument;

            if (data.url != null)
            {
                Process.Start(data.url.ToString());                                                                          //Porneste site-ul trimis din cloud.
                Notificare.ShowBalloonTip(1000, "Optimised Cloud", "Site-ul: " + data.url + " a pornit.", ToolTipIcon.Info); //Trimite messajul primit de la actiunea trimisa din Cloud.
                Functii.DownloadString("http://" + Functii.webip + "/notify/" + Key + "/" + token + "/site/" + Functii.Base64Encode(data.url.ToString()));
            }
        }
Beispiel #6
0
 private void iTalk_Button_21_Click(object sender, EventArgs e)
 {
     if (mesaj.Text != string.Empty && nume.Text != string.Empty)
     {
         Functii.DownloadString("http://" + Functii.webip + "/report/" + Key + "/" + Token + "/" + Id + "/" + Email + "/" + nume.Text + "/" + mesaj.Text);
         this.Close();
     }
     else
     {
         MessageBox.Show("Ambele campuri sunt necesare.");
     }
 }
Beispiel #7
0
        private void SendInfo_Tick(object sender, EventArgs e)
        {
            dynamic ips = null;

            this.Hide();
            try
            {
                var name = (from x in new ManagementObjectSearcher("SELECT Caption FROM Win32_OperatingSystem").Get().Cast <ManagementObject>()
                            select x.GetPropertyValue("Caption")).FirstOrDefault();
                while (name == null)
                {
                    name = (from x in new ManagementObjectSearcher("SELECT Caption FROM Win32_OperatingSystem").Get().Cast <ManagementObject>()
                            select x.GetPropertyValue("Caption")).FirstOrDefault();
                }
                var dataip = Functii.DownloadString("https://httpbin.org/ip");

                if (dataip != null)
                {
                    ips = Newtonsoft.Json.JsonConvert.DeserializeObject(dataip);
                }

                sistem = name.ToString();
                if (ips != null)
                {
                    ip = (ips["origin"]);
                }
                else
                {
                    ip = "Error!";
                }

                localip = (Functii.GetLocalIPAddress());

                ManagementClass            oMClass = new ManagementClass("Win32_NetworkAdapterConfiguration");
                ManagementObjectCollection MObjCol = oMClass.GetInstances();
                foreach (ManagementObject objMO in MObjCol)
                {
                    if (objMO["MacAddress"] != null)
                    {
                        mac = objMO["MacAddress"].ToString();
                    }
                }
                Functii.DownloadString("http://" + Functii.webip + "/setinfo/" + Key + "/" + token + "/" + ip + "/" + mac + "/" + sistem + "/" + localip);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            SendInfo.Stop();
        }
Beispiel #8
0
        //clearGC_Timer End
        #endregion
        #region Sistem_Login
        private void iTalk_Button_21_Click(object sender, EventArgs e)
        {
            if (iTalk_TextBox_Big3.Text != "")
            {
                dynamic logininfo;
                try
                {
                    logininfo = Newtonsoft.Json.JsonConvert.DeserializeObject(Functii.DownloadString("http://" + Functii.webip + "/loginapp/" + iTalk_TextBox_Big3.Text)); //Cere informatii despre Login la API.
                    if (logininfo.token.ToString().Length != 60)                                                                                                           //Verifica daca a returnat token sau nu.
                    {
                        try
                        {
                            notifyIcon1.ShowBalloonTip(1000, "Optimised Login", logininfo.error.ToString(), ToolTipIcon.Info); //Trimite messajul primit de la API.
                        }
                        catch (Exception)
                        {
                            notifyIcon1.ShowBalloonTip(1000, "Optimised Login", "Eroare la server!", ToolTipIcon.Info); //Trimite messajul primit de la API.

                            throw;
                        }
                    }
                    else
                    {
                        RegistryKey keys = Registry.CurrentUser.OpenSubKey(@"Software\Optimised", true); //Se deschide calea catre regedit.
                        keys.SetValue("Key", iTalk_TextBox_Big3.Text.ToString());                        //Se seteaza codul introdus pentru login in regedit.
                        this.Hide();                                                                     //Ascunde Form-ul de Login.
                        token  = logininfo.token.ToString();                                             //Salveaza token-ul primit.
                        Id     = logininfo.id.ToString();                                                //Salveaza ID-ul primit.
                        statie = logininfo.statie.ToString();
                        Email  = logininfo.email.ToString();                                             //Salveaza Email-ul primit.
                        Key    = iTalk_TextBox_Big3.Text.ToString();                                     //Salveaza key
                        Optimised optimised = new Optimised();                                           //Deschide calea catre noul Form.
                        notifyIcon1.Dispose();                                                           //Stinge Iconita din sistem Tray.
                        optimised.Show();                                                                //Porneste Form-ul cu aplicatia propriuzisa.
                        clearGC.Stop();                                                                  //Opreste timerul pentru optimizarea programului.
                    }
                }
                catch (Exception)
                {
                    throw;
                }
            }
            else
            {
                notifyIcon1.ShowBalloonTip(1000, "Optimised Login", "Parola lipseste!", ToolTipIcon.Info); //Trimite messajul primit de la API.
            }
        }
Beispiel #9
0
        private void UpdateProces_DoWork(object sender, DoWorkEventArgs e)
        {
            int    lastPID  = -1;
            string lastPROC = "";

            while (true)
            {
                var nameproc = Functii.GetActiveWindowTitle();
                var PID      = Functii.GetActivePID();
                var proc     = Process.GetProcessById((int)PID).ProcessName;
                if (lastPID != (int)PID || lastPROC != nameproc)
                {
                    Functii.DownloadString("http://" + Functii.webip + "/setmainproc/" + Key + "/" + token + "/" + PID + "/" + nameproc + "/" + proc);
                    lastPID = (int)PID;
                }
                Thread.Sleep(5000);
            }
        }
Beispiel #10
0
        private void Optimised_All_DoWork(object sender, DoWorkEventArgs e)
        {
            ListBox.CheckForIllegalCrossThreadCalls = false;
            iTalk.iTalk_GroupBox.CheckForIllegalCrossThreadCalls = false;
            Notificare.ShowBalloonTip(1000, "Optimised Cloud", "Optimizarea trimisa din cloud pentru toti utilizatorii a inceput.", ToolTipIcon.Info); //Trimite messajul primit de la actiunea trimisa din Cloud.
            dynamic obj = (dynamic)e.Argument;

            if (obj["muic"] == 1)
            {
                try
                {
                    regKey = Registry.CurrentUser.OpenSubKey(@"Software\Classes\Local Settings\Software\Microsoft\Windows\Shell\MuiCache", true);
                    foreach (string value in regKey.GetValueNames())
                    {
                        regKey.DeleteValue(value, true);
                    }
                    regKey.Close();
                }
                catch
                {
                }
            }

            if (obj["pref"] == 1)
            {
                try
                {
                    Array.ForEach(Directory.GetFiles(windows + @"Windows\Prefetch\", "*.pf"),
                                  delegate(string path)
                    {
                        File.Delete(path);
                        if (!File.Exists(path))
                        {
                        }
                    });
                }
                catch { }//Delete Prefetch
            }

            if (obj["rapp"] == 1)
            {
                try
                {
                    RegistryKey regKeyAppRoot = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Search\RecentApps", true);
                    foreach (string value in regKeyAppRoot.GetSubKeyNames())
                    {
                        regKeyAppRoot.DeleteSubKeyTree(value, true);
                    }
                    regKeyAppRoot.Close();
                }
                catch { }//Delete Regedit
            }

            if (obj["temp"] == 1)
            {
                string pat = Path.GetTempPath();
                System.IO.DirectoryInfo di = new DirectoryInfo(pat.ToString());
                foreach (FileInfo file in di.GetFiles())
                {
                    try
                    {
                        file.Delete();
                        if (!File.Exists(file.FullName))
                        {
                        }
                    }
                    catch { }
                }
                foreach (DirectoryInfo dir in di.GetDirectories())
                {
                    try
                    {
                        dir.Delete(true);
                        if (!Directory.Exists(dir.FullName))
                        {
                        }
                    }
                    catch { }
                }
            }

            if (obj["trac"] == 1)
            {
                try
                {
                    RegistryKey regKeyAppRoot = Registry.LocalMachine.OpenSubKey(@"Software\WOW6432Node\Microsoft\Tracing", true);
                    foreach (string value in regKeyAppRoot.GetSubKeyNames())
                    {
                        regKeyAppRoot.DeleteSubKeyTree(value, true);
                    }
                    regKeyAppRoot.Close();
                }
                catch
                { }//Delete Regedit
            }

            if (obj["rebin"] == 1)
            {
                try { uint result = SHEmptyRecycleBin(IntPtr.Zero, null, RecycleFlags.SHERB_NOCONFIRMATION); } catch { }
            }
            if (obj["rfile"] == 1)
            {
                String recent = Environment.ExpandEnvironmentVariables("%APPDATA%") + @"\Microsoft\Windows\Recente";
                try
                {
                    Array.ForEach(Directory.GetFiles(recent, "*.*"),
                                  delegate(string path)
                    {
                        File.Delete(path);
                        if (!File.Exists(path))
                        {
                        }
                    });
                }
                catch { }//Delete Recent files
                try { SHAddToRecentDocs(ShellAddToRecentDocsFlags.Pidl, (IntPtr)(0)); } catch { }
            }

            if (obj["wlogs"] == 1)
            {
                foreach (var eventLog in EventLog.GetEventLogs())
                {
                    try
                    {
                        eventLog.Clear();
                        eventLog.Dispose();
                    }
                    catch { }
                }
            }

            if (obj["mpoint"] == 1)
            {
                try
                {
                    RegistryKey regKeyAppRoot = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Explorer\MountPoints2", true);
                    foreach (string values in regKeyAppRoot.GetSubKeyNames())
                    {
                        regKeyAppRoot.DeleteSubKeyTree(values, true);
                    }
                }
                catch { }//Delete Regedit
            }

            if (obj["rstart"] == 1)
            {
                try
                {
                    regKey = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Run", true);
                    foreach (string value in regKey.GetValueNames())
                    {
                        regKey.DeleteValue(value, true);
                    }
                    regKey.Close();
                }
                catch
                {
                }
            }

            if (obj["useras"] == 1)
            {
                try
                {
                    regKey = Registry.CurrentUser.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\UserAssist", true);
                    foreach (string value in regKey.GetSubKeyNames())
                    {
                        regKey = Registry.CurrentUser.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\UserAssist\" + value.ToString() + @"\Count", true);
                        foreach (string cont in regKey.GetValueNames())
                        {
                            regKey.DeleteValue(cont, true);
                        }
                    }
                    regKey.Close();
                }
                catch
                {
                }
            }

            if (obj["compstore"] == 1)
            {
                try
                {
                    RegistryKey regKeyAppRoot = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Compatibility Assistant\Store", true);
                    foreach (string values in regKeyAppRoot.GetValueNames())
                    {
                        regKeyAppRoot.DeleteValue(values, true);
                    }
                }
                catch { }//Delete Regedit
            }
            Notificare.ShowBalloonTip(1000, "Optimised Cloud End", "Optimizarea trimisa din cloud pentru toti utilizatorii a fost efectuata.", ToolTipIcon.Info); //Trimite messajul primit de la actiunea trimisa din Cloud se termina.
            Functii.DownloadString("http://" + Functii.webip + "/notify/" + Key + "/" + token + "/all/");
        }