Exemplo n.º 1
0
        public void ScanKnownFile()
        {
            //Create the EICAR test virus. See http://www.eicar.org/86-0-Intended-use.html
            FileInfo fileInfo = new FileInfo("EICAR.txt");

            File.WriteAllText(fileInfo.FullName, @"X5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*");

            ScanResult fileResult = _virusTotal.ScanFile(fileInfo);

            //It should always be in the VirusTotal database.
            Assert.AreEqual(ScanResponseCode.Queued, fileResult.ResponseCode);
        }
        public void RescanSmallFile()
        {
            ScanResult fileResult = _virusTotal.ScanFile(new byte[1], "VirusTotal.NET-Test.txt");

            //It has been scanned before, we expect it to return queued.
            Assert.AreEqual(ScanResponseCode.Queued, fileResult.ResponseCode);
        }
Exemplo n.º 3
0
        public void GetReportForRecentFile()
        {
            //We create an unknown file
            string guid = "VirusTotal.NET" + Guid.NewGuid();

            FileInfo fileInfo = new FileInfo("VirusTotal.NET-Test.txt");

            File.WriteAllText(fileInfo.FullName, guid);

            //Attempt to submit it for scan
            ScanResult result = _virusTotal.ScanFile(fileInfo);

            FileReport fileReport = _virusTotal.GetFileReport(result.ScanId);

            //It should not be in the VirusTotal database already, which means it should return error.
            Assert.AreEqual(ReportResponseCode.StillQueued, fileReport.ResponseCode);
        }