Skip to content

Commit

Permalink
Clean up some code, get CMD working.
Browse files Browse the repository at this point in the history
  • Loading branch information
jvennix-r7 committed Aug 24, 2013
1 parent 140d8ae commit 3cdc6ab
Showing 1 changed file with 8 additions and 19 deletions.
27 changes: 8 additions & 19 deletions modules/exploits/osx/local/sudo_password_bypass.rb
Original file line number Diff line number Diff line change
Expand Up @@ -153,20 +153,12 @@ def exploit
end

def cleanup
print_status("cleanup callback")
if not @_cleaning_up
@_cleaning_up = true
do_cleanup
end
do_cleanup_once
super
end

def on_new_session(session)
print_status("on_new_session callback")
if not @_cleaning_up
@_cleaning_up = true
do_cleanup
end
do_cleanup_once
super
end

Expand Down Expand Up @@ -201,26 +193,23 @@ def run_sudo_cmd
print_good output
end

def do_cleanup
print_status("Resetting system clock to original values") if @time
def do_cleanup_once
return if @_cleaned_up
@_cleaned_up = true

print_status("Executing: #{SYSTEMSETUP_PATH} -settimezone #{[@zone].shelljoin}")
print_status("Resetting system clock to original values") if @time
cmd_exec("#{SYSTEMSETUP_PATH} -settimezone #{[@zone].shelljoin}") unless @zone.nil?

print_status("Executing: #{SYSTEMSETUP_PATH} -setdate #{[@date].shelljoin}")
cmd_exec("#{SYSTEMSETUP_PATH} -setdate #{[@date].shelljoin}") unless @date.nil?

print_status("Executing: #{SYSTEMSETUP_PATH} -settime #{[@time].shelljoin}")
cmd_exec("#{SYSTEMSETUP_PATH} -settime #{[@time].shelljoin}") unless @time.nil?

if @networked
print_status("Executing: #{SYSTEMSETUP_PATH} -setusingnetworktime On")
cmd_exec("#{SYSTEMSETUP_PATH} -setusingnetworktime On")
unless @network_server.nil?
print_status("Executing: #{SYSTEMSETUP_PATH} -setnetworktimeserver #{[@network_server].shelljoin}")
cmd_exec("#{SYSTEMSETUP_PATH} -setnetworktimeserver #{[@network_server].shelljoin}")
end
end

print_success("Completed clock reset.") if @time
end

# helper methods for accessing datastore
Expand Down

0 comments on commit 3cdc6ab

Please sign in to comment.