These modules should check PID before using it
parent
0f37bbe78e
commit
a74f706bdb
|
@ -9,11 +9,13 @@ require 'msf/core'
|
|||
require 'rex'
|
||||
require 'msf/core/post/file'
|
||||
require 'msf/core/post/windows/priv'
|
||||
require 'msf/core/post/common'
|
||||
|
||||
class Metasploit3 < Msf::Post
|
||||
|
||||
include Msf::Post::Windows::Priv
|
||||
include Msf::Post::File
|
||||
include Msf::Post::Common
|
||||
|
||||
def initialize(info={})
|
||||
super( update_info( info,
|
||||
|
@ -61,10 +63,10 @@ class Metasploit3 < Msf::Post
|
|||
when "winlogon"
|
||||
process_migrate(datastore['CAPTURE_TYPE'],datastore['LOCKSCREEN'])
|
||||
when "pid"
|
||||
if datastore['PID']
|
||||
if datastore['PID'] and has_pid?(datastore['PID'])
|
||||
pid_migrate(datastore['PID'])
|
||||
else
|
||||
print_error("If capture type is pid you must provide one")
|
||||
print_error("If capture type is pid you must provide a valid one")
|
||||
return
|
||||
end
|
||||
end
|
||||
|
@ -124,8 +126,8 @@ class Metasploit3 < Msf::Post
|
|||
# Method for migrating in to a PID
|
||||
def pid_migrate(pid)
|
||||
print_status("\tMigrating into #{pid}...")
|
||||
session.core.migrate(pid)
|
||||
print_status("Migration successful!")
|
||||
session.core.migrate(pid)
|
||||
print_status("Migration successful!")
|
||||
end
|
||||
|
||||
# Method for starting the keylogger
|
||||
|
|
|
@ -7,9 +7,12 @@
|
|||
|
||||
require 'msf/core'
|
||||
require 'rex'
|
||||
require 'msf/core/post/common'
|
||||
|
||||
class Metasploit3 < Msf::Post
|
||||
|
||||
include Msf::Post::Common
|
||||
|
||||
def initialize(info={})
|
||||
super( update_info( info,
|
||||
'Name' => 'Windows Manage Process Migration',
|
||||
|
@ -34,6 +37,7 @@ class Metasploit3 < Msf::Post
|
|||
# Run Method for when run command is issued
|
||||
def run
|
||||
print_status("Running module against #{sysinfo['Computer']}")
|
||||
|
||||
server = session.sys.process.open
|
||||
original_pid = server.pid
|
||||
print_status("Current server process: #{server.name} (#{server.pid})")
|
||||
|
@ -49,7 +53,7 @@ class Metasploit3 < Msf::Post
|
|||
target_pid = session.sys.process[datastore['NAME']]
|
||||
end
|
||||
|
||||
if not target_pid
|
||||
if not target_pid or not has_pid?(target_pid)
|
||||
print_error("Process or PID not found")
|
||||
return
|
||||
end
|
||||
|
|
|
@ -7,9 +7,12 @@
|
|||
|
||||
require 'msf/core'
|
||||
require 'rex'
|
||||
require 'msf/core/post/common'
|
||||
|
||||
class Metasploit3 < Msf::Post
|
||||
|
||||
include Msf::Post::Common
|
||||
|
||||
def initialize(info={})
|
||||
super( update_info( info,
|
||||
'Name' => 'Windows Manage Memory Payload Injection Module',
|
||||
|
@ -62,7 +65,7 @@ class Metasploit3 < Msf::Post
|
|||
opts = datastore['OPTIONS']
|
||||
# Create payload
|
||||
payload = create_payload(pay_name,lhost,lport,opts)
|
||||
if pid == 0
|
||||
if pid == 0 or not has_pid?(pid)
|
||||
pid = create_temp_proc(payload)
|
||||
end
|
||||
if payload.arch.join =~ /64/ and client.platform =~ /x86/
|
||||
|
|
|
@ -7,9 +7,12 @@
|
|||
|
||||
require 'msf/core'
|
||||
require 'rex'
|
||||
require 'msf/core/post/common'
|
||||
|
||||
class Metasploit3 < Msf::Post
|
||||
|
||||
include Msf::Post::Common
|
||||
|
||||
def initialize(info={})
|
||||
super( update_info( info,
|
||||
'Name' => 'Windows Manage Reflective DLL Injection Module',
|
||||
|
@ -73,7 +76,7 @@ class Metasploit3 < Msf::Post
|
|||
return
|
||||
end
|
||||
|
||||
if pid.nil? or pid == 0
|
||||
if pid.nil? or not has_pid?(pid)
|
||||
print_error("Invalid PID.")
|
||||
return
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue