Exemplo n.º 1
0
        static void LameTest(VirusLib vdb, string path)
        {
            if (vdb == null)
            {
                return;
            }


            // 1. load
            Lame _lame = new Lame();

            if (!_lame.Load(vdb))
            {
                return;
            }

            //2. scan
            if (File.Exists(path))
            {
                LameScanResult _result = _lame.ScanFile(path);
                PrintScanResult(path, _result);
            }
            else if (Directory.Exists(path))
            {
                string[] files = Directory.GetFiles(path);
                foreach (string f in files)
                {
                    LameScanResult _result = _lame.ScanFile(f);
                    PrintScanResult(f, _result);
                }

                //travel dir......
            }



            //3.
            _lame.Unload();
        }
Exemplo n.º 2
0
 private void ScanFile(string file)
 {
     try
     {
         LameScanResult result = lame.ScanFile(file);
         lock (locker)
         {
             Console.ForegroundColor = ConsoleColor.Green;
             Console.Write(file);
             if (result != null)
             {
                 Console.ForegroundColor = ConsoleColor.Red;
                 Console.Write("     Infected:" + result.VirusName + " (" + result.EngineID + ")");
             }
             Console.WriteLine("");
         }
     }
     catch (System.Exception)
     {
     }
 }
Exemplo n.º 3
0
        private void scan()
        {
            _mannul_event.WaitOne();
            _mannul_event.Reset();

            var _Stopwatch = new Stopwatch();

            _Stopwatch.Start();

            while (true)
            {
                var file_path = _scan_objs.Dequeue();
                if (string.IsNullOrEmpty(file_path))
                {
                    Thread.Sleep(10);
                    continue;
                }

                if (file_path == "exit")
                {
                    _scan_objs.Enqueue("exit");
                    break;
                }

                ScanFileCount++;

                var res = _lame.ScanFile(file_path);
                if (res != null)
                {
                    VirusCount++;
                }

                MtdUtility.ShowScanResult(file_path, res);
            }

            _Stopwatch.Stop();
            ElapsedMilliseconds = _Stopwatch.ElapsedMilliseconds;

            _mannul_event.Set();
        }