This repository was archived by the owner on Oct 22, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +30
-1
lines changed
Expand file tree Collapse file tree 1 file changed +30
-1
lines changed Original file line number Diff line number Diff line change @@ -32,10 +32,39 @@ def url_with_xss
3232 normalize_uri ( xss_url , initial_req_path )
3333 end
3434
35+ # @return [String] the initial script that should be served to automate a form submission to the vulnerable page.
36+ def initial_script
37+ nil
38+ end
39+
40+ # Create a basic POST script with the specified fields. All values in the script will be wrapped in double quotes.
41+ # @param url [String] the vulnerable URL.
42+ # @param fields [Hash] the fields and values to inject into the script.
43+ def create_basic_post_script ( url , fields )
44+ json = ''
45+ fields . each_with_index do |( k , v ) , i |
46+ if i < fields . size - 1
47+ json += "\" #{ k } \" : \" #{ v } \" ,\n "
48+ next
49+ end
50+
51+ json += "\" #{ k } \" : \" #{ v } \" \n "
52+ end
53+
54+ %|
55+ <html><head></head><body><script>
56+ #{ js_post }
57+ post('#{ url } ', {
58+ #{ json }
59+ });
60+ </script></body></html>
61+ |
62+ end
63+
3564 # Run the module.
3665 # @return [Boolean] true if successful.
3766 def run
38- unless respond_to? ' initial_script'
67+ if initial_script . nil?
3968 raise 'Required method "initial_script" has not been implemented'
4069 end
4170
You can’t perform that action at this time.
0 commit comments