mirror of
https://github.com/rapid7/metasploit-framework
synced 2024-11-12 11:52:01 +01:00
missed file. =(
git-svn-id: file:///home/svn/framework3/trunk@11422 4d416f70-5f16-0410-b530-b9f4589650da
This commit is contained in:
parent
f0cc6ff596
commit
1351af8300
90
lib/msf/core/post.rb
Normal file
90
lib/msf/core/post.rb
Normal file
@ -0,0 +1,90 @@
|
||||
require 'msf/core'
|
||||
require 'msf/core/module'
|
||||
|
||||
module Msf
|
||||
class Post < Msf::Module
|
||||
|
||||
include Msf::Auxiliary::Report
|
||||
|
||||
def self.type
|
||||
MODULE_POST
|
||||
end
|
||||
def type
|
||||
MODULE_POST
|
||||
end
|
||||
|
||||
def initialize(info={})
|
||||
super
|
||||
|
||||
register_options( [
|
||||
OptInt.new('SESSION', [ true, "The session to run this module on." ])
|
||||
] , Msf::Post)
|
||||
end
|
||||
|
||||
def setup
|
||||
@sysinfo = nil
|
||||
@session = framework.sessions[datastore["SESSION"].to_i]
|
||||
@session ||= framework.sessions[datastore["SESSION"].to_s]
|
||||
if not @session
|
||||
raise Msf::OptionValidateError.new(["SESSION"])
|
||||
end
|
||||
@session.init_ui(self.user_input, self.user_output)
|
||||
end
|
||||
|
||||
#
|
||||
# Default cleanup handler does nothing
|
||||
#
|
||||
def cleanup
|
||||
end
|
||||
|
||||
def session
|
||||
@session
|
||||
end
|
||||
|
||||
def client
|
||||
@session
|
||||
end
|
||||
|
||||
def platform
|
||||
session.platform
|
||||
end
|
||||
|
||||
#
|
||||
# Cached sysinfo, returns nil for non-meterpreter sessions
|
||||
#
|
||||
def sysinfo
|
||||
begin
|
||||
@sysinfo ||= session.sys.config.sysinfo
|
||||
rescue NoMethodError
|
||||
@sysinfo = nil
|
||||
end
|
||||
@sysinfo
|
||||
end
|
||||
|
||||
#
|
||||
# Can be overridden by individual modules to add new commands
|
||||
#
|
||||
def post_commands
|
||||
{}
|
||||
end
|
||||
|
||||
#
|
||||
# Default stance is passive
|
||||
#
|
||||
def passive
|
||||
false
|
||||
end
|
||||
|
||||
def compatible_sessions
|
||||
sessions = []
|
||||
framework.sessions.each do |sid, s|
|
||||
next unless self.module_info["SessionTypes"].include?(s.type)
|
||||
sessions << sid
|
||||
end
|
||||
sessions
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user