示例#1
0
        public async Task GetIPReportKnownIP()
        {
            IgnoreMissingJson("detected_referrer_samples[array] / Date", "resolutions[array] / ip_address", "undetected_referrer_samples[array] / Date");

            IPReport report = await VirusTotal.GetIPReport("8.8.8.8"); //Google DNS

            Assert.Equal(IPReportResponseCode.Present, report.ResponseCode);
        }
示例#2
0
    public async Task GetIPReportKnownIPv4()
    {
        IgnoreMissingJson("detected_referrer_samples[array] / Date");

        IPReport report = await VirusTotal.GetIPReportAsync(TestData.KnownIPv4s.First());

        Assert.Equal(IPReportResponseCode.Present, report.ResponseCode);
    }
示例#3
0
    public async Task GetIPReportUnknownIPv4()
    {
        //Unknown hosts do not have all this in the response
        IgnoreMissingJson(" / undetected_urls", " / as_owner", " / ASN", " / Country", " / detected_communicating_samples", " / detected_downloaded_samples", " / detected_referrer_samples", " / detected_urls", " / Resolutions", " / undetected_communicating_samples", " / undetected_downloaded_samples", " / undetected_referrer_samples");

        IPReport report = await VirusTotal.GetIPReportAsync("128.168.238.14");

        Assert.Equal(IPReportResponseCode.NotPresent, report.ResponseCode);
    }
        public async Task <ActionResult <string> > VirusTotalCheckIpAsync([FromBody] string scanIp)
        {
            IPReport ipReport = await virusTotal.GetIPReportAsync(scanIp);

            bool hasIpBeenScannedBefore = ipReport.ResponseCode == IPReportResponseCode.Present;

            //If the url has been scanned before, the results are embedded inside the report.
            if (hasIpBeenScannedBefore)
            {
                return("Scan ID:       " + ipReport.DetectedUrls.Count + "     Message:    " + ipReport.VerboseMsg);
            }
            else
            {
                UrlScanResult ipResult = await virusTotal.ScanUrlAsync(scanIp);

                return("IP Address is being scanned, come back later for the result." + "Scan ID: " + ipReport.DetectedUrls.Count + "Message: " + ipReport.VerboseMsg);
            }

            return("success");
        }
        public void GetIPReportKnownIP()
        {
            IPReport report = _virusTotal.GetIPReport("8.8.8.8"); //Google DNS

            Assert.AreEqual(IPReportResponseCode.Present, report.ResponseCode);
        }
示例#6
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="ip"></param>
        private async void ParseIPReportAsync(string ip)
        {
            bool valid = IsValidIPAddress(ip);

            if (valid == false)
            {
                MessageBoxResult ipInvalidError = MessageBox.Show("Invalid IP address !",
                                                                  "Error",
                                                                  MessageBoxButton.OK,
                                                                  MessageBoxImage.Error);
                return;
            }

            ipReport = await App.GetIPReportAsync(ip);

            IPCountry_Lbl.Content = ipReport.Country;
            IPOwner_Lbl.Content   = ipReport.AsOwner;

            if (ipReport.Resolutions != null && ipReport.Resolutions.Count > 0)
            {
                for (int i = 0; i < ipReport.Resolutions.Count; i++)
                {
                    IPResolutions_Lbl.Content += ipReport.Resolutions[i].Hostname + " (" + ipReport.Resolutions[i].LastResolved + ")" + "\n";
                }
            }

            int detectedURLPositives = 0;

            if (ipReport.DetectedUrls != null && ipReport.DetectedUrls.Count > 0)
            {
                detectedURLPositives = Convert.ToInt32(ipReport.DetectedUrls[0].Positives);
                IPReportURLDetectedPositives_Lbl.Content    = ipReport.DetectedUrls[0].Positives;
                IPReportURLDetectedTotalEngines_Lbl.Content = ipReport.DetectedUrls[0].Total;
                IPReportURLDetectedDate_Lbl.Content         = ipReport.DetectedUrls[0].ScanDate;
                IPReportURLDetectedURL_Lbl.Content          = ipReport.DetectedUrls[0].Url;
            }

            int detectedDownloadPositives = 0;

            if (ipReport.DetectedDownloadedSamples != null && ipReport.DetectedDownloadedSamples.Count > 0)
            {
                detectedDownloadPositives = Convert.ToInt32(ipReport.DetectedDownloadedSamples[0].Positives);
                IPReportDownloadSamplesPosisives_Lbl.Content = ipReport.DetectedDownloadedSamples[0].Positives;
                IPReportDownloadSamplesTotal_Lbl.Content     = ipReport.DetectedDownloadedSamples[0].Total;
                IPReportDownloadSamplesDate_Lbl.Content      = ipReport.DetectedDownloadedSamples[0].Date;
            }

            if (ipReport.UndetectedCommunicatingSamples != null && ipReport.UndetectedDownloadedSamples.Count > 0)
            {
                IPReportUndetectedDownloadSamplesTotal_Lbl.Content     = ipReport.UndetectedDownloadedSamples[0].Total;
                IPReportUndetectedDownloadSamplesPosisives_Lbl.Content = ipReport.UndetectedDownloadedSamples[0].Positives;
                IPReportUndetectedDownloadSamplesDate_Lbl.Content      = ipReport.UndetectedDownloadedSamples[0].Date;
            }


            if (ipReport.UndetectedUrls != null && ipReport.UndetectedUrls.Count > 0)
            {
                IPReportURLUndetectedPositives_Lbl.Content    = ipReport.UndetectedUrls[0][2];
                IPReportURLUndetectedTotalEngines_Lbl.Content = ipReport.UndetectedUrls[0][3];
                IPReportURLUndetectedDate_Lbl.Content         = ipReport.UndetectedUrls[0][4];
            }

            if (detectedURLPositives < 5 && detectedDownloadPositives < 5)
            {
                IPScorePanel.Background = System.Windows.Media.Brushes.LightGreen;
                IPScore_Lbl.Content     = "(Safe)";
                IPScore_Icon.Source     = safeIcon;
            }
            else if (detectedURLPositives < 10 && detectedDownloadPositives < 10)
            {
                IPScorePanel.Background = System.Windows.Media.Brushes.Orange;
                IPScore_Lbl.Content     = "(Be careful)";
                IPScore_Icon.Source     = warningIcon;
            }
            else
            {
                IPScorePanel.Background = System.Windows.Media.Brushes.Red;
                IPScore_Lbl.Content     = "(Dangerous)";
                IPScore_Icon.Source     = dangerIcon;
            }

            IPDetails_Stack.Visibility = Visibility.Visible;
            IPScorePanel.Visibility    = Visibility.Visible;
            IPBigPicture.Visibility    = Visibility.Collapsed;
        }
示例#7
0
        public async Task GetIPReportKnownIPv4()
        {
            IPReport report = await VirusTotal.GetIPReportAsync(TestData.KnownIPv4s.First());

            Assert.Equal(IPReportResponseCode.Present, report.ResponseCode);
        }
        public async Task GetIPReportKnownIP()
        {
            IPReport report = await VirusTotal.GetIPReport("8.8.8.8"); //Google DNS

            Assert.Equal(IPReportResponseCode.Present, report.ResponseCode);
        }