Exemplo n.º 1
0
 // Token: 0x0600000F RID: 15 RVA: 0x000028EC File Offset: 0x00000AEC
 private void Row_DoubleClick(object sender, MouseButtonEventArgs e)
 {
     try
     {
         command command = (command)this.commands_dg.SelectedItem;
         bool    flag    = command.state == "received";
         if (flag)
         {
             bool flag2 = command.id.EndsWith("1");
             if (flag2)
             {
                 bool flag3 = File.Exists(this.agent_path + "\\receive\\" + command.id);
                 if (flag3)
                 {
                     string sourceFileName = this.agent_path + "\\receive\\" + command.id;
                     string destFileName   = this.agent_path + "\\receive\\" + command.cmd.Substring(command.cmd.LastIndexOf("\\") + 1);
                     try
                     {
                         File.Copy(sourceFileName, destFileName);
                     }
                     catch
                     {
                     }
                 }
                 Process.Start(this.agent_path + "\\receive");
             }
             else
             {
                 ResultWindow resultWindow = new ResultWindow(this.agent_path + "\\receive\\" + command.id);
                 resultWindow.Show();
             }
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
     }
 }
Exemplo n.º 2
0
        // Token: 0x0600000A RID: 10 RVA: 0x00002340 File Offset: 0x00000540
        public void load_commands()
        {
            this.commands.Clear();
            int num = 0;

            Utility.create_path(this.agent_path + "\\receive");
            string[] files = Directory.GetFiles(this.agent_path + "\\receive");
            foreach (string text in new string[]
            {
                "\\wait",
                "\\sending",
                "\\sended"
            })
            {
                Utility.create_path(this.agent_path + text);
                IEnumerable <string> enumerable = Directory.EnumerateFiles(this.agent_path + text);
                foreach (string text2 in enumerable)
                {
                    num++;
                    command cmd_tmp = new command();
                    cmd_tmp.count = num;
                    cmd_tmp.id    = text2.Substring(text2.LastIndexOf("\\") + 1);
                    bool flag = text2.EndsWith("0");
                    if (flag)
                    {
                        cmd_tmp.type = "COMMAND";
                        cmd_tmp.cmd  = Utility.file_reader(text2);
                    }
                    else
                    {
                        bool flag2 = text2.EndsWith("2");
                        if (flag2)
                        {
                            cmd_tmp.type = "UPLOAD";
                            cmd_tmp.cmd  = Utility.file_reader(Settings.dns_upload_command_file_name_path + "\\" + Path.GetFileName(text2));
                        }
                        else
                        {
                            bool flag3 = text2.EndsWith("1");
                            if (flag3)
                            {
                                cmd_tmp.type = "DOWNLOAD";
                                cmd_tmp.cmd  = Utility.file_reader(text2);
                            }
                        }
                    }
                    bool flag4 = files.Contains(text2.Replace(text, "\\receive"));
                    if (flag4)
                    {
                        cmd_tmp.state = "received";
                    }
                    else
                    {
                        cmd_tmp.state = text.Substring(1);
                    }
                    cmd_tmp.date = File.GetCreationTime(text2).ToString("MM/dd/yyyy HH:mm:ss");
                    bool flag5 = this.commands.Any((command x) => x.id == cmd_tmp.id);
                    if (flag5)
                    {
                        this.commands = (from y in this.commands
                                         where y.id != cmd_tmp.id
                                         select y).ToList <command>();
                        this.commands.Add(cmd_tmp);
                    }
                    else
                    {
                        this.commands.Add(cmd_tmp);
                    }
                }
            }
            this.commands_dg.ItemsSource = null;
            this.commands = (from o in this.commands
                             orderby o.id descending
                             select o).ToList <command>();
            this.commands_dg.ItemsSource = this.commands;
        }