示例#1
0
        public resultClass makeProjectScanCsv_1()
        {
            _token.status = -1;
            csvHelper cvsHelper = new csvHelper();


            if ((_token.start_time == null))
            {
                Console.Error.WriteLine("Start time must be provided.");
                return(_token);
            }
            if (LogAdminIn())
            {
                CxSDKWebService.CxSDKWebServiceSoapClient cxSDKProxy = new CxSDKWebService.CxSDKWebServiceSoapClient(CxSDKWebService.CxSDKWebServiceSoapClient.EndpointConfiguration.CxSDKWebServiceSoap12);
                Dictionary <long, string> presets = GetPresetConfiguration(cxSDKProxy);
                Dictionary <long, CxSDKWebService.ProjectDisplayData> projects = GetAllProjects(cxSDKProxy);
                List <csvScanOutput_1> csvOutput = new List <csvScanOutput_1>();
                List <CxSDKWebService.ProjectScannedDisplayData> scannedDisplayDatasList = GetProjectScannedList(cxSDKProxy);
                foreach (CxSDKWebService.ProjectScannedDisplayData scans in scannedDisplayDatasList)
                {
                    CxSDKWebService.ProjectDisplayData proj     = projects[scans.ProjectID];
                    CxSDKWebService.CxDateTime         scanDate = proj.LastScanDate;

                    DateTime lastScanDate = DateTime.Parse(String.Format("{0}/{1}/{2} {3}:{4}:{5}", scanDate.Month, scanDate.Day, scanDate.Year, scanDate.Hour, scanDate.Minute, scanDate.Second));
                    if (lastScanDate > _token.start_time)
                    {
                        if ((_token.end_time == null) || (lastScanDate < _token.end_time))
                        {
                            if ((_token.project_name == null) || (scans.ProjectName.Contains(_token.project_name)))
                            {
                                csvScanOutput_1 csv = new csvScanOutput_1()
                                {
                                    Project_Name         = scans.ProjectName,
                                    Owner                = proj.Owner,
                                    Team                 = scans.TeamName,
                                    Preset               = proj.Preset,
                                    Last_Scan            = lastScanDate,
                                    Total_Vulerabilities = scans.TotalVulnerabilities,
                                    High                 = scans.HighVulnerabilities,
                                    Medium               = scans.MediumVulnerabilities,
                                    Low  = scans.LowVulnerabilities,
                                    Info = scans.InfoVulnerabilities
                                };
                                csvOutput.Add(csv);
                                if ((_token.pipe) || (_token.debug))
                                {
                                    Console.WriteLine("{0},{1},{2},{3},{4},{5},{6},{7},{8}", csv.Project_Name, csv.Owner, csv.Team, csv.Preset, csv.Last_Scan, csv.Total_Vulerabilities, csv.High, csv.Medium, csv.Low, csv.Info);
                                }
                            }
                        }
                    }
                }
                if (!_token.pipe)
                {
                    _token.status = cvsHelper.writeCVSFile(csvOutput, _token);
                }
            }
            return(_token);
        }
示例#2
0
        public resultClass makeScanCsv(resultClass token)
        {
            token.status = -1;

            if ((token.start_time == null) || (token.end_time == null))
            {
                Console.Error.WriteLine("Start time and End time must be provided.");
                return(token);
            }
            if (LogAdminIn())
            {
                CxSDKWebService.CxSDKWebServiceSoapClient cxSDKProxy = new CxSDKWebService.CxSDKWebServiceSoapClient(CxSDKWebService.CxSDKWebServiceSoapClient.EndpointConfiguration.CxSDKWebServiceSoap12);
                Dictionary <long, string> presets = GetPresetConfiguration(cxSDKProxy);
                Dictionary <long, CxSDKWebService.ProjectDisplayData> projects = GetAllProjects(cxSDKProxy);

                foreach (KeyValuePair <long, CxSDKWebService.ProjectDisplayData> project in projects)
                {
                    CxSDKWebService.GetProjectConfigurationResponse response = GetProjectConfiguration(cxSDKProxy, token, project.Value.projectID);
                    csvScanOutput_1 csv = new csvScanOutput_1();
                }
                token.status = 0;
            }
            return(token);
        }