sqlChr

This tag converts the input to a character code and wraps it into a CHR() SQL function

Created by: hackvertor
Installed 1 times

Category: SQLi

Created on: Wednesday, October 23, 2024 at 11:49:12 AM

Updated on: Thursday, December 19, 2024 at 9:22:04 PM

This is a built in tag
Tag arguments
[]
Code
class sqlChr {
  encode(input) {
    return input
      .split("")
      .map((chr) => `CHR(${chr.codePointAt()})`)
      .join(",");
  }
  decode(input) {
    return input
      .split(",")
      .map((chr) =>
        chr.replace(/CHR\((\d+)\)/i, ($0, m) => String.fromCodePoint(m)),
      )
      .join("");
  }
  matches(input) {
    return /^(?:(?:CHR\(\d+\),?)+)/i.exec(input);
  }
}