//----- Start Worker ----- //******** Work With Running Applications ******** //Skontroluje spustene aplikacie void WorkWithRunningApplications() { if (day != ((short)DateTime.Now.Day)) { PCHour = 0; PCMin = 0; appinfo.Clear(); day = (short)DateTime.Now.Day; } if (File.Exists(PathMS + "/Temp/appreport.dat")) { try { save.Destroy(); save = new SaveWriter(PathMS + "/Temp/appreport.dat"); save.Load(); int count = save.GetItemInt("Count"); for (int i = 0; i < count; i++) { bool found = false; string executable = save.GetItem("Module_" + i); for (int j = 0; j < appinfo.Count; j++) { if (appinfo[j].ExecutableName.Equals(executable)) { found = true; appinfo[j].AddTime(5); } } if (!found) { appinfo.Add(new ApplicationInfo(save.GetItem("Title_" + i), executable)); } } save.Destroy(); } catch (Exception ex) { ApplicationLoader.PROCESS_INFORMATION procInfos; ApplicationLoader.StartProcessAndBypassUAC(AppDomain.CurrentDomain.BaseDirectory + "/Apps/GetRunningApplications.exe", out procInfos); DebugService.WriteError("Bad load data: " + ex); return; } } ApplicationLoader.PROCESS_INFORMATION procInfo; ApplicationLoader.StartProcessAndBypassUAC(AppDomain.CurrentDomain.BaseDirectory + "/Apps/GetRunningApplications.exe", out procInfo); }
//---------- Save App Monitoring ---------- //********* Load App Monitoring ********* void LoadAppMonitoring() { try { Directory.CreateDirectory(PathMS + "/MonitoringReports/App/"); if (File.Exists(PathMS + "/MonitoringReports/App/" + DateTime.Now.Day + "-" + DateTime.Now.Month + "-" + DateTime.Now.Year + ".apprep")) { save = new SaveWriter(PathMS + "/MonitoringReports/App/" + DateTime.Now.Day + "-" + DateTime.Now.Month + "-" + DateTime.Now.Year + ".apprep"); save.Load(); for (int i = 0; i < save.GetItemInt("Count"); i++) { ApplicationInfo inf = new ApplicationInfo(save.GetItem("Title_" + i), save.GetItem("Module_" + i)); inf.SetTime(save.GetItemInt("TimeHours_" + i), save.GetItemInt("TimeMin_" + i)); appinfo.Add(inf); } PCHour = save.GetItemInt("PCTimeHour"); PCMin = save.GetItemInt("PCTimeMinutes"); save.Destroy(); } } catch (Exception ex) { DebugService.WriteError("" + ex); } }
//---------- Save Remaining Time ---------- //********* Save App Monitoring ********* void SaveAppMonitoring() { try { Directory.CreateDirectory(PathMS + "/MonitoringReports/App/"); save.Destroy(); save = new SaveWriter(PathMS + "/MonitoringReports/App/" + DateTime.Now.Day + "-" + DateTime.Now.Month + "-" + DateTime.Now.Year + ".apprep"); save.AddItem("Count", appinfo.Count); for (int i = 0; i < appinfo.Count; i++) { appinfo[i].CalcTime(); save.AddItem("Title_" + i, appinfo[i].ApplicationName); save.AddItem("Module_" + i, appinfo[i].ExecutableName); save.AddItem("TimeMin_" + i, appinfo[i].GetMinutes()); save.AddItem("TimeHours_" + i, appinfo[i].GetHours()); } save.AddItem("PCTimeHour", PCHour); save.AddItem("PCTimeMinutes", PCMin); save.Save(); save.Destroy(); }catch (Exception ex) { DebugService.WriteError("" + ex); } }
//********* Load App Monitoring ********* public static List <ApplicationInfo> LoadAppMonitoring(string name) { List <ApplicationInfo> appinfo = new List <ApplicationInfo>(); try { SaveWriter save = new SaveWriter(); if (File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "/My Spy/MonitoringReports/App/" + name + ".apprep")) { save = new SaveWriter(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "/My Spy/MonitoringReports/App/" + name + ".apprep"); save.Load(); for (int i = 0; i < save.GetItemInt("Count"); i++) { ApplicationInfo inf = new ApplicationInfo(save.GetItem("Title_" + i), save.GetItem("Module_" + i)); inf.SetTime(save.GetItemInt("TimeHours_" + i), save.GetItemInt("TimeMin_" + i)); appinfo.Add(inf); } PCHour = save.GetItemInt("PCTimeHour"); PCMin = save.GetItemInt("PCTimeMinutes"); save.Destroy(); } } catch (Exception ex) { Debug.WriteLine("" + ex); return(appinfo); } return(appinfo); }
}//----- Form 1 Load ----- //******* Get notice ******** void GetNotice() { Directory.CreateDirectory(PathMS + "/MonitoringReports/Notes/"); Directory.CreateDirectory(PathMS + "/Temp/"); DirectoryInfo dir = new DirectoryInfo(PathMS + "/MonitoringReports/Notes/"); SaveWriter load = new SaveWriter(); if (File.Exists(PathMS + "/Temp/Rnotes.dat")) { File.Delete(PathMS + "/Temp/Rnotes.dat"); } SaveWriter save = new SaveWriter(PathMS + "/Temp/Rnotes.dat"); int k = 0; foreach (FileInfo file in dir.GetFiles("*.notesp")) { load.Destroy(); load.PathToFile = file.FullName; load.Load(); if (load.GetItemBool("Warn")) { save.AddItem("NotePath" + k, file.FullName); save.AddItem("NoteDate" + k, load.GetItem("WarnTimeDate")); k++; } } save.AddItem("Count", k); save.Save(); }
private void button1_Click(object sender, EventArgs e) { if (!string.IsNullOrWhiteSpace(textBoxuser.Text)) { if (!string.IsNullOrWhiteSpace(textBoxpass.Text)) { try { string pass = encrypt.EncryptText(textBoxpass.Text, "ZuhajoLafyNAYjCAw2VZfaYo"); XmppClient client = new XmppClient(Server, AppPrefix + textBoxuser.Text, pass); client.Connect(); Debug.WriteLine("Logged in as: " + client.Jid); XmppClient clientad = new XmppClient(Server, "Admin_" + AppPrefix + textBoxuser.Text, pass); clientad.Connect(); Debug.WriteLine("Logged in as: " + clientad.Jid); Directory.CreateDirectory(PathMS + "/Settings/"); if (File.Exists(PathMS + "/Settings/chat.dat")) { File.Delete(PathMS + "/Settings/chat.dat"); } SaveWriter save = new SaveWriter(PathMS + "/Settings/chat.dat"); save.AddItem("Username", AppPrefix + textBoxuser.Text); save.AddItem("Password", encryptpass.EncryptString(pass, "1cPOnaLrV2MusS4Cq3aU6dja")); save.AddItem("Admin", radioButtonAdmin.Checked); save.Save(); save.Destroy(); pass = ""; MessageBox.Show("Logged in", "OK"); Application.Exit(); } catch (Exception ex) { MessageBox.Show("User not exist, or bad password", "Error"); } } else { MessageBox.Show("Empty password"); } } else { MessageBox.Show("Empty Username"); } }
private void Form1_Load(object sender, EventArgs e) { notifyIcon1.MouseClick += notifyIcon1_MouseClick; NotifyText = notifyIcon1.Text; MinutesText = labelremtime.Text; if (File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "/My Spy/Block/ComputerTime.dat")) { SaveWriter save = new SaveWriter(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "/My Spy/Block/ComputerTime.dat"); save.Load(); if (save.GetItemBool("Enable")) { Time = save.GetItemInt("WarningTime"); labelremtime.Text = "" + Time + " " + MinutesText; notifyIcon1.Text = NotifyText + " " + Time + " " + MinutesText; } save.Destroy(); } else { Application.Exit(); } if (File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "/My Spy/Temp/shwwrn.dat")) { File.Delete(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "/My Spy/Temp/shwwrn.dat"); } else { // Application.Exit(); } try { SoundPlayer player = new SoundPlayer(Properties.Resources.warning); player.Play(); }catch (Exception ex) { } try { IntPtr lHwnd = FindWindow("Shell_TrayWnd", null); SendMessage(lHwnd, WM_COMMAND, (IntPtr)MIN_ALL, IntPtr.Zero); WindowState = FormWindowState.Normal; } catch (Exception ex) { } }
void SaveStatistics() { try { if (StatsEn) { Directory.CreateDirectory(PathMS + "/Stats/"); if (File.Exists(PathMS + "/Stats/Today.sts")) { SaveWriter savew = new SaveWriter(PathMS + "/Stats/Today.sts"); savew.Load(); if (savew.GetItemInt("Day") != DateTime.Now.Day) { int hrs = savew.GetItemInt("Hours"); short mns = (short)savew.GetItemInt("Mins"); bool Graphskip = false; if (DateTime.Now.Day < savew.GetItemInt("Day")) { Graphskip = true; if (File.Exists(PathMS + "/Stats/MonthOld.sts")) { File.Delete(PathMS + "/Stats/MonthOld.sts"); } if (File.Exists(PathMS + "/Stats/MonthGraphOld.sts")) { File.Delete(PathMS + "/Stats/MonthGraphOld.sts"); } if (File.Exists(PathMS + "/Stats/Month.sts")) { File.Move(PathMS + "/Stats/Month.sts", PathMS + "/Stats/MonthOld.sts"); } if (File.Exists(PathMS + "/Stats/MonthGraph.sts")) { File.Move(PathMS + "/Stats/MonthGraph.sts", PathMS + "/Stats/MonthGraphOld.sts"); } } savew.Destroy(); savew.PathToFile = PathMS + "/Stats/Month.sts"; if (File.Exists(PathMS + "/Stats/Month.sts")) { savew.Load(); int hrsm = hrs + savew.GetItemInt("Hours"); short mnsm = (short)(mns + (savew.GetItemInt("Mins"))); if (mnsm > 59) { mnsm -= 60; hrsm++; } int cnt = savew.GetItemInt("Divide"); File.Delete(PathMS + "/Stats/Month.sts"); savew.Destroy(); savew.AddItem("Month", DateTime.Now.Month); savew.AddItem("Hours", hrsm); savew.AddItem("Mins", mnsm); savew.AddItem("Divide", (cnt + 1)); savew.Save(); } else { if (!Graphskip) { savew.AddItem("Month", DateTime.Now.Month); savew.AddItem("Hours", hrs); savew.AddItem("Mins", mns); savew.AddItem("Divide", 1); savew.Save(); } } savew.Destroy(); savew.PathToFile = PathMS + "/Stats/MonthGraph.sts"; if (File.Exists(PathMS + "/Stats/MonthGraph.sts")) { savew.Load(); savew.LoadedValuesToSaveValues(); int cnt = savew.GetItemInt("Count"); cnt++; savew.AddItem("Value" + cnt, ((hrs * 60) + mns)); savew.AddItem("Day" + cnt, (DateTime.Now.Day - 1)); savew.RemoveItem("Count"); savew.AddItem("Count", cnt); savew.Save(); } else { if (!Graphskip) { savew.AddItem("Value1", ((hrs * 60) + mns)); savew.AddItem("Day1", (DateTime.Now.Day - 1)); savew.AddItem("Count", 1); savew.Save(); } } savew.Destroy(); savew.PathToFile = PathMS + "/Stats/AllTime.sts"; if (File.Exists(PathMS + "/Stats/AllTime.sts")) { savew.Load(); int hrsa = savew.GetItemInt("Hours"); short mnsa = (short)savew.GetItemInt("Mins"); int cnt = savew.GetItemInt("Divide"); hrsa += hrs; mnsa += mns; cnt++; if (mnsa >= 60) { hrsa++; mnsa -= 60; } if (cnt > 30) { long tms = (hrsa * 60) + mnsa; long time = (tms / cnt) * 5; int hour = (int)Math.Floor((decimal)(time / 60)); short minutes = (short)(time - (hour * 60)); hrsa = hour; mnsa = minutes; cnt = 5; } File.Delete(PathMS + "/Stats/AllTime.sts"); savew.Destroy(); savew.AddItem("Hours", hrsa); savew.AddItem("Mins", mnsa); savew.AddItem("Divide", cnt); savew.Save(); } else { savew.AddItem("Hours", hrs); savew.AddItem("Mins", mns); savew.AddItem("Divide", 1); savew.Save(); } allhour = 0; allmin = 0; } }//ak existuje today.sts if (File.Exists(PathMS + "/Stats/Today.sts")) { File.Delete(PathMS + "/Stats/Today.sts"); } SaveWriter save = new SaveWriter(PathMS + "/Stats/Today.sts"); save.AddItem("Date", "" + DateTime.Now); save.AddItem("Hours", allhour); save.AddItem("Mins", allmin); save.AddItem("Day", DateTime.Now.Day); save.Save(); save.Destroy(); }//StatsEn == true }catch (Exception ex) { DebugService.WriteError("" + ex); } }//SaveStatistics()
void SetRemainingPCTime() { if (!ShutDownVerify) { bool custommaxtimepc = false; if (File.Exists(PathMS + "/Block/RemTime.dat")) { save = new SaveWriter(PathMS + "/Block/RemTime.dat"); save.Load(); if (save.GetItemInt("Day") == DateTime.Now.Day) { MaxTimePC = save.GetItemInt("Time"); custommaxtimepc = true; } else { File.Delete(PathMS + "/Block/RemTime.dat"); } } if (File.Exists(PathMS + "/Block/ComputerTime.dat")) { SaveWriter save = new SaveWriter(PathMS + "/Block/ComputerTime.dat"); save.Load(); if (save.GetItemBool("Enable")) { PCTime = true; DateTime time = DateTime.Parse(save.GetItem("Time")); if (!custommaxtimepc) { MaxTimePC = (time.Hour * 60) + time.Minute; } warning = save.GetItemBool("Warning"); warningtime = save.GetItemInt("WarningTime"); if (MaxTimePC <= 1) { if (File.Exists(PathMS + "/Temp/ExpiredTime.dat")) { File.Delete(PathMS + "/Temp/ExpiredTime.dat"); } File.WriteAllText(PathMS + "/Temp/ExpiredTime.dat", "" + DateTime.Now.Day); PCTime = false; ShutDownVerify = true; ApplicationLoader.PROCESS_INFORMATION procInfo; ApplicationLoader.StartProcessAndBypassUAC(AppDomain.CurrentDomain.BaseDirectory + "/Apps/VerifyUser.exe", out procInfo); } } save.Destroy(); } else { PCTime = false; } } }
//***** Nacitanie Formu private void Form1_Load(object sender, EventArgs e) { //Nacitam si vlastny font try { prfontc = new PrivateFontCollection(); prfontc.AddFontFile(AppDomain.CurrentDomain.BaseDirectory + "/Resources/font.ttf"); fontsmall = new Font(prfontc.Families[0], 14.0F); fontmedium = new Font(prfontc.Families[0], 15.0F); font = new Font(prfontc.Families[0], 18.0F); fontbig = new Font(prfontc.Families[0], 26.0F); } catch (Exception ex) { Debug.WriteLine(ex); fontsmall = new Font(label1.Font.FontFamily, 14.0F); fontmedium = new Font(label1.Font.FontFamily, 15.0F); font = new Font(label1.Font.FontFamily, 18.0F); fontbig = new Font(label1.Font.FontFamily, 26.0F); } try { if (registry == null) { Process.Start(AppDomain.CurrentDomain.BaseDirectory + "/Apps/Welcome.exe"); Application.Exit(); } else { if (registry.GetValue("Properties", null) == null) { Process.Start(AppDomain.CurrentDomain.BaseDirectory + "/Apps/Welcome.exe"); Application.Exit(); } } }catch (Exception ex) { Debug.WriteLine("" + ex); Application.Exit(); } pictureBox3.MouseEnter += PictureBox3_MouseEnter; pictureBox3.MouseLeave += PictureBox3_MouseLeave; pictureBox4.MouseEnter += PictureBox4_MouseEnter; pictureBox4.MouseLeave += PictureBox4_MouseLeave; pictureBox5.MouseDown += PictureBox5_MouseDown; pictureBox5.MouseUp += PictureBox5_MouseUp; ImageList tabimage = new ImageList(); tabimage.Images.Add("img1", Properties.Resources.home); tabimage.Images.Add("img2", Properties.Resources.login); tabimage.Images.Add("img3", Properties.Resources.task); tabControl1.ImageList = tabimage; tabControl1.TabPages[0].ImageKey = "img1"; tabControl1.TabPages[1].ImageKey = "img3"; tabControl1.TabPages[2].ImageKey = "img2"; label2.Font = fontbig; button1.Font = font; backgroundWorker1.ProgressChanged += new ProgressChangedEventHandler(backgroundWorker1_ProgressChanged); backgroundWorkerWeather.ProgressChanged += new ProgressChangedEventHandler(BackgroundWorkerWeather_ProgressChanged); try { if (File.Exists(PathMS + "/Temp/secure.pas")) { File.Delete(PathMS + "/Temp/secure.pas"); } } catch (Exception exc) { Debug.WriteLine(exc); } AddNotesToPanel(); backgroundWorkerWeather.RunWorkerAsync(); textBoxPassword.KeyDown += new KeyEventHandler(TextBoxPassword_KeyPress); new Thread(() => { Thread.CurrentThread.IsBackground = true; try { if (File.Exists(PathMS + "/Temp/FavoriteNote.dat")) { string pathn = File.ReadAllText(PathMS + "/Temp/FavoriteNote.dat"); string shorttext = ""; using (StreamReader str = new StreamReader(pathn)) { for (int i = 0; i < 91; i++) { int ch = str.Read(); if (str.EndOfStream) { break; } shorttext += (char)ch; } } noteMain.SetNoteText(shorttext); noteMain.Tag = pathn; noteMain.Click += new EventHandler(this.Note_Click); this.Invoke((MethodInvoker) delegate { panelNote.Visible = true; }); } if (File.Exists(PathMS + "/Block/BlockApps.dat")) { SaveWriter set = new SaveWriter(PathMS + "/Block/BlockApps.dat"); set.Load(); if (set.GetItemBool("Enabled")) { set.Destroy(); set.PathToFile = PathMS + "/Block/RemTime.dat"; if (File.Exists(PathMS + "/Block/RemTime.dat")) { set.Load(); int timerem = set.GetItemInt("Time"); int hrs = 0, mns = 0; if (timerem > 0) { hrs = (int)Math.Floor((decimal)(timerem / 60)); mns = (timerem - (hrs * 60)); } this.Invoke((MethodInvoker) delegate { panelRemTime.Visible = true; if (timerem > 0) { labelRemTime.Text = hrs.ToString("00") + ":" + mns.ToString("00"); } }); } } } if (bool.Parse("" + registrysettings.GetValue("Statistics", false))) { if (File.Exists(PathMS + "/Stats/Today.sts")) { SaveWriter svs = new SaveWriter(PathMS + "/Stats/Today.sts"); svs.Load(); string time = svs.GetItemInt("Hours").ToString("00") + ":" + svs.GetItemInt("Mins").ToString("00"); svs.Destroy(); bool month = false; string monthav = ""; if (File.Exists(PathMS + "/Stats/Month.sts")) { month = true; svs.PathToFile = PathMS + "/Stats/Month.sts"; svs.Load(); int avgh = ((svs.GetItemInt("Hours") * 60) + svs.GetItemInt("Mins")) / svs.GetItemInt("Divide"); int hour = (int)Math.Floor((decimal)(avgh / 60)); int minutes = (avgh - (hour * 60)); monthav = hour.ToString("00") + ":" + minutes.ToString("00"); svs.Destroy(); } this.Invoke((MethodInvoker) delegate { panelTime.Visible = true; label8.Text = time; label10.Text = monthav; }); } } }catch (Exception ex) { Debug.WriteLine("" + ex); } }).Start(); //koniec threadu if (File.Exists(PathMS + "/Settings/chat.dat")) { longButtonchat.Visible = true; } bool keylogger = false; try { keylogger = bool.Parse((string)registrysettings.GetValue("Keylogger", "false")); } catch { keylogger = false; } panel3.Visible = keylogger; label4.Font = fontmedium; labelRemTime.Font = fontsmall; label5.Font = font; label8.Font = fontsmall; label9.Font = font; label10.Font = fontsmall; label11.Font = fontmedium; }//----- Form 1 Load -----