private IEnumerable <string> GetResourcesFromFiles(params byte[][] files) { foreach (byte[] fileBytes in files) { yield return(HashHelper.GetSHA256(fileBytes)); } }
private IEnumerable <string> GetResourcesFromFiles(params Stream[] streams) { foreach (Stream stream in streams) { yield return(HashHelper.GetSHA256(stream)); } }
private IEnumerable <string> GetResourcesFromFiles(params FileInfo[] files) { foreach (FileInfo fileInfo in files) { yield return(HashHelper.GetSHA256(fileInfo)); } }
private IEnumerable <string> GetResourcesFromFiles(IEnumerable <FileInfo> files) { foreach (FileInfo fileInfo in files) { if (!fileInfo.Exists) { throw new FileNotFoundException("The file " + fileInfo.FullName + " does not exist."); } yield return(HashHelper.GetSHA256(fileInfo)); } }
/// <summary> /// Gets the report of the file. /// </summary> /// <param name="file">A list of files that will get hashes and scanned.</param> /// <returns></returns> public List <Report> GetFileReport(params FileInfo[] file) { string[] resources = new string[file.Length]; for (int i = 0; i < file.Length; i++) { FileInfo fileInfo = file[i]; if (fileInfo.Exists) { resources[i] = HashHelper.GetSHA256(fileInfo); } } return(GetFileReport(resources)); }
private IEnumerable <string> GetResourcesFromFiles(IEnumerable <FileInfo> files) { FileInfo[] fileInfos = files as FileInfo[] ?? files.ToArray(); string[] hashes = new string[fileInfos.Length]; for (int i = 0; i < fileInfos.Length; i++) { FileInfo fileInfo = fileInfos[i]; if (!fileInfo.Exists) { throw new FileNotFoundException("The file " + fileInfo.FullName + " does not exist."); } hashes[i] = HashHelper.GetSHA256(fileInfo); } return(hashes); }
/// <summary> /// Gives you a link to a URL analysis. /// </summary> /// <returns>A link to VirusTotal that contains the report</returns> public string GetPublicUrlScanLink(string url) { return(string.Format("{0}://www.virustotal.com/url/{1}/analysis/", UseTLS ? "https" : "http", HashHelper.GetSHA256(NormalizeUrl(url)))); }
/// <summary> /// Gives you a link to a file analysis based on its hash. /// </summary> /// <returns>A link to VirusTotal that contains the report</returns> public string GetPublicFileScanLink(FileInfo file) { return(GetPublicFileScanLink(HashHelper.GetSHA256(file))); }
/// <summary> /// Creates a comment on a file denoted by its hash and/or scan ID. /// </summary> /// <param name="file">The file you wish to create a comment on</param> /// <param name="comment">The comment you wish to add.</param> /// <returns>A ScanResult object containing information about the resource.</returns> public Task <ScanResult> CreateComment(FileInfo file, string comment) { return(CreateComment(HashHelper.GetSHA256(file), comment)); }
/// <summary> /// Gets the report of the file. /// Note: This does not send the files to VirusTotal. It hashes the file and sends that instead. /// </summary> /// <param name="file">The file you wish to get a report on.</param> public Task <FileReport> GetFileReport(FileInfo file) { return(GetFileReport(HashHelper.GetSHA256(file))); }
/// <summary> /// Creates a comment on a file denoted by its hash and/or scan ID. /// </summary> /// <param name="file">The file you wish to create a comment on</param> /// <param name="comment">The comment you wish to add.</param> /// <returns>A ScanResult object containing information about the resource.</returns> public ScanResult CreateComment(byte[] file, string comment) { return(CreateComment(HashHelper.GetSHA256(file), comment)); }
/// <summary> /// Gets the report of the file. /// Note: This does not send the files to VirusTotal. It hashes the file and sends that instead. /// </summary> /// <param name="file">The file you wish to get a report on.</param> public FileReport GetFileReport(byte[] file) { return(GetFileReport(HashHelper.GetSHA256(file))); }
public string GetPublicScanLink(FileInfo file) { return(string.Format("{0}://www.virustotal.com/file/{1}/analysis/", UseTLS ? "https" : "http", HashHelper.GetSHA256(file))); }