Skip to content

Commit d485460

Browse files
committed
Cosmetic fixes
[FixRM rapid7#7223][See rapid7#1283]
1 parent afb1298 commit d485460

File tree

1 file changed

+15
-15
lines changed
  • lib/rex/post/meterpreter/ui/console/command_dispatcher/stdapi

1 file changed

+15
-15
lines changed

lib/rex/post/meterpreter/ui/console/command_dispatcher/stdapi/sys.rb

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -735,22 +735,23 @@ def cmd_shutdown(*args)
735735

736736
#
737737
# Suspends or resumes a list of one or more pids
738-
# args can optionally be -c to continue on error or -r to resume instead of suspend,
739-
# followed by a list of one or more valid pids
740-
# @todo A suspend which will accept process names, much of that code is done (kernelsmith)
741738
#
742-
# @param args [Array] List of one of more pids
739+
# +args+ can optionally be -c to continue on error or -r to resume
740+
# instead of suspend, followed by a list of one or more valid pids
741+
#
742+
# @todo Accept process names, much of that code is done (kernelsmith)
743+
#
744+
# @param args [Array<String>] List of one of more pids
743745
# @return [Boolean] Returns true if command was successful, else false
744-
745746
def cmd_suspend(*args)
746747
# give'em help if they want it, or seem confused
747-
if ( args.length == 0 or (args.length == 1 and args[0].strip == "-h") )
748+
if args.length == 0 or (args.include? "-h")
748749
cmd_suspend_help
749750
return true
750751
end
751752

752753
continue = args.delete("-c") || false
753-
resume = args.delete ("-r") || false
754+
resume = args.delete("-r") || false
754755

755756
# validate all the proposed pids first so we can bail if one is bogus
756757
valid_pids = validate_pids(args)
@@ -766,7 +767,6 @@ def cmd_suspend(*args)
766767
end
767768
end
768769

769-
#client.sys.process.kill(*(args.map { |x| x.to_i }))
770770
targetprocess = nil
771771
if resume
772772
print_status("Resuming: #{valid_pids.join(", ").to_s}")
@@ -779,16 +779,16 @@ def cmd_suspend(*args)
779779
targetprocess = client.sys.process.open(pid, PROCESS_ALL_ACCESS)
780780
targetprocess.thread.each_thread do |x|
781781
if resume
782-
targetprocess.thread.open(x).resume
783-
else
784-
targetprocess.thread.open(x).suspend
785-
end
782+
targetprocess.thread.open(x).resume
783+
else
784+
targetprocess.thread.open(x).suspend
785+
end
786786
end
787787
end
788788
rescue ::Rex::Post::Meterpreter::RequestError => e
789-
print_error "Error acting on the process: #{e.to_s}. " +
790-
"Try migrating to a process with the same owner as the target process"
791-
"Also consider running the win_privs post module and confirm SeDebug priv."
789+
print_error "Error acting on the process: #{e.to_s}."
790+
print_error "Try migrating to a process with the same owner as the target process."
791+
print_error "Also consider running the win_privs post module and confirm SeDebug priv."
792792
return false unless continue
793793
ensure
794794
targetprocess.close if targetprocess

0 commit comments

Comments
 (0)