示例#1
0
        private async void Button_SelectProcess_Click(object sender, RoutedEventArgs e)
        {
            var window = (Window)this.VisualRoot;
            ProcessSelection processSelection = new ProcessSelection();
            var dialogResult = await Avalonia.Threading.Dispatcher.UIThread.InvokeAsync <bool>(() => processSelection.ShowDialog <bool>(window));

            if (dialogResult != true)
            {
                return;
            }
            if (processSelection.SelectedProcess != null)
            {
                TargetProcess            = processSelection.SelectedProcess;
                TargetProcessHandle      = Helper.OpenProcess(TargetProcess.Id);
                TextBox_ProcessName.Text = processSelection.SelectedProcess.ProcessName;
                DataGrid_RIP.DataContext = null;
                TextBox_Log.Clear();

                TextBox_Stack.Clear();
                List <ProcessModule> modules = new List <ProcessModule>();
                var mainModule = TargetProcess.MainModule;
                foreach (ProcessModule m in TargetProcess.Modules)
                {
                    modules.Add(m);
                }

                modules.Sort((a, b) =>
                {
                    if (a.ModuleName == mainModule.ModuleName)
                    {
                        return(-1);
                    }
                    if (b.ModuleName == mainModule.ModuleName)
                    {
                        return(1);
                    }
                    return((int)(a.BaseAddress.ToInt64() - b.BaseAddress.ToInt64()));
                });

                ComboBox_SpecificModule.Items     = modules;
                ComboBox_ScanSpecificModule.Items = modules;
                foreach (ProcessModule m in modules)
                {
                    int    moduleMemorySize = m.ModuleMemorySize;
                    IntPtr startAddres      = m.BaseAddress;
                    IntPtr endAddres        = new IntPtr(m.BaseAddress.ToInt64() + moduleMemorySize);

                    TextBox_Stack.AppendText($"Module Name: {m.ModuleName}" + Environment.NewLine);
                    TextBox_Stack.AppendText($"File Name: {m.FileName}" + Environment.NewLine);
                    TextBox_Stack.AppendText($"Module Size: {moduleMemorySize.ToString("#,0")} Byte" + Environment.NewLine);
                    TextBox_Stack.AppendText($"Start Address: {startAddres.ToInt64().ToString("X2")} ({startAddres.ToInt64()})" + Environment.NewLine);
                    TextBox_Stack.AppendText($"End Address  : {endAddres.ToInt64().ToString("X2")} ({endAddres.ToInt64()})" + Environment.NewLine);
                    TextBox_Stack.AppendText($"---------------------------------------------------------------" + Environment.NewLine);
                }
            }
        }
示例#2
0
        private void Button_SelectProcess_Click(object sender, RoutedEventArgs e)
        {
            ProcessSelection processSelection = new ProcessSelection();
            Nullable <bool>  dialogResult     = processSelection.ShowDialog();

            if (dialogResult == true)
            {
                if (processSelection.SelectedProcess != null)
                {
                    TargetProcess            = processSelection.SelectedProcess;
                    TargetProcessHandle      = Helper.OpenProcess((int)Helper.ProcessAccessFlags.PROCESS_VM_READ, false, TargetProcess.Id);
                    TextBox_ProcessName.Text = processSelection.SelectedProcess.ProcessName;
                    DataGrid_RIP.ItemsSource = null;
                    TextBox_Log.Clear();

                    TextBox_Stack.Clear();
                    List <ProcessModule> modules = new List <ProcessModule>();
                    var mainModule = TargetProcess.MainModule;
                    foreach (ProcessModule m in TargetProcess.Modules)
                    {
                        modules.Add(m);
                    }

                    modules.Sort((a, b) => {
                        if (a.ModuleName == mainModule.ModuleName)
                        {
                            return(-1);
                        }
                        if (b.ModuleName == mainModule.ModuleName)
                        {
                            return(1);
                        }
                        return((int)(a.BaseAddress.ToInt64() - b.BaseAddress.ToInt64()));
                    });

                    foreach (ProcessModule m in modules)
                    {
                        int    moduleMemorySize = m.ModuleMemorySize;
                        IntPtr startAddres      = m.BaseAddress;
                        IntPtr endAddres        = new IntPtr(m.BaseAddress.ToInt64() + moduleMemorySize);

                        TextBox_Stack.AppendText($"Module Name: {m.ModuleName}" + "\r\n");
                        TextBox_Stack.AppendText($"File Name: {m.FileName}" + "\r\n");
                        TextBox_Stack.AppendText($"Module Size: {moduleMemorySize.ToString("#,0")} Byte" + "\r\n");
                        TextBox_Stack.AppendText($"Start Address: {startAddres.ToInt64().ToString("X2")} ({startAddres.ToInt64()})" + "\r\n");
                        TextBox_Stack.AppendText($"End Address  : {endAddres.ToInt64().ToString("X2")} ({endAddres.ToInt64()})" + "\r\n");
                        TextBox_Stack.AppendText($"---------------------------------------------------------------" + "\r\n");
                    }
                }
            }
        }