Skip to content

Commit

Permalink
Merge pull request #12 from jheysel-r7/javascript_generator
Browse files Browse the repository at this point in the history
Add Javascript support
  • Loading branch information
smcintyre-r7 authored Nov 13, 2024
2 parents 38cf623 + fdeaa19 commit fedd28d
Showing 1 changed file with 21 additions and 1 deletion.
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

0 comments on commit fedd28d

Please sign in to comment.