File tree Expand file tree Collapse file tree 1 file changed +16
-8
lines changed
lib/rex/post/meterpreter/ui/console/command_dispatcher/stdapi Expand file tree Collapse file tree 1 file changed +16
-8
lines changed Original file line number Diff line number Diff line change @@ -329,13 +329,20 @@ def cmd_kill(*args)
329
329
return true
330
330
end
331
331
332
- # validate all the proposed pids first so we can bail if one is bogus
333
- valid_pids = validate_pids ( args )
334
- args . uniq!
335
- diff = args - valid_pids . map { |e | e . to_s }
336
- if not diff . empty? # then we had an invalid pid
337
- print_error ( "The following pids are not valid: #{ diff . join ( ", " ) . to_s } . Quitting" )
338
- return false
332
+ self_destruct = args . include? ( "-s" )
333
+
334
+ if self_destruct
335
+ valid_pids = [ client . sys . process . getpid . to_i ]
336
+ else
337
+ valid_pids = validate_pids ( args )
338
+
339
+ # validate all the proposed pids first so we can bail if one is bogus
340
+ args . uniq!
341
+ diff = args - valid_pids . map { |e | e . to_s }
342
+ if not diff . empty? # then we had an invalid pid
343
+ print_error ( "The following pids are not valid: #{ diff . join ( ", " ) . to_s } . Quitting" )
344
+ return false
345
+ end
339
346
end
340
347
341
348
# kill kill kill
@@ -348,8 +355,9 @@ def cmd_kill(*args)
348
355
# help for the kill command
349
356
#
350
357
def cmd_kill_help
351
- print_line ( "Usage: kill pid1 pid2 pid3 ..." )
358
+ print_line ( "Usage: kill [ pid1 [ pid2 [ pid3 ...]]] [-s] " )
352
359
print_line ( "Terminate one or more processes." )
360
+ print_line ( " -s : Kills the pid associated with the current session." )
353
361
end
354
362
355
363
#
You can’t perform that action at this time.
0 commit comments