Package com.denimgroup.threadfix.data.entities

Examples of com.denimgroup.threadfix.data.entities.Scan


        String fileName = scanTypeCalculationService.saveFile(myChannelId, file);

        ScanCheckResultBean returnValue = scanService.checkFile(myChannelId, fileName);

        if (ScanImportStatus.SUCCESSFUL_SCAN == returnValue.getScanCheckResult()) {
            Scan scan = scanMergeService.saveRemoteScanAndRun(myChannelId, fileName);

            if (scan != null) {
                Organization organization = organizationService.loadById(orgId);
                return success(organization);
            } else {
View Full Code Here


    for (Scan s: scans) {
      resultList.add(s);
        }

    for (int i = 0; i < scans.size() - 1; i++) {
      Scan scan1 = scans.get(i);
      Calendar date1 = scan1.getImportTime();
      Scan scan2 = scans.get(i+1);
      Calendar date2 = scan2.getImportTime();
     
      // Checking if they have consecutive imported dates
      if ((date2.getTimeInMillis()-date1.getTimeInMillis())/(24*60*60*1000)==1) {
        if (scan1.getFindings().size() == scan2.getFindings().size()) {
          boolean isDuplicatedScan = true;
          List<Finding> findingList1 = scan1.getFindings();
          List<Finding> findingList2 = scan2.getFindings();

          for (Finding f: findingList1) {
            if (!findingList2.contains(f)) {
              isDuplicatedScan = false;
              break;
View Full Code Here

   
    return scanList;
  }
 
  private Scan makeNewScan() {
    Scan scan = new Scan();
    scan.setFindings(saxFindingList);
    scan.setApplicationChannel(applicationChannel);
   
    if ((date != null) && (date.getTime() != null)) {
      LOG.debug("SAX Parser found the scan date: " + date.getTime().toString());
      scan.setImportTime(date);
    } else {
      LOG.warn("SAX Parser did not find the date.");
    }

    if (scan.getFindings() != null && scan.getFindings().size() != 0)
      LOG.debug("SAX Parsing successfully parsed " + scan.getFindings().size() +" Findings.");
    else
      LOG.warn("SAX Parsing did not find any Findings.");
   
    return scan;
  }
View Full Code Here

    }
   
    if (scanLists != null && scanLists.size() > 0) {

            if (parameters.getOrganizationId() != -1 || parameters.getApplicationId() != -1) {
                Scan scan = null;
                for (List<Scan> scanList : scanLists) {
                    if (scanList != null && scanList.size() > 0) {
                        scan = scanList.get(0);
                        break;
                    }
                }
                if (scan != null) {
                    if (parameters.getApplicationId() != -1) {
                        Application application = scan.getApplication();
                        appId = application.getId();
                        appName = application.getName();
                        teamId = application.getOrganization().getId();
                        teamName = application.getOrganization().getName();
                    } else {
                        Organization organization = scan.getApplication().getOrganization();
                        teamId = organization.getId();
                        teamName = organization.getName();
                    }
                }
            }
View Full Code Here

  private void addIntermediateScans(Map<Integer, Map<YearAndMonth, Scan>>  scansHash, YearAndMonth now) {
    for (Integer key : scansHash.keySet()) {
      Map<YearAndMonth, Scan> entry = scansHash.get(key);
      TreeSet<YearAndMonth> times = new TreeSet<>(entry.keySet());
      YearAndMonth currentTime = times.first();
      Scan currentScan = entry.get(currentTime);
      while (currentTime.compareTo(now) <= 0) {
       
        if (entry.containsKey(currentTime)) {
          currentScan = entry.get(currentTime);
        } else {
View Full Code Here

    for (YearAndMonth time : times) {
      scanIds.put(time, new ArrayList<Integer>());
      if (scansHash != null) {
        for (Integer key : scansHash.keySet()) {
          if (scansHash.get(key) != null && scansHash.get(key).get(time) != null) {
            Scan scan = scansHash.get(key).get(time);
         
            scanIds.get(time).add(scan.getId());
            if (!timeMap.containsKey(time)) {
              timeMap.put(time, scan.getImportTime());
            }
          }
        }
      }
    }
View Full Code Here

     
      List<Integer> result = results.get(yearAndMonth);
      if (result != null && !result.isEmpty()) {
        Map<String, Object> map = scanDao.getCountsForScans(result);
       
        Scan scan = new Scan();
        scan.setNumberCriticalVulnerabilities((Long) map.get("critical"));
        scan.setNumberHighVulnerabilities((Long) map.get("high"));
        scan.setNumberMediumVulnerabilities((Long) map.get("medium"));
        scan.setNumberLowVulnerabilities((Long) map.get("low"));
        scan.setNumberInfoVulnerabilities((Long) map.get("info"));
       
        dateList.add(yearAndMonth.getMonthName());
       
        scanList.add(scan);
      } else {
        Scan scan = new Scan();
        scan.setNumberCriticalVulnerabilities(0L);
        scan.setNumberHighVulnerabilities(0L);
        scan.setNumberMediumVulnerabilities(0L);
        scan.setNumberLowVulnerabilities(0L);
        scan.setNumberInfoVulnerabilities(0L);
        dateList.add(yearAndMonth.getMonthName());
       
        scanList.add(scan);
      }
     
View Full Code Here

        Map<String, Object> hash = new HashMap<>();

    long numCritical = 0, numHigh = 0, numMedium = 0, numLow = 0, numInfo = 0;
    for (List<Scan> scanList: normalizedScans) {
     
      Scan scan = scanList.get(index);
      numCritical += scan.getNumberCriticalVulnerabilities();
      numHigh     += scan.getNumberHighVulnerabilities();
      numMedium   += scan.getNumberMediumVulnerabilities();
      numLow      += scan.getNumberLowVulnerabilities();
      numInfo     += scan.getNumberInfoVulnerabilities();
    }
   
        hash.put("Critical", numCritical);
        hash.put("High", numHigh);
        hash.put("Medium", numMedium);
View Full Code Here

        newVulns.clear();
        oldVulns.clear();
        reopenedVulns.clear();

        int previousYear = -1, previousMonth = -1;
        Scan currentScan = null;

        for (Scan scan : this.scanList) {
            if (previousYear == -1) {
                // Start the process off with all new vulns from the first scan.
                previousYear = scan.getImportTime().get(Calendar.YEAR);
View Full Code Here

  }
 
  // in order to get the bars to show up we need to add empty scans
  private void insertEmptyScans(List<Scan> scanList) {

    Scan previousScan = null;
    List<Scan> scansToInsert = new ArrayList<>();

    for (Scan scan : scanList) {
      if (previousScan == null) {
        previousScan = scan;
        continue;
      }
      if (scan.getImportTime().after(previousScan.getImportTime())
          && (scan.getImportTime().get(Calendar.YEAR) != previousScan
              .getImportTime().get(Calendar.YEAR) || scan
              .getImportTime().get(Calendar.MONTH) != previousScan
              .getImportTime().get(Calendar.MONTH))) {
        scansToInsert.addAll(getScansBetween(previousScan, scan));
      }
      previousScan = scan;
    }
View Full Code Here

TOP

Related Classes of com.denimgroup.threadfix.data.entities.Scan

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.