我使用以下代码调用.Net核心Web API方法。但是控制台日志
undefined
scan(file) {
this.value = this.http.get("api/Scanner", { responseType: 'text' }).subscribe((result: any) => {
this.value = result.Content;
console.log(this.value);
})
}
[Route("api/[controller]")]
public class ScannerController : Controller
{ [HttpGet]
public async Task<IActionResult> ScanAsync(string file_id)
{
//New Update //
file_id = "./wwwroot/Upload/1";
VirusTotal virusTotal = new VirusTotal("mykey");
// virusTotal.UseTLS = true;
FileStream stream = System.IO.File.OpenRead(file_id);
byte[] fileBytes = new byte[stream.Length];
// stream.Seek(0, SeekOrigin.Begin);
stream.Read(fileBytes, 0, fileBytes.Length);
VirusTotalNet.Results.FileReport report = await virusTotal.GetFileReportAsync(fileBytes);
bool hasFileBeenScannedBefore = report.ResponseCode == FileReportResponseCode.Present;
Console.WriteLine("File has been scanned before: " + (hasFileBeenScannedBefore ? "Yes" : "No"));
//If the file has been scanned before, the results are embedded inside the report.
if (hasFileBeenScannedBefore)
{
return Ok(report);
}
else
{
ScanResult fileResult = await virusTotal.ScanFileAsync(fileBytes,"1");
return Ok(fileResult);
}
}
}
我需要将VT返回的结果显示为表。
更新:
来自网络监视器的JSON
{"mD5":"a974beae1dcbdd038c0e319a1ebe3658","permalink":"https://www.virustotal.com/file/e9f1ab01fc0e4907e30cc259dd31f25bd77a46cb43daab8462c030286f75b7d1/analysis/1582697513/","positives":0,"resource":"e9f1ab01fc0e4907e30cc259dd31f25bd77a46cb43daab8462c030286f75b7d1","scan_date":"2020-02-26T06:11:53","scan_id":"e9f1ab01fc0e4907e30cc259dd31f25bd77a46cb43daab8462c030286f75b7d1-1582697513","scans":{"Bkav":{"detected":false,"version":"1.3.0.9899","result":null,"update":"20200221"},"TotalDefense":{"detected":false,"version":"37.1.62.1","result":null,"update":"20200225"},"MicroWorld-eScan":{"detected":false,"version":"14.0.409.0","result":null,"update":"20200226"},"FireEye":{"detected":false,"version":"29.7.0.0","result":null,"update":"20200226"},"CAT-QuickHeal":{"detected":false,"version":"14.00","result":null,"update":"20200225"},"McAfee":{"detected":false,"version":"6.0.6.653","result":null,"update":"20200226"},"Malwarebytes":{"detected":false,"version":"3.6.4.335","result":null,"update":"20200225"},"Zillya":{"detected":false,"version":"2.0.0.4034","result":null,"update":"20200225"},"SUPERAntiSpyware":{"detected":false,"version":"5.6.0.1032","result":null,"update":"20200221"},"Sangfor":{"detected":false,"version":"1.0","result":null,"update":"20200221"},"K7AntiVirus":{"detected":false,"version":"11.96.33381","result":null,"update":"20200226"},"K7GW":{"detected":false,"version":"11.96.33380","result":null,"update":"20200226"},"BitDefenderTheta":{"detected":false,"version":"7.2.37796.0","result":null,"update":"20200211"},"F-Prot":{"detected":false,"version":"4.7.1.166","result":null,"update":"20200226"},"Symantec":{"detected":false,"version":"1.11.0.0","result":null,"update":"20200226"},"ESET-NOD32":{"detected":false,"version":"20902","result":null,"update":"20200226"},"Baidu":{"detected":false,"version":"1.0.0.2","result":null,"update":"20190318"},"TrendMicro-HouseCall":{"detected":false,"version":"10.0.0.1040","result":null,"update":"20200226"},"Avast":{"detected":false,"version":"18.4.3895.0","result":null,"update":"20200226"},"ClamAV":{"detected":false,"version":"0.102.2.0","result":null,"update":"20200225"},"Kaspersky":{"detected":false,"version":"15.0.1.13","result":null,"update":"20200226"},"BitDefender":{"detected":false,"version":"7.2","result":null,"update":"20200226"},"NANO-Antivirus":{"detected":false,"version":"1.0.134.25032","result":null,"update":"20200226"},"AegisLab":{"detected":false,"version":"4.2","result":null,"update":"20200226"},"Tencent":{"detected":false,"version":"1.0.0.1","result":null,"update":"20200226"},"Ad-Aware":{"detected":false,"version":"3.0.5.370","result":null,"update":"20200226"},"Emsisoft":{"detected":false,"version":"2018.12.0.1641","result":null,"update":"20200226"},"Comodo":{"detected":false,"version":"32130","result":null,"update":"20200226"},"F-Secure":{"detected":false,"version":"12.0.86.52","result":null,"update":"20200226"},"DrWeb":{"detected":false,"version":"7.0.44.12030","result":null,"update":"20200226"},"VIPRE":{"detected":false,"version":"81804","result":null,"update":"20200226"},"TrendMicro":{"detected":false,"version":"11.0.0.1006","result":null,"update":"20200226"},"McAfee-GW-Edition":{"detected":false,"version":"v2017.3010","result":null,"update":"20200226"},"CMC":{"detected":false,"version":"1.1.0.977","result":null,"update":"20190321"},"Sophos":{"detected":false,"version":"4.98.0","result":null,"update":"20200226"},"Cyren":{"detected":false,"version":"6.2.2.2","result":null,"update":"20200226"},"Jiangmin":{"detected":false,"version":"16.0.100","result":null,"update":"20200226"},"Avira":{"detected":false,"version":"8.3.3.8","result":null,"update":"20200226"},"Fortinet":{"detected":false,"version":"6.2.142.0","result":null,"update":"20200226"},"Antiy-AVL":{"detected":false,"version":"3.0.0.1","result":null,"update":"20200226"},"Kingsoft":{"detected":false,"version":"2013.8.14.323","result":null,"update":"20200226"},"Arcabit":{"detected":false,"version":"1.0.0.869","result":null,"update":"20200226"},"ViRobot":{"detected":false,"version":"2014.3.20.0","result":null,"update":"20200226"},"ZoneAlarm":{"detected":false,"version":"1.0","result":null,"update":"20200226"},"Avast-Mobile":{"detected":false,"version":"200225-00","result":null,"update":"20200225"},"Microsoft":{"detected":false,"version":"1.1.16800.2","result":null,"update":"20200226"},"TACHYON":{"detected":false,"version":"2020-02-26.01","result":null,"update":"20200226"},"AhnLab-V3":{"detected":false,"version":"3.17.1.26513","result":null,"update":"20200225"},"VBA32":{"detected":false,"version":"4.3.0","result":null,"update":"20200225"},"ALYac":{"detected":false,"version":"1.1.1.5","result":null,"update":"20200226"},"MAX":{"detected":false,"version":"2019.9.16.1","result":null,"update":"20200226"},"Zoner":{"detected":false,"version":"1.0.0.1","result":null,"update":"20200225"},"Rising":{"detected":false,"version":"25.0.0.24","result":null,"update":"20200226"},"Yandex":{"detected":false,"version":"5.5.2.24","result":null,"update":"20200223"},"Ikarus":{"detected":false,"version":"0.1.5.2","result":null,"update":"20200225"},"MaxSecure":{"detected":false,"version":"1.0.0.1","result":null,"update":"20200225"},"GData":{"detected":false,"version":"A:25.24989B:26.17816","result":null,"update":"20200226"},"AVG":{"detected":false,"version":"18.4.3895.0","result":null,"update":"20200226"},"Panda":{"detected":false,"version":"4.6.4.2","result":null,"update":"20200225"},"Qihoo-360":{"detected":false,"version":"1.0.0.1120","result":null,"update":"20200226"}},"shA1":"91dd5bd55ffde207c110eddc42480c56d10b3f33","shA256":"e9f1ab01fc0e4907e30cc259dd31f25bd77a46cb43daab8462c030286f75b7d1","total":60,"response_code":1,"verbose_msg":"Scan finished, information embedded"}