C#如何使用Virustotal API将所有URL与域扫描相关联?

时间:2018-04-10 10:56:19

标签: c# api url get

我正在尝试获取所有Virustotal的扫描URL列表,这些URL与我在PC中的txt文件中写入的域列表相关。

我尝试使用带有此字符串的HTML Agility Pack下载整个页面源代码,以生成我需要通过webclient下载的链接:

  

(“https://www.virustotal.com/#/domain/”+域名)

没有成功,因为我得到的只是一堆3kb的html文件。

现在,当我通过网络搜索时,我发现了C#apis,但真正的问题是我不知道它们是如何工作的。

在这里,我正在复制我迄今所做的一件事:

//link da scannerizzare con virustotal
string[] LinksScan = System.IO.File.ReadAllLines(@"C:\Condivisione\cert-pa download\File 1\AutoLinksDownload1.txt");
//links Provenienti dallo scan
string[] LinksDL = System.IO.File.ReadAllLines(@"C:\Condivisione\cert-pa download\File 1\links.txt");

using (WebClient client = new WebClient())
{
    int i = 0;
    //Per ogni dominio scrivere gli url derivati in AutoLinksDownload1
    foreach (string line in LinksScan)
    {
        string result;

        if (line.Contains("https://"))//IF LINE CONTAINS "Https://"
        {
            //FILTER (DOMAIN)
            int pFrom1 = line.IndexOf("https://") + "https://".Length;
            int pTo1 = line.LastIndexOf("/");
            //FILTERED STRING
            result = line.Substring(pFrom1, pTo1 - pFrom1);
            Console.WriteLine(result);// Stringa da usare gia filtrata!!!
            //FINE FILTRO
        }
        else//IF Line CONTAINS "Http://"
        {
            //FILTER (DOMAIN)
            int pFrom = line.IndexOf("http://") + "http://".Length;
            int pTo = line.LastIndexOf("/");
            //FILTERED STRING
            result = line.Substring(pFrom, pTo - pFrom);// Stringa da usare gia filtrata!!!
            Console.WriteLine(result);
            //END FILTER
        }
        i++;
        //API VIRUSTOTAL
        VirusTotal virusTotal = new VirusTotal("MY API KEY");
        //USE https
        virusTotal.UseTLS = true;
        //DOMAIN SCAN
        ---> CODE I NEED TO FIGURE OUT
        // GET SCAN RESULT AS STRING
        ---> CODE I NEED TO FIGURE OUT
        //Save urls list on file 
       // File.AppendAllText(@"C:\Condivisione\cert-pa download\File 1\Pagine salvate\" + "pagina" + i + ".html", RESULTVAR);

        ////////////////////////DA CONTINUARE AD IMPLEMENTARE L'API DI VIRUSTOTAL HO 4 RICHIESTE PER MINUTO
    }
    //Aspetto una key
    Console.ReadKey();
}

0 个答案:

没有答案