sqlChar

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

Created by: hackvertor
Installed 1 times

Category: SQLi

Created on: Wednesday, October 23, 2024 at 11:38:28 AM

Updated on: Wednesday, November 6, 2024 at 2:17:28 PM

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