Skip to content

Instantly share code, notes, and snippets.

@teebow1e
Created December 31, 2024 08:47
Show Gist options
  • Save teebow1e/5a5ccd2dcf5fe0ffbcdb14c140f3dab3 to your computer and use it in GitHub Desktop.
Save teebow1e/5a5ccd2dcf5fe0ffbcdb14c140f3dab3 to your computer and use it in GitHub Desktop.
string -> string.fromcharcode js - xss
def string_to_fromcharcode(input_string):
# Convert each character in the string to its char code
char_codes = [str(ord(char)) for char in input_string]
# Create the JavaScript String.fromCharCode representation
fromcharcode_str = "String.fromCharCode(" + ",".join(char_codes) + ")"
return fromcharcode_str
# Example usage
input_string = input()
result = string_to_fromcharcode(input_string)
print(result)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment