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: Sunday, November 3, 2024 at 12:06:59 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);
  }
}