예제 #1
0
        private void button8_Click(object sender, EventArgs e)
        {
            int        i      = 0;
            ScanEngine insert = new ScanEngine();

            while (i < listBox1.Items.Count)
            {
                mutex_label.WaitOne();
                insert.make_Queue(Convert.ToString(listBox1.Items[i]), true);

                i++;
                mutex_label.ReleaseMutex();
            }
            insert.start_scan();
        }
예제 #2
0
        public bool FindSignature(string tmp, string path)
        {
            // Load_all_line_in_base();
            string buffer = tmp, to_hash_line = "";

            string wm_str = Find_prefix(tmp);

            while (wm_str == "" && tmp != "")
            {
                tmp    = tmp.Substring(1);
                wm_str = Find_prefix(tmp);
            }
            if (wm_str != "") //добавить сверку хэша найденного фрагмента и сигнатуры
            {
                if (signature_dict.TryGetValue(wm_str, out var value))
                {
                    if (tmp.Length >= value.signature_length)
                    {
                        for (int i = 0; i < value.signature_length; i++)
                        {
                            to_hash_line += tmp[i];
                        }

                        Calculating_hash calc_hash = new Calculating_hash();
                        bool             rep       = calc_hash.Check_hash(to_hash_line, value.signature_hash);
                        if (rep)
                        {
                            ScanEngine.Report(value.name, path);
                        }
                        return(calc_hash.Check_hash(to_hash_line, value.signature_hash));
                    }
                    else
                    {
                        return(false);
                    }
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                return(false);
            }
        }