Esempio n. 1
0
        static void Main(string[] args)
        {
            TestInjector();
            TestVulturnus(0x00E94F87);
            SignatureScan signatureScan = new SignatureScan(Process.GetProcessesByName("Icy.Test")[0], "E8 ?? ? ?? ?? E9 ?? ?? ?? ?? 55 8B EC 6A 00 FF", 0x00e91000, 0x4000, 1);

            Console.WriteLine("{0:X}", signatureScan.Address());

            Console.ReadLine();
        }
Esempio n. 2
0
        private void FindButton_Click(object sender, RoutedEventArgs e)
        {
            if (String.IsNullOrEmpty(SearchTextBox.Text) || ByteViewer.ByteProvider == null)
            {
                return;
            }

            if (SearchBytesRadioButton.IsChecked == true && SearchOptionCheckBox.IsChecked == true)
            {
                SignatureSearchResult = 1;
                SignatureScan scan    = new SignatureScan(SearchTextBox.Text, ByteViewer.ByteProvider, SignatureSearchResult);
                long          address = scan.Address();
                if (address >= 0)
                {
                    ByteViewer.SelectionStart  = address;
                    ByteViewer.SelectionLength = scan.PatternSize;
                }
                else
                {
                    MessageBox.Show("The following specified hexadecimal bytes was not found: \n\n" + SearchTextBox.Text, "Binary Engine", MessageBoxButton.OK, MessageBoxImage.Information);
                }

                return;
            }
            else
            {
                try
                {
                    ByteViewer.SelectionStart     = 0;
                    ByteViewFindOptions.MatchCase = (bool)SearchOptionCheckBox.IsChecked;
                    ByteViewFindOptions.Type      = (bool)SearchBytesRadioButton.IsChecked ? FindType.Hex : FindType.Text;

                    if (ByteViewFindOptions.Type == FindType.Hex)
                    {
                        ByteViewFindOptions.Hex = BytesConverter.StringToBytes(SearchTextBox.Text);
                    }
                    else
                    {
                        ByteViewFindOptions.Text = SearchTextBox.Text;
                    }

                    ByteViewFindOptions.IsValid = true;
                }
                catch
                {
                }
            }

            FindNextButton_Click(this, e);
        }
Esempio n. 3
0
        private void FindNextButton_Click(object sender, RoutedEventArgs e)
        {
            if (String.IsNullOrEmpty(SearchTextBox.Text) || ByteViewer.ByteProvider == null)
            {
                return;
            }

            if (SearchBytesRadioButton.IsChecked == true && SearchOptionCheckBox.IsChecked == true)
            {
                SignatureSearchResult++;

                SignatureScan scan    = new SignatureScan(SearchTextBox.Text, ByteViewer.ByteProvider, SignatureSearchResult);
                long          address = scan.Address();
                if (address >= 0)
                {
                    ByteViewer.SelectionStart  = address;
                    ByteViewer.SelectionLength = scan.PatternSize;
                }
                else
                {
                    MessageBox.Show("The following specified hexadecimal bytes was not found: \n\n" + SearchTextBox.Text, "Binary Engine", MessageBoxButton.OK, MessageBoxImage.Information);
                }
            }

            try
            {
                const long NO_MATCH          = -1;
                const long OPERATION_ABORTED = -2;

                switch (ByteViewer.Find(ByteViewFindOptions))
                {
                case NO_MATCH:
                    MessageBox.Show("The following specified text or hexadecimal bytes was not found: \n\n" + SearchTextBox.Text, "Binary Engine", MessageBoxButton.OK, MessageBoxImage.Information);
                    break;

                case OPERATION_ABORTED:
                    break;

                default:
                    //success
                    if (!ByteViewer.Focused)
                    {
                        ByteViewer.Focus();
                    }
                    break;
                }
            }
            catch { }
        }
Esempio n. 4
0
        private void FindAllButton_Click(object sender, RoutedEventArgs e)
        {
            FindAllReferencesGroupBox.Visibility = Visibility.Visible;
            ByteViewerHost.Margin = new Thickness(0, 20, 250, 105);

            FindAllListBox.Items.Clear();

            if (String.IsNullOrEmpty(SearchTextBox.Text) || ByteViewer.ByteProvider == null)
            {
                return;
            }

            if (SearchBytesRadioButton.IsChecked == true && SearchOptionCheckBox.IsChecked == true)
            {
                SignatureSearchResult = 1;
                SignatureScan scan = new SignatureScan(SearchTextBox.Text, ByteViewer.ByteProvider, SignatureSearchResult);
                for (long address = scan.Address(); address >= 0; scan.Result++, address = scan.Address())
                {
                    byte[] data = new byte[scan.PatternSize];
                    for (int i = 0; i < scan.PatternSize; ++i)
                    {
                        data[i] = ByteViewer.ByteProvider.ReadByte(address + i);
                    }

                    string content = $"{address.ToString("X8")} ({scan.PatternSize}): {new BytesConverter(data).ToHexadecimalString()} [\"{Encoding.ASCII.GetString(data)}\"]";
                    FindAllListBox.Items.Add(new ListBoxItem()
                    {
                        Content = content,
                        Tag     = new KeyValuePair <long, long>(address, scan.PatternSize),
                        ToolTip = new ToolTip()
                        {
                            Content = content
                        }
                    });
                }

                return;
            }
            else
            {
                try
                {
                    ByteViewer.SelectionStart     = 0;
                    ByteViewFindOptions.MatchCase = (bool)SearchOptionCheckBox.IsChecked;
                    ByteViewFindOptions.Type      = (bool)SearchBytesRadioButton.IsChecked ? FindType.Hex : FindType.Text;

                    if (ByteViewFindOptions.Type == FindType.Hex)
                    {
                        ByteViewFindOptions.Hex = BytesConverter.StringToBytes(SearchTextBox.Text);
                    }
                    else
                    {
                        ByteViewFindOptions.Text = SearchTextBox.Text;
                    }

                    ByteViewFindOptions.IsValid = true;


                    const long NO_MATCH = -1;

                    while (ByteViewer.Find(ByteViewFindOptions) != NO_MATCH)
                    {
                        byte[] data = new byte[ByteViewer.SelectionLength];
                        for (int i = 0; i < ByteViewer.SelectionLength; ++i)
                        {
                            data[i] = ByteViewer.ByteProvider.ReadByte(ByteViewer.SelectionStart + i);
                        }

                        string content = $"{ByteViewer.SelectionStart.ToString("X8")} ({ByteViewer.SelectionLength}): {new BytesConverter(data).ToHexadecimalString()} [\"{Encoding.ASCII.GetString(data)}\"]";
                        FindAllListBox.Items.Add(new ListBoxItem()
                        {
                            Content = content,
                            Tag     = new KeyValuePair <long, long>(ByteViewer.SelectionStart, ByteViewer.SelectionLength),
                            ToolTip = new ToolTip()
                            {
                                Content = content
                            }
                        });
                    }
                }
                catch
                {
                }
            }
        }