Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Javascript support #12

Merged
merged 4 commits into from
Nov 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion lib/rex/random_identifier/generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,30 @@ class ExhaustedSpaceError < StandardError; end
).uniq.freeze
)

JavaScriptOpts = DefaultOpts.merge(
forbidden: (
# https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Lexical_grammar#reserved_words
# https://developer.mozilla.org/en-US/docs/Web/API/Window Instance methods
%w[
const continue debugger default delete do else export extends false finally for function if import in
instanceof new null return super switch this throw true try typeof var void while with let static yield
await arguments as async eval from get of set enum implements interface package private protected public
abstract boolean byte char double final float goto int long native short synchronized throws transient volatile
atob alert blur btoa cancelAnimationFrame cancelIdleCallback clearInterval clearTimeout close confirm
createImageBitmap dump fetch find focus getComputedStyle getDefaultComputedStyle getScreenDetails getSelection
matchMedia moveBy moveTo open postMessage print prompt queryLocalFonts queueMicrotask reportError
requestAnimationFrame requestIdleCallback resizeBy resizeTo scroll scrollBy scrollByLines scrollByPages
scrollTo setInterval setTimeout showDirectoryPicker showOpenFilePicker showSaveFilePicker sizeToContent
stop structuredClone updateCommands
]
).uniq.freeze
)

Opts = {
default: DefaultOpts,
java: JavaOpts,
jsp: JSPOpts
jsp: JSPOpts,
javascript: JavaScriptOpts
}

# @param opts [Hash] Options, see {DefaultOpts} for default values
Expand Down