commonfields:
  id: b695f044-fbdd-4d4b-89ce-9066cb0e165a
  version: 45
name: cveReputation
script: |
  var resCmd = executeCommand('cve-search', {'cveId': args.input});
  var data = resCmd[0].Contents;
  var cvss = (data.cvss) ? parseInt(data.cvss) : -1;

  if (cvss === -1) {
      return 0;
  } else if (cvss < 3) {
      return 1;
  } else if (cvss < 7) {
      return 2;
  } else {
      return 3;
  }
type: javascript
tags:
- cve
- reputation
comment: Provides  severity of CVE based on CVSS score where available
system: true
args:
- name: input
  required: true
  default: true
  description: CVE ID
scripttarget: 0
dependson:
  must:
  - cve-search
timeout: 0s

commonfields:
  id: b695f044-fbdd-4d4b-89ce-9066cb0e165a
  version: 45
name: cveReputation
script: |
  var resCmd = executeCommand('cve-search', {'cveId': args.input})[0];
  var maxTries = 5;
  var counter = 0;
  while (isError(resCmd) && counter < maxTries) {
      resCmd = executeCommand('cve-search', {'cveId': args.input})[0];
      counter++;
  }

  if (isError(resCmd)) {
      throw resCmd[0].Contents;
  }

  var data = resCmd.Contents;
  var cvss = (data.cvss) ? parseInt(data.cvss) : -1;

  if (cvss === -1) {
      return 0;
  } else if (cvss < 3) {
      return 1;
  } else if (cvss < 7) {
      return 2;
  } else {
      return 3;
  }
type: javascript
tags:
- cve
- reputation
comment: Provides  severity of CVE based on CVSS score where available
enabled: true
args:
- name: input
  required: true
  default: true
  description: CVE ID
scripttarget: 0
dependson:
  must:
  - cve-search
runonce: false

Update cveReputation script to address cveSearch command sometimes returning 404 error
Update cveReputation script to address cveSearch command sometimes returning 404 error
