public List <ScanObject> getScanbyId(resultClass token, string projectId) { List <ScanObject> sclass = new List <ScanObject>(); string path = String.Empty; try { get httpGet = new get(); secure token_secure = new secure(token); token_secure.findToken(token); path = token_secure.get_rest_Uri(String.Format(CxConstant.CxProjectScan, projectId)); if (token.debug && token.verbosity > 1) { Console.WriteLine("API: {0}", path); } httpGet.get_Http(token, path, 10); if (token.status == 0) { sclass = JsonConvert.DeserializeObject <List <ScanObject> >(token.op_result); } else { throw new MissingFieldException("Failure to get scan results. Please check token validity and try again"); } } catch (Exception ex) { if (token.debug && token.verbosity > 0) { Console.Error.WriteLine("getScan: {0}, Message: {1} Trace: {2}", path, ex.Message, ex.StackTrace); } } return(sclass); }
public ReportResult SetResultRequest(long scan_id, string report_type, resultClass token) { try { ReportRequest request = new ReportRequest() { reportType = report_type, scanId = scan_id }; post Post = new post(); secure token_secure = new secure(token); token_secure.findToken(token); string path = token_secure.post_rest_Uri(CxConstant.CxReportRegister); Post.post_Http(token, path, request); if (token.status == 0) { ReportResult report = JsonConvert.DeserializeObject <ReportResult>(token.op_result); return(report); } } catch (Exception ex) { token.status = -1; token.statusMessage = ex.Message; } return(null); }
public ScanStatistics getScansStatistics(long scanId, resultClass token) { ScanStatistics scanStatistics = new ScanStatistics(); string path = String.Empty; try { get httpGet = new get(); secure token_secure = new secure(token); token_secure.findToken(token); path = token_secure.get_rest_Uri(String.Format(CxConstant.CxScanStatistics, scanId)); if (token.debug && token.verbosity > 1) { Console.WriteLine("API: {0}", path); } httpGet.get_Http(token, path); if (token.status == 0) { scanStatistics = JsonConvert.DeserializeObject <ScanStatistics>(token.op_result); } } catch (Exception ex) { if (token.debug && token.verbosity > 0) { Console.Error.WriteLine("getScansStatistics: {0}, Message: {1} Trace: {2}", path, ex.Message, ex.StackTrace); } } return(scanStatistics); }
public bool GetResultStatus(long report_id, resultClass token) { string path = String.Empty; try { get httpGet = new get(); secure token_secure = new secure(token); token_secure.findToken(token); path = token_secure.get_rest_Uri(String.Format(CxConstant.CxReportStatus, report_id)); if (token.debug && token.verbosity > 1) { Console.WriteLine("API: {0}", path); } httpGet.get_Http(token, path); if (token.status == 0) { ReportReady ready = JsonConvert.DeserializeObject <ReportReady>(token.op_result); if (ready.Status.Id == 2) { return(true); } } } catch (Exception ex) { token.status = -1; token.statusMessage = ex.Message; if (token.debug && token.verbosity > 0) { Console.Error.WriteLine("GetResultStatus: {0}, Message: {1} Trace: {2}", path, ex.Message, ex.StackTrace); } } return(false); }
public bool GetResultStatus(long report_id, resultClass token) { try { get httpGet = new get(); secure token_secure = new secure(token); token_secure.findToken(token); string path = token_secure.get_rest_Uri(String.Format(CxConstant.CxReportStatus, report_id)); httpGet.get_Http(token, path); if (token.status == 0) { ReportReady ready = JsonConvert.DeserializeObject <ReportReady>(token.op_result); if (ready.Status.Id == 2) { return(true); } } } catch (Exception ex) { token.status = -1; token.statusMessage = ex.Message; } return(false); }
public byte[] GetGenaricResult(long report_id, resultClass token) { string path = String.Empty; try { get httpGet = new get(); secure token_secure = new secure(token); token_secure.findToken(token); path = token_secure.get_rest_Uri(String.Format(CxConstant.CxReportFetch, report_id)); if (token.debug && token.verbosity > 1) { Console.WriteLine("API: {0}", path); } httpGet.get_Http(token, path); if (token.status == 0) { return(token.byte_result); } } catch (Exception ex) { token.status = -1; token.statusMessage = ex.Message; if (token.debug && token.verbosity > 0) { Console.Error.WriteLine("GetGenaricResult: {0}, Message: {1} Trace: {2}", path, ex.Message, ex.StackTrace); } } return(null); }
public ScanStatistics getScansStatistics(long scanId, resultClass token) { get httpGet = new get(); ScanStatistics scanStatistics = new ScanStatistics(); secure token_secure = new secure(token); token_secure.findToken(token); string path = token_secure.get_rest_Uri(String.Format(CxConstant.CxScanStatistics, scanId)); httpGet.get_Http(token, path); if (token.status == 0) { scanStatistics = JsonConvert.DeserializeObject <ScanStatistics>(token.op_result); } return(scanStatistics); }
public List <ScanObject> getScan(resultClass token) { get httpGet = new get(); List <ScanObject> sclass = new List <ScanObject>(); secure token_secure = new secure(token); token_secure.findToken(token); string path = token_secure.get_rest_Uri(CxConstant.CxScans); httpGet.get_Http(token, path); if (token.status == 0) { sclass = JsonConvert.DeserializeObject <List <ScanObject> >(token.op_result); } return(sclass); }
public List <ScanObject> getScan(resultClass token) { get httpGet = new get(); List <ScanObject> sclass = new List <ScanObject>(); secure token_secure = new secure(token); token_secure.findToken(token); string path = token_secure.get_rest_Uri(CxConstant.CxScans); httpGet.get_Http(token, path); if (token.status == 0) { sclass = JsonConvert.DeserializeObject <List <ScanObject> >(token.op_result); } else { throw new MissingFieldException("Failure to get scan results. Please check token validity and try again"); } return(sclass); }
public List <Presets> get_presets(resultClass token) { get httpGet = new get(); List <Presets> pclass = new List <Presets>(); secure token_secure = new secure(token); token_secure.findToken(token); string path = token_secure.get_rest_Uri(CxConstant.CxPresets); if (token.debug && token.verbosity > 1) { Console.WriteLine("API: {0}", path); } httpGet.get_Http(token, path); if (token.status == 0) { pclass = JsonConvert.DeserializeObject <List <Presets> >(token.op_result); } return(pclass); }
public ReportResult SetResultRequest(long scan_id, string report_type, resultClass token) { string path = String.Empty; try { ReportRequest request = new ReportRequest() { reportType = report_type, scanId = scan_id }; post Post = new post(); secure token_secure = new secure(token); token_secure.findToken(token); path = token_secure.post_rest_Uri(CxConstant.CxReportRegister); if (token.debug && token.verbosity > 1) { Console.WriteLine("API: {0}", path); } Post.post_Http(token, path, request); if (token.status == 0) { ReportResult report = JsonConvert.DeserializeObject <ReportResult>(token.op_result); return(report); } } catch (Exception ex) { token.status = -1; token.statusMessage = ex.Message; if (token.debug && token.verbosity > 0) { Console.Error.WriteLine("SetResultRequest: {0}, Message: {1} Trace: {2}", path, ex.Message, ex.StackTrace); } } return(null); }
public XElement GetResult(long report_id, resultClass token) { try { get httpGet = new get(); secure token_secure = new secure(token); token_secure.findToken(token); string path = token_secure.get_rest_Uri(String.Format(CxConstant.CxReportFetch, report_id)); httpGet.get_Http(token, path); if (token.status == 0) { string result = token.op_result; XElement xl = XElement.Parse(result); return(xl); } } catch (Exception ex) { token.status = -1; token.statusMessage = ex.Message; } return(null); }