{"size": 1150, "ext": "js", "max_stars_repo_path": "FlagCollection/src/solution.js", "max_stars_repo_name": "lethanhtrung222/2018-CFI-CTF", "max_stars_repo_stars_event_min_datetime": "2018-10-03T02:37:43.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-06T22:20:48.000Z", "max_issues_repo_path": "FlagCollection/src/solution.js", "max_issues_repo_name": "lethanhtrung222/2018-CFI-CTF", "max_issues_repo_issues_event_min_datetime": "2018-10-03T16:09:58.000Z", "max_issues_repo_issues_event_max_datetime": "2019-02-26T01:22:32.000Z", "max_forks_repo_path": "FlagCollection/src/solution.js", "max_forks_repo_name": "lethanhtrung222/2018-CFI-CTF", "max_forks_repo_forks_event_min_datetime": "2019-06-19T17:09:23.000Z", "max_forks_repo_forks_event_max_datetime": "2021-04-23T22:31:34.000Z"}
{"max_stars_count": 21, "max_issues_count": 3, "max_forks_count": 11, "avg_line_length": 30.2631578947, "max_line_length": 204, "alphanum_fraction": 0.6356521739}
function validateFlag2 (flag) {
  const isOdd = (number) => (number & 1)
  let encryptedFlag = []
  let change = 2
  for (var i = 0; i < flag.length; i++) {
    if (isOdd(i)) {
      change += 13
    } else {
      change -= (flag.length % 9)
    }
    let value = flag.charCodeAt(i) + change
    encryptedFlag.push(value)
  }  
  return encryptedFlag.join(',') === '64,80,78,141,124,124,123,151,144,141,134,166,146,158,148,172,158,192,166,197,176,204,190,210,209,201,206,229,204,232,228,246,220,253,234,245,258,268,250,262,282'
}

// console.log(validateFlag2("CFI{obfuscated_javascript_is_not_secured}"));

var codes = '64,80,78,141,124,124,123,151,144,141,134,166,146,158,148,172,158,192,166,197,176,204,190,210,209,201,206,229,204,232,228,246,220,253,234,245,258,268,250,262,282'.split(',').map(function (i) {
  return parseInt(i)
})

var flag = ''
var something = 2
for (var i = 0; i < codes.length; i++) {
  // Is odd?
  if (1 & i) {
    something += 13
  } else {
    // Flag length is the codes length.
    something -= codes.length % 9
  }
  var character = String.fromCharCode(codes[i] - something)
  flag += character
}

console.log(flag)
