private void UpdateAvailableProcesses() { // Remember which item is currently selected, such that we can restore the scrollbar position var selectedIndicies = this.ListViewProcesses.SelectedIndices; var lastSelectedIndex = selectedIndicies.Count > 0 ? selectedIndicies[selectedIndicies.Count - 1] : 0; this.ProcessEntries.Clear(); this.ProcessEntries.AddRange((ProcessEntry[])RemoteHooking.ExecuteAsService <FormMain>("EnumerateProcesses")); this.ListViewProcesses.BeginUpdate(); this.ListViewProcesses.Items.Clear(); foreach (var process in this.ProcessEntries) { this.ListViewProcesses.Items.Add(new ListViewItem(new[] { process.Id.ToString(), process.IsX64 ? "64-bit" : "32-bit", process.ImageName, process.Owner, process.FullPath })); } // Restore the scrollbar position var realLastIndex = (this.ListViewProcesses.Items.Count >= lastSelectedIndex) ? lastSelectedIndex : this.ListViewProcesses.Items.Count - 1; this.ListViewProcesses.EnsureVisible(realLastIndex); this.ListViewProcesses.EndUpdate(); }
private void injectLibraryAsService(Process p, string library_location) { MessageFromInjector message = new MessageFromInjector(); message.channel_name = ChannelName; List <int> thread_ids = new List <int>(); foreach (ProcessThread t in p.Threads) { thread_ids.Add(t.Id); } message.thread_ids = thread_ids.ToArray(); Console.WriteLine("Injecting through service"); RemoteHooking.ExecuteAsService <RemoteHooking>("Inject", new Object[] { p.Id, library_location, null, message }); }
private static void OnProcessUpdate(Object InCallback) { ProcessTimer.Change(Timeout.Infinite, Timeout.Infinite); try { ProcessInfo[] Array; if (_noGAC) { Array = EnumProcesses(); } else { Array = (ProcessInfo[])RemoteHooking.ExecuteAsService <Form1>("EnumProcesses"); } SortedDictionary <String, ProcessInfo> Result = new SortedDictionary <string, ProcessInfo>(); // sort by name... lock (ProcessList) { ActivePIDList.Clear(); for (int i = 0; i < Array.Length; i++) { Result.Add(System.IO.Path.GetFileName(Array[i].FileName) + "____" + i, Array[i]); ActivePIDList.Add(Array[i].Id); } Result.Values.CopyTo(Array, 0); ProcessList.Clear(); ProcessList.AddRange(Array); } } catch (AccessViolationException) { MessageBox.Show("This is an administrative task!", "Permission denied...", MessageBoxButtons.OK); Process.GetCurrentProcess().Kill(); } finally { ProcessTimer.Change(5000, 5000); } }
public static void Run() { Config.Install(typeof(Config).Assembly.Location); Config.Register("", "TestSuite.exe"); ProcessInfo[] Result = (ProcessInfo[])RemoteHooking.ExecuteAsService <RHTest>("Enum"); /* * try * { * RemoteHooking.Inject( * 5416, * //2892, * //RemoteHooking.GetCurrentProcessId(), * InjectionOptions.None, "TestSuite.exe", "TestSuite.exe"); * } * catch * { * }*/ }