コード例 #1
0
ファイル: PropertiesViewModel.cs プロジェクト: 5l1v3r1/Maze-1
        public void Initialize(ProcessPropertiesDto properties, ProcessViewModel process, ITargetedRestClient restClient)
        {
            _restClient = restClient;

            StaticPropertiesDto = properties;
            PropertiesDto       = properties;
            Process             = process;

            if (process.ParentProcessId != 0)
            {
                string parentProcess;
                if (process.ParentViewModel != null)
                {
                    parentProcess = process.Name;
                }
                else
                {
                    parentProcess = "<" + Tx.T("TaskManager:NotAvailable") + ">";
                }

                ParentProcessString = $"{parentProcess} ({process.ParentProcessId})";
            }

            Icon   = ImageUtilities.GetBitmapImage(properties.Icon);
            Status = properties.Status;

            InitializeChannel().Forget();
            UpdateActiveConnections().Forget();
        }
コード例 #2
0
        public ClientPanelViewModel(ITargetedRestClient restClient, IMazeRestClient mazeRestClient, ClientViewModel clientViewModel,
                                    IWindowService windowService, ClipboardSynchronizer clipboardSynchronizer)
        {
            _mazeRestClient        = mazeRestClient;
            _windowService         = windowService;
            _clipboardSynchronizer = clipboardSynchronizer;
            _clientViewModel       = clientViewModel;

            _restClient = restClient;

            Title = $"{clientViewModel.Username} [{clientViewModel.LatestSession.IpAddress}]";
            ComputerPowerCommands = new List <ButtonAction>
            {
                new ButtonAction(Tx.T("ClientPanel:Power.LogOff"), () => SystemPowerResource.LogOff(restClient)),
                new ButtonAction(Tx.T("ClientPanel:Power.Shutdown"), () => SystemPowerResource.Shutdown(restClient)),
                new ButtonAction(Tx.T("ClientPanel:Power.Restart"), () => SystemPowerResource.Restart(restClient))
            };
            SystemProgramsCommands = new List <ButtonAction>
            {
                new ButtonAction(Tx.T("ClientPanel:RemotePrograms.TaskManager"), () => ProgramsResource.StartTaskManager(restClient)),
                new ButtonAction(Tx.T("ClientPanel:RemotePrograms.RegEdit"), () => ProgramsResource.StartRegEdit(restClient)),
                new ButtonAction(Tx.T("ClientPanel:RemotePrograms.DeviceManager"), () => ProgramsResource.StartDeviceManager(restClient)),
                new ButtonAction(Tx.T("ClientPanel:RemotePrograms.ControlPanel"), () => ProgramsResource.StartControlPanel(restClient)),
                new ButtonAction(Tx.T("ClientPanel:RemotePrograms.ComputerManagement"), () => ProgramsResource.StartComputerManagement(restClient)),
                new ButtonAction(Tx.T("ClientPanel:RemotePrograms.EventLog"), () => ProgramsResource.StartEventLog(restClient)),
                new ButtonAction(Tx.T("ClientPanel:RemotePrograms.Services"), () => ProgramsResource.StartServices(restClient))
            };
        }
コード例 #3
0
ファイル: ChannelExtensions.cs プロジェクト: 5l1v3r1/Maze-1
 public static async Task <TChannel> CreateChannel <TChannel>(this IRequestBuilder requestBuilder,
                                                              ITargetedRestClient client, CancellationToken cancellationToken) where TChannel : IAwareDataChannel
 {
     using (var request = requestBuilder.Build())
     {
         return(await client.OpenChannel <TChannel>(request, cancellationToken));
     }
 }
コード例 #4
0
ファイル: RemoteFileSystem.cs プロジェクト: 5l1v3r1/Maze-1
        public RemoteFileSystem(IMemoryCache globalCache, ITargetedRestClient restClient)
        {
            _globalCache = globalCache;
            _restClient  = restClient;
            _localCache  = new ConcurrentDictionary <string, CachedDirectory>(_caseInsensitivePaths
                ? StringComparer.OrdinalIgnoreCase
                : StringComparer.Ordinal);

            InvalidFileNameChars = Path.GetInvalidFileNameChars().ToImmutableHashSet();
        }
コード例 #5
0
        public static Task <RemoteDesktopChannel> CreateScreenChannel(ComponentOptions captureOptions, ComponentOptions encoderOptions,
                                                                      ITargetedRestClient restClient)
        {
            var requestBuilder = CreateRequest(HttpVerb.Get, "screen");

            requestBuilder.Message.Headers.Add("capture", captureOptions.ToString());
            requestBuilder.Message.Headers.AcceptEncoding.Add(new StringWithQualityHeaderValue(encoderOptions.ToString(), 1));

            return(requestBuilder.CreateChannel <RemoteDesktopChannel>(restClient, CancellationToken.None));
        }
コード例 #6
0
 public TaskManagerViewModel(IShellStatusBar statusBar, ITargetedRestClient restClient, IWindowService windowService)
 {
     _statusBar     = statusBar;
     _windowService = windowService;
     _restClient    = restClient;
     _refreshTimer  = new DispatcherTimer {
         Interval = TimeSpan.FromSeconds(10)
     };
     _refreshTimer.Tick += RefreshTimerOnTick;
 }
コード例 #7
0
        public void Initialize(FileViewModel fileViewModel, ITargetedRestClient restClient)
        {
            _fileViewModel = fileViewModel;
            _restClient    = restClient;
            ExecuteDto     = new ExecuteFileDto {
                FileName = fileViewModel.Source.Path
            };

            if (!ExecuteDto.FileName.EndsWith(".exe"))
            {
                ExecuteDto.UseShellExecute = true;
            }
        }
コード例 #8
0
        public void Initialize(FileViewModel fileViewModel, FilePropertiesDto dto, ITargetedRestClient restClient)
        {
            var properties = GeneralPropertyViewModel.CreateFileProperties(fileViewModel, dto).ToList();

            GeneralProperties = CreateGeneralProperties(properties);
            Entry             = fileViewModel;
            DetailsViewModel  = new DetailsPropertyViewModel(dto.Properties);

            if (!Entry.IsDirectory)
            {
                HashViewModels = Enum.GetValues(typeof(FileHashAlgorithm)).Cast <FileHashAlgorithm>()
                                 .Select(x => new ComputeHashViewModel(Entry.Source.Path, x, restClient)).ToList();
            }
        }
コード例 #9
0
        public RegistryTreeViewModel(ITargetedRestClient restClient, IShellStatusBar statusBar)
        {
            _restClient = restClient;
            _statusBar  = statusBar;
            Entries     = new EntriesHelper <RegistryKeyViewModel>();
            Selection   = new TreeRootSelector <RegistryKeyViewModel, IntegratedRegistryKey>(Entries)
            {
                Comparers = new[] { new RegistryPathComparer() }
            };

            Entries.SetEntries(new[]
            {
                RegistryHive.ClassesRoot, RegistryHive.CurrentUser, RegistryHive.LocalMachine, RegistryHive.Users, RegistryHive.CurrentUser
            }.Select(CreateHiveViewModel));
        }
コード例 #10
0
        public RegistryKeyViewModel(RegistryTreeViewModel rootTreeViewModel, IntegratedRegistryKey registryKey, ITargetedRestClient restClient,
                                    IShellStatusBar statusBar, RegistryKeyViewModel parentViewModel)
        {
            RegistryKey        = registryKey;
            _rootTreeViewModel = rootTreeViewModel;
            _restClient        = restClient;
            _statusBar         = statusBar;
            Parent             = parentViewModel;

            Entries   = new EntriesHelper <RegistryKeyViewModel>(LoadSubKeys);
            Selection = new TreeSelector <RegistryKeyViewModel, IntegratedRegistryKey>(registryKey, this,
                                                                                       parentViewModel == null ? rootTreeViewModel.Selection : parentViewModel.Selection, Entries);

            if (!registryKey.HasSubKeys)
            {
                Entries.SetEntries(Enumerable.Empty <RegistryKeyViewModel>());
            }
        }
コード例 #11
0
        public FileExplorerViewModel(IShellStatusBar statusBar, IWindowService windowService, IMemoryCache cache,
                                     ITargetedRestClient client, IAppDispatcher dispatcher, IImageProvider imageProvider)
        {
            StatusBar     = statusBar;
            Window        = windowService;
            RestClient    = client;
            FileSystem    = new RemoteFileSystem(cache, RestClient);
            ImageProvider = imageProvider;
            Dispatcher    = dispatcher;

            ProcessingEntries = new ObservableCollection <ProcessingEntryViewModel>();

            NavigationBarViewModel       = new NavigationBarViewModel();
            DirectoryTreeViewModel       = new DirectoryTreeViewModel();
            EntriesViewModel             = new EntriesViewModel();
            FileTransferManagerViewModel = new FileTransferManagerViewModel();

            foreach (var childViewModel in new IFileExplorerChildViewModel[]
                     { NavigationBarViewModel, DirectoryTreeViewModel, EntriesViewModel, FileTransferManagerViewModel })
            {
                childViewModel.Initialize(this);
            }
        }
コード例 #12
0
ファイル: MessageBoxViewModel.cs プロジェクト: 5l1v3r1/Maze-1
 public MessageBoxViewModel(ITargetedRestClient restClient, IWindowService windowService, IShellStatusBar statusBar)
 {
     _windowService = windowService;
     _statusBar     = statusBar;
     _restClient    = restClient;
 }
コード例 #13
0
 public static Task <List <DirectoryEntry> > QueryDirectories(string path, ITargetedRestClient restClient) =>
 CreateRequest().AddQueryParam("path", path).AddQueryParam("directoriesOnly", "true").Execute(restClient)
 .Return <List <DirectoryEntry> >();
コード例 #14
0
 public static Task <DirectoryEntry> GetDirectoryEntry(string path, ITargetedRestClient restClient) =>
 CreateRequest(HttpVerb.Get, "directory").AddQueryParam("path", path).Execute(restClient).Return <DirectoryEntry>();
コード例 #15
0
 public ComputeHashViewModel(string path, FileHashAlgorithm hashAlgorithm, ITargetedRestClient restClient)
 {
     _path         = path;
     HashAlgorithm = hashAlgorithm;
     _restClient   = restClient;
 }
コード例 #16
0
 public static Task <string[]> GetFileVerbs(string path, ITargetedRestClient restClient) =>
 CreateRequest(HttpVerb.Get, "file/verbs").AddQueryParam("path", path).Execute(restClient).Return <string[]>();
コード例 #17
0
ファイル: TaskManagerResource.cs プロジェクト: 5l1v3r1/Maze-1
 public static Task <CallTransmissionChannel <IProcessWatcher> > GetProcessWatcher(ITargetedRestClient restClient) =>
 restClient.CreateChannel <TaskManagerResource, IProcessWatcher>("processWatcher");
コード例 #18
0
 public static Task <string> ExpandEnvironmentVariables(string path, ITargetedRestClient restClient) =>
 CreateRequest(HttpVerb.Get, "path").AddQueryParam("path", path).Execute(restClient).Return <string>();
コード例 #19
0
 public static Task <ProcessPropertiesDto> GetProperties(int processId, ITargetedRestClient restClient) =>
 CreateRequest(HttpVerb.Get, processId + "/properties").Execute(restClient).Return <ProcessPropertiesDto>();
コード例 #20
0
 public static Task Resume(int processId, ITargetedRestClient restClient) =>
 CreateRequest(HttpVerb.Get, processId + "/resume").Execute(restClient);
コード例 #21
0
 public static Task KillTree(int rootProcessId, ITargetedRestClient restClient) =>
 CreateRequest(HttpVerb.Get, rootProcessId + "/killTree").Execute(restClient);
コード例 #22
0
 public static Task BringToFront(int processId, ITargetedRestClient restClient) =>
 CreateRequest(HttpVerb.Get, processId + "/window/bringToFront").Execute(restClient);
コード例 #23
0
 public static Task Close(int processId, ITargetedRestClient restClient) =>
 CreateRequest(HttpVerb.Get, processId + "/window/close").Execute(restClient);
コード例 #24
0
 public static Task DeleteFile(string path, ITargetedRestClient restClient) =>
 CreateRequest(HttpVerb.Delete, "file").AddQueryParam("path", path).Execute(restClient);
コード例 #25
0
 public static Task Suspend(int processId, ITargetedRestClient restClient) =>
 CreateRequest(HttpVerb.Get, processId + "/suspend").Execute(restClient);
コード例 #26
0
 public static Task MoveDirectory(string path, string newPath, ITargetedRestClient restClient) =>
 CreateRequest(HttpVerb.Patch, "directory").AddQueryParam("path", path).AddQueryParam("newPath", newPath).Execute(restClient);
コード例 #27
0
 public static Task SetPriority(int processId, ProcessPriorityClass priority, ITargetedRestClient restClient) =>
 CreateRequest(HttpVerb.Get, processId + "/setPriority").AddQueryParam("priority", ((int)priority).ToString()).Execute(restClient);
コード例 #28
0
 public static Task <FilePropertiesDto> GetFileProperties(string path, ITargetedRestClient restClient) =>
 CreateRequest(HttpVerb.Get, "file/properties").AddQueryParam("path", path).Execute(restClient).Return <FilePropertiesDto>();
コード例 #29
0
 public static Task <List <ActiveConnectionDto> > GetConnections(int processId, ITargetedRestClient restClient) =>
 CreateRequest(HttpVerb.Get, processId + "/connections").Execute(restClient).Return <List <ActiveConnectionDto> >();
コード例 #30
0
 public static Task ExecuteFile(ExecuteFileDto dto, bool waitForExit, ITargetedRestClient restClient) =>
 CreateRequest(HttpVerb.Post, "file/execute", dto).AddQueryParam("waitForExit", waitForExit.ToString()).Execute(restClient);