Beispiel #1
0
        private LameScanResult FetchResult(IntPtr resp)
        {
            try
            {
                var _result = (ScanResult_)Marshal.PtrToStructure(resp, typeof(ScanResult_));


                var result = new LameScanResult();
                result.EngineID      = _result.engid;
                result.VirusName     = _result.vname;
                result.VirusTypeName = _result.kclass;
                result.VirusTypeDesc = _result.kclass_desc_a;
                result.HitTag        = _result.hitag;
                result.VirusID32     = _result.vid32;
                result.VirusID40     = _result.vid40;
                result.VirusType     = _result.vtype;
                result.TreatResult   = _result.treat;

                return(result);
            }
            catch (Exception)
            {
            }

            return(null);
        }
Beispiel #2
0
        private int LameScanAlarm(string fname, IntPtr resp, IntPtr uuserdata)
        {
            LameScanResult result = null;

            if (resp != IntPtr.Zero)
            {
                result = FetchResult(resp);
            }
            if (result == null)
            {
                return((int)LSCT.CONTINUE);
            }
            return((int)AlarmEvent(fname, result));
        }
Beispiel #3
0
        private void ScanInternalFile(string fname, IntPtr resp, IntPtr zero)
        {
            LameScanResult result = null;

            if (_handle_file == null)
            {
                return;
            }

            if (resp != IntPtr.Zero)
            {
                result = FetchResult(resp);
            }

            _handle_file(fname, result);
        }
Beispiel #4
0
        public LameScanResult ScanFile(string sFile)
        {
            try
            {
                if (string.IsNullOrEmpty(sFile))
                {
                    throw new Exception("Invalid param");
                }
                if (pEngine == IntPtr.Zero)
                {
                    throw new Exception("Invalid lame");
                }


                var _result = new ScanResult_();
                if (LameUtity.lame_scan_file_(pEngine, sFile, ref _result) < 0)
                {
                    return(null);
                }

                var result = new LameScanResult();
                result.EngineID      = _result.engid;
                result.VirusName     = _result.vname;
                result.VirusTypeName = _result.kclass;
                result.VirusTypeDesc = _result.kclass_desc_a;
                result.HitTag        = _result.hitag;
                result.VirusID32     = _result.vid32;
                result.VirusID40     = _result.vid40;
                result.VirusType     = _result.vtype;
                result.TreatResult   = _result.treat;

                return(result);
            }
            catch (Exception e)
            {
                throw e;
            }
        }
Beispiel #5
0
        public LameScanResult ScanMem(byte[] bytes)
        {
            try
            {
                if (bytes == null || bytes.Length == 0)
                {
                    throw new Exception("Invalid param");
                }

                if (pEngine == IntPtr.Zero)
                {
                    throw new Exception("Invalid lame");
                }

                var _result = new ScanResult_();
                if (LameUtity.lame_scan_mem_(pEngine, bytes, (uint)bytes.Length, ref _result) < 0)
                {
                    return(null);
                }

                var result = new LameScanResult();

                result.EngineID    = _result.engid;
                result.VirusName   = _result.vname;
                result.HitTag      = _result.hitag;
                result.VirusID32   = _result.vid32;
                result.VirusID40   = _result.vid40;
                result.VirusType   = _result.vtype;
                result.TreatResult = _result.treat;

                return(result);
            }
            catch (Exception e)
            {
                throw e;
            }
        }