@@ -735,22 +735,23 @@ def cmd_shutdown(*args)
735
735
736
736
#
737
737
# 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)
741
738
#
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
743
745
# @return [Boolean] Returns true if command was successful, else false
744
-
745
746
def cmd_suspend ( *args )
746
747
# 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" )
748
749
cmd_suspend_help
749
750
return true
750
751
end
751
752
752
753
continue = args . delete ( "-c" ) || false
753
- resume = args . delete ( "-r" ) || false
754
+ resume = args . delete ( "-r" ) || false
754
755
755
756
# validate all the proposed pids first so we can bail if one is bogus
756
757
valid_pids = validate_pids ( args )
@@ -766,7 +767,6 @@ def cmd_suspend(*args)
766
767
end
767
768
end
768
769
769
- #client.sys.process.kill(*(args.map { |x| x.to_i }))
770
770
targetprocess = nil
771
771
if resume
772
772
print_status ( "Resuming: #{ valid_pids . join ( ", " ) . to_s } " )
@@ -779,16 +779,16 @@ def cmd_suspend(*args)
779
779
targetprocess = client . sys . process . open ( pid , PROCESS_ALL_ACCESS )
780
780
targetprocess . thread . each_thread do |x |
781
781
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
786
786
end
787
787
end
788
788
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."
792
792
return false unless continue
793
793
ensure
794
794
targetprocess . close if targetprocess
0 commit comments