1812 lines
90 KiB
HTML
1812 lines
90 KiB
HTML
<!DOCTYPE html>
|
||
<html>
|
||
<head>
|
||
<meta charset="utf-8">
|
||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||
<title>
|
||
Module: Msf::SessionCompatibility
|
||
|
||
— Documentation by YARD 0.9.37
|
||
|
||
</title>
|
||
|
||
<link rel="stylesheet" href="../css/style.css" type="text/css" />
|
||
|
||
<link rel="stylesheet" href="../css/common.css" type="text/css" />
|
||
|
||
<script type="text/javascript">
|
||
pathId = "Msf::SessionCompatibility";
|
||
relpath = '../';
|
||
</script>
|
||
|
||
|
||
<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
|
||
|
||
<script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
|
||
|
||
|
||
</head>
|
||
<body>
|
||
<div class="nav_wrap">
|
||
<iframe id="nav" src="../class_list.html?1"></iframe>
|
||
<div id="resizer"></div>
|
||
</div>
|
||
|
||
<div id="main" tabindex="-1">
|
||
<div id="header">
|
||
<div id="menu">
|
||
|
||
<a href="../_index.html">Index (S)</a> »
|
||
<span class='title'><span class='object_link'><a href="../Msf.html" title="Msf (module)">Msf</a></span></span>
|
||
»
|
||
<span class="title">SessionCompatibility</span>
|
||
|
||
</div>
|
||
|
||
<div id="search">
|
||
|
||
<a class="full_list_link" id="class_list_link"
|
||
href="../class_list.html">
|
||
|
||
<svg width="24" height="24">
|
||
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
|
||
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
|
||
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
|
||
</svg>
|
||
</a>
|
||
|
||
</div>
|
||
<div class="clear"></div>
|
||
</div>
|
||
|
||
<div id="content"><h1>Module: Msf::SessionCompatibility
|
||
|
||
|
||
|
||
</h1>
|
||
<div class="box_info">
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<dl>
|
||
<dt>Includes:</dt>
|
||
<dd><span class='object_link'><a href="Auxiliary/Report.html" title="Msf::Auxiliary::Report (module)">Auxiliary::Report</a></span>, <span class='object_link'><a href="Module/HasActions.html" title="Msf::Module::HasActions (module)">Module::HasActions</a></span>, <span class='object_link'><a href="Post/Common.html" title="Msf::Post::Common (module)">Post::Common</a></span></dd>
|
||
</dl>
|
||
|
||
|
||
|
||
|
||
<dl>
|
||
<dt>Included in:</dt>
|
||
<dd><span class='object_link'><a href="OptionalSession.html" title="Msf::OptionalSession (module)">OptionalSession</a></span>, <span class='object_link'><a href="PostMixin.html" title="Msf::PostMixin (module)">PostMixin</a></span></dd>
|
||
</dl>
|
||
|
||
|
||
|
||
<dl>
|
||
<dt>Defined in:</dt>
|
||
<dd>lib/msf/core/session_compatibility.rb</dd>
|
||
</dl>
|
||
|
||
</div>
|
||
|
||
|
||
|
||
|
||
|
||
<h2>Instance Attribute Summary <small><a href="#" class="summary_toggle">collapse</a></small></h2>
|
||
<ul class="summary">
|
||
|
||
<li class="public ">
|
||
<span class="summary_signature">
|
||
|
||
<a href="#passive-instance_method" title="#passive (instance method)">#<strong>passive</strong> ⇒ Boolean </a>
|
||
|
||
|
||
|
||
</span>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<span class="summary_desc"><div class='inline'>
|
||
<p>True when this module is passive, false when active.</p>
|
||
</div></span>
|
||
|
||
</li>
|
||
|
||
|
||
<li class="public ">
|
||
<span class="summary_signature">
|
||
|
||
<a href="#session_types-instance_method" title="#session_types (instance method)">#<strong>session_types</strong> ⇒ Array </a>
|
||
|
||
|
||
|
||
</span>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<span class="summary_desc"><div class='inline'>
|
||
<p>A list of compatible session types.</p>
|
||
</div></span>
|
||
|
||
</li>
|
||
|
||
|
||
</ul>
|
||
|
||
|
||
|
||
|
||
|
||
<h3 class="inherited">Attributes included from <span class='object_link'><a href="Module/HasActions.html" title="Msf::Module::HasActions (module)">Module::HasActions</a></span></h3>
|
||
<p class="inherited"><span class='object_link'><a href="Module/HasActions.html#actions-instance_method" title="Msf::Module::HasActions#actions (method)">#actions</a></span>, <span class='object_link'><a href="Module/HasActions.html#default_action-instance_method" title="Msf::Module::HasActions#default_action (method)">#default_action</a></span>, <span class='object_link'><a href="Module/HasActions.html#passive_actions-instance_method" title="Msf::Module::HasActions#passive_actions (method)">#passive_actions</a></span></p>
|
||
|
||
|
||
|
||
<h2>
|
||
Instance Method Summary
|
||
<small><a href="#" class="summary_toggle">collapse</a></small>
|
||
</h2>
|
||
|
||
<ul class="summary">
|
||
|
||
<li class="public ">
|
||
<span class="summary_signature">
|
||
|
||
<a href="#check_for_session_readiness-instance_method" title="#check_for_session_readiness (instance method)">#<strong>check_for_session_readiness</strong>(tries = 6) ⇒ Object </a>
|
||
|
||
|
||
|
||
</span>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<span class="summary_desc"><div class='inline'>
|
||
<p>Meterpreter sometimes needs a little bit of extra time to actually be responsive for post modules.</p>
|
||
</div></span>
|
||
|
||
</li>
|
||
|
||
|
||
<li class="public ">
|
||
<span class="summary_signature">
|
||
|
||
<a href="#cleanup-instance_method" title="#cleanup (instance method)">#<strong>cleanup</strong> ⇒ Object </a>
|
||
|
||
|
||
|
||
</span>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<span class="summary_desc"><div class='inline'>
|
||
<p>Default cleanup handler does nothing.</p>
|
||
</div></span>
|
||
|
||
</li>
|
||
|
||
|
||
<li class="protected ">
|
||
<span class="summary_signature">
|
||
|
||
<a href="#command_names_for-instance_method" title="#command_names_for (instance method)">#<strong>command_names_for</strong>(command_ids) ⇒ Object </a>
|
||
|
||
|
||
|
||
</span>
|
||
|
||
|
||
|
||
<span class="note title protected">protected</span>
|
||
|
||
|
||
|
||
|
||
|
||
<span class="summary_desc"><div class='inline'></div></span>
|
||
|
||
</li>
|
||
|
||
|
||
<li class="public ">
|
||
<span class="summary_signature">
|
||
|
||
<a href="#compatible_sessions-instance_method" title="#compatible_sessions (instance method)">#<strong>compatible_sessions</strong> ⇒ Array </a>
|
||
|
||
|
||
|
||
</span>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<span class="summary_desc"><div class='inline'>
|
||
<p>Return a (possibly empty) list of all compatible sessions.</p>
|
||
</div></span>
|
||
|
||
</li>
|
||
|
||
|
||
<li class="public ">
|
||
<span class="summary_signature">
|
||
|
||
<a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong>(info = {}) ⇒ Object </a>
|
||
|
||
|
||
|
||
</span>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<span class="summary_desc"><div class='inline'></div></span>
|
||
|
||
</li>
|
||
|
||
|
||
<li class="protected ">
|
||
<span class="summary_signature">
|
||
|
||
<a href="#meterpreter_session_incompatibility_reasons-instance_method" title="#meterpreter_session_incompatibility_reasons (instance method)">#<strong>meterpreter_session_incompatibility_reasons</strong>(session) ⇒ Object </a>
|
||
|
||
|
||
|
||
</span>
|
||
|
||
|
||
|
||
<span class="note title protected">protected</span>
|
||
|
||
|
||
|
||
|
||
|
||
<span class="summary_desc"><div class='inline'>
|
||
<p>Return the reasons why a meterpreter session is incompatible.</p>
|
||
</div></span>
|
||
|
||
</li>
|
||
|
||
|
||
<li class="public ">
|
||
<span class="summary_signature">
|
||
|
||
<a href="#passive%3F-instance_method" title="#passive? (instance method)">#<strong>passive?</strong> ⇒ Boolean </a>
|
||
|
||
|
||
|
||
</span>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<span class="summary_desc"><div class='inline'>
|
||
<p>Whether this module’s <span class='object_link'><a href="Exploit/Stance.html" title="Msf::Exploit::Stance (module)">Exploit::Stance</a></span> is <span class='object_link'><a href="Exploit/Stance.html#Passive-constant" title="Msf::Exploit::Stance::Passive (constant)">passive</a></span>.</p>
|
||
</div></span>
|
||
|
||
</li>
|
||
|
||
|
||
<li class="public ">
|
||
<span class="summary_signature">
|
||
|
||
<a href="#post_commands-instance_method" title="#post_commands (instance method)">#<strong>post_commands</strong> ⇒ Object </a>
|
||
|
||
|
||
|
||
</span>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<span class="summary_desc"><div class='inline'>
|
||
<p>Can be overridden by individual modules to add new commands.</p>
|
||
</div></span>
|
||
|
||
</li>
|
||
|
||
|
||
<li class="public ">
|
||
<span class="summary_signature">
|
||
|
||
<a href="#session-instance_method" title="#session (instance method)">#<strong>session</strong> ⇒ Msf::Session<sup>?</sup> </a>
|
||
|
||
|
||
|
||
(also: #client)
|
||
|
||
</span>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<span class="summary_desc"><div class='inline'>
|
||
<p>Return the associated session or nil if there isn’t one.</p>
|
||
</div></span>
|
||
|
||
</li>
|
||
|
||
|
||
<li class="protected ">
|
||
<span class="summary_signature">
|
||
|
||
<a href="#session_changed%3F-instance_method" title="#session_changed? (instance method)">#<strong>session_changed?</strong> ⇒ Boolean </a>
|
||
|
||
|
||
|
||
</span>
|
||
|
||
|
||
|
||
<span class="note title protected">protected</span>
|
||
|
||
|
||
|
||
|
||
|
||
<span class="summary_desc"><div class='inline'></div></span>
|
||
|
||
</li>
|
||
|
||
|
||
<li class="public ">
|
||
<span class="summary_signature">
|
||
|
||
<a href="#session_compatible%3F-instance_method" title="#session_compatible? (instance method)">#<strong>session_compatible?</strong>(sess_or_sid) ⇒ Boolean </a>
|
||
|
||
|
||
|
||
</span>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<span class="summary_desc"><div class='inline'>
|
||
<p>Return false if the given session is not compatible with this module.</p>
|
||
</div></span>
|
||
|
||
</li>
|
||
|
||
|
||
<li class="public ">
|
||
<span class="summary_signature">
|
||
|
||
<a href="#session_display_info-instance_method" title="#session_display_info (instance method)">#<strong>session_display_info</strong> ⇒ Object </a>
|
||
|
||
|
||
|
||
</span>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<span class="summary_desc"><div class='inline'></div></span>
|
||
|
||
</li>
|
||
|
||
|
||
<li class="public ">
|
||
<span class="summary_signature">
|
||
|
||
<a href="#session_incompatibility_reasons-instance_method" title="#session_incompatibility_reasons (instance method)">#<strong>session_incompatibility_reasons</strong>(sess_or_sid) ⇒ Object </a>
|
||
|
||
|
||
|
||
</span>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<span class="summary_desc"><div class='inline'>
|
||
<p>Return the reasons why a session is incompatible.</p>
|
||
</div></span>
|
||
|
||
</li>
|
||
|
||
|
||
<li class="public ">
|
||
<span class="summary_signature">
|
||
|
||
<a href="#setup-instance_method" title="#setup (instance method)">#<strong>setup</strong> ⇒ Object </a>
|
||
|
||
|
||
|
||
</span>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<span class="summary_desc"><div class='inline'>
|
||
<p>Grabs a session object from the framework or raises <span class='object_link'><a href="OptionValidateError.html" title="Msf::OptionValidateError (class)">OptionValidateError</a></span> if one doesn’t exist and is required.</p>
|
||
</div></span>
|
||
|
||
</li>
|
||
|
||
|
||
<li class="public ">
|
||
<span class="summary_signature">
|
||
|
||
<a href="#sysinfo-instance_method" title="#sysinfo (instance method)">#<strong>sysinfo</strong> ⇒ Hash<sup>?</sup> </a>
|
||
|
||
|
||
|
||
</span>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<span class="summary_desc"><div class='inline'>
|
||
<p>Cached sysinfo, returns nil for non-meterpreter sessions.</p>
|
||
</div></span>
|
||
|
||
</li>
|
||
|
||
|
||
</ul>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<h3 class="inherited">Methods included from <span class='object_link'><a href="Post/Common.html" title="Msf::Post::Common (module)">Post::Common</a></span></h3>
|
||
<p class="inherited"><span class='object_link'><a href="Post/Common.html#clear_screen-instance_method" title="Msf::Post::Common#clear_screen (method)">#clear_screen</a></span>, <span class='object_link'><a href="Post/Common.html#cmd_exec-instance_method" title="Msf::Post::Common#cmd_exec (method)">#cmd_exec</a></span>, <span class='object_link'><a href="Post/Common.html#cmd_exec_get_pid-instance_method" title="Msf::Post::Common#cmd_exec_get_pid (method)">#cmd_exec_get_pid</a></span>, <span class='object_link'><a href="Post/Common.html#cmd_exec_with_result-instance_method" title="Msf::Post::Common#cmd_exec_with_result (method)">#cmd_exec_with_result</a></span>, <span class='object_link'><a href="Post/Common.html#command_exists%3F-instance_method" title="Msf::Post::Common#command_exists? (method)">#command_exists?</a></span>, <span class='object_link'><a href="Post/Common.html#create_process-instance_method" title="Msf::Post::Common#create_process (method)">#create_process</a></span>, <span class='object_link'><a href="Post/Common.html#get_env-instance_method" title="Msf::Post::Common#get_env (method)">#get_env</a></span>, <span class='object_link'><a href="Post/Common.html#get_envs-instance_method" title="Msf::Post::Common#get_envs (method)">#get_envs</a></span>, <span class='object_link'><a href="Post/Common.html#peer-instance_method" title="Msf::Post::Common#peer (method)">#peer</a></span>, <span class='object_link'><a href="Post/Common.html#report_virtualization-instance_method" title="Msf::Post::Common#report_virtualization (method)">#report_virtualization</a></span>, <span class='object_link'><a href="Post/Common.html#rhost-instance_method" title="Msf::Post::Common#rhost (method)">#rhost</a></span>, <span class='object_link'><a href="Post/Common.html#rport-instance_method" title="Msf::Post::Common#rport (method)">#rport</a></span></p>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<h3 class="inherited">Methods included from <span class='object_link'><a href="Module/HasActions.html" title="Msf::Module::HasActions (module)">Module::HasActions</a></span></h3>
|
||
<p class="inherited"><span class='object_link'><a href="Module/HasActions.html#action-instance_method" title="Msf::Module::HasActions#action (method)">#action</a></span>, <span class='object_link'><a href="Module/HasActions.html#find_action-instance_method" title="Msf::Module::HasActions#find_action (method)">#find_action</a></span>, <span class='object_link'><a href="Module/HasActions.html#passive_action%3F-instance_method" title="Msf::Module::HasActions#passive_action? (method)">#passive_action?</a></span></p>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<h3 class="inherited">Methods included from <span class='object_link'><a href="Auxiliary/Report.html" title="Msf::Auxiliary::Report (module)">Auxiliary::Report</a></span></h3>
|
||
<p class="inherited"><span class='object_link'><a href="Auxiliary/Report.html#active_db%3F-instance_method" title="Msf::Auxiliary::Report#active_db? (method)">#active_db?</a></span>, <span class='object_link'><a href="Auxiliary/Report.html#create_cracked_credential-instance_method" title="Msf::Auxiliary::Report#create_cracked_credential (method)">#create_cracked_credential</a></span>, <span class='object_link'><a href="Auxiliary/Report.html#create_credential-instance_method" title="Msf::Auxiliary::Report#create_credential (method)">#create_credential</a></span>, <span class='object_link'><a href="Auxiliary/Report.html#create_credential_and_login-instance_method" title="Msf::Auxiliary::Report#create_credential_and_login (method)">#create_credential_and_login</a></span>, <span class='object_link'><a href="Auxiliary/Report.html#create_credential_login-instance_method" title="Msf::Auxiliary::Report#create_credential_login (method)">#create_credential_login</a></span>, <span class='object_link'><a href="Auxiliary/Report.html#db-instance_method" title="Msf::Auxiliary::Report#db (method)">#db</a></span>, <span class='object_link'><a href="Auxiliary/Report.html#db_warning_given%3F-instance_method" title="Msf::Auxiliary::Report#db_warning_given? (method)">#db_warning_given?</a></span>, <span class='object_link'><a href="Auxiliary/Report.html#get_client-instance_method" title="Msf::Auxiliary::Report#get_client (method)">#get_client</a></span>, <span class='object_link'><a href="Auxiliary/Report.html#get_host-instance_method" title="Msf::Auxiliary::Report#get_host (method)">#get_host</a></span>, <span class='object_link'><a href="Auxiliary/Report.html#inside_workspace_boundary%3F-instance_method" title="Msf::Auxiliary::Report#inside_workspace_boundary? (method)">#inside_workspace_boundary?</a></span>, <span class='object_link'><a href="Auxiliary/Report.html#invalidate_login-instance_method" title="Msf::Auxiliary::Report#invalidate_login (method)">#invalidate_login</a></span>, <span class='object_link'><a href="Auxiliary/Report.html#mytask-instance_method" title="Msf::Auxiliary::Report#mytask (method)">#mytask</a></span>, <span class='object_link'><a href="Auxiliary/Report.html#myworkspace-instance_method" title="Msf::Auxiliary::Report#myworkspace (method)">#myworkspace</a></span>, <span class='object_link'><a href="Auxiliary/Report.html#myworkspace_id-instance_method" title="Msf::Auxiliary::Report#myworkspace_id (method)">#myworkspace_id</a></span>, <span class='object_link'><a href="Auxiliary/Report.html#report_auth_info-instance_method" title="Msf::Auxiliary::Report#report_auth_info (method)">#report_auth_info</a></span>, <span class='object_link'><a href="Auxiliary/Report.html#report_client-instance_method" title="Msf::Auxiliary::Report#report_client (method)">#report_client</a></span>, <span class='object_link'><a href="Auxiliary/Report.html#report_exploit-instance_method" title="Msf::Auxiliary::Report#report_exploit (method)">#report_exploit</a></span>, <span class='object_link'><a href="Auxiliary/Report.html#report_host-instance_method" title="Msf::Auxiliary::Report#report_host (method)">#report_host</a></span>, <span class='object_link'><a href="Auxiliary/Report.html#report_loot-instance_method" title="Msf::Auxiliary::Report#report_loot (method)">#report_loot</a></span>, <span class='object_link'><a href="Auxiliary/Report.html#report_note-instance_method" title="Msf::Auxiliary::Report#report_note (method)">#report_note</a></span>, <span class='object_link'><a href="Auxiliary/Report.html#report_service-instance_method" title="Msf::Auxiliary::Report#report_service (method)">#report_service</a></span>, <span class='object_link'><a href="Auxiliary/Report.html#report_vuln-instance_method" title="Msf::Auxiliary::Report#report_vuln (method)">#report_vuln</a></span>, <span class='object_link'><a href="Auxiliary/Report.html#report_web_form-instance_method" title="Msf::Auxiliary::Report#report_web_form (method)">#report_web_form</a></span>, <span class='object_link'><a href="Auxiliary/Report.html#report_web_page-instance_method" title="Msf::Auxiliary::Report#report_web_page (method)">#report_web_page</a></span>, <span class='object_link'><a href="Auxiliary/Report.html#report_web_site-instance_method" title="Msf::Auxiliary::Report#report_web_site (method)">#report_web_site</a></span>, <span class='object_link'><a href="Auxiliary/Report.html#report_web_vuln-instance_method" title="Msf::Auxiliary::Report#report_web_vuln (method)">#report_web_vuln</a></span>, <span class='object_link'><a href="Auxiliary/Report.html#store_cred-instance_method" title="Msf::Auxiliary::Report#store_cred (method)">#store_cred</a></span>, <span class='object_link'><a href="Auxiliary/Report.html#store_local-instance_method" title="Msf::Auxiliary::Report#store_local (method)">#store_local</a></span>, <span class='object_link'><a href="Auxiliary/Report.html#store_loot-instance_method" title="Msf::Auxiliary::Report#store_loot (method)">#store_loot</a></span></p>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<h3 class="inherited">Methods included from <span class='object_link'><a href="../Metasploit/Framework/Require.html" title="Metasploit::Framework::Require (module)">Metasploit::Framework::Require</a></span></h3>
|
||
<p class="inherited"><span class='object_link'><a href="../Metasploit/Framework/Require.html#optionally-class_method" title="Metasploit::Framework::Require.optionally (method)">optionally</a></span>, <span class='object_link'><a href="../Metasploit/Framework/Require.html#optionally_active_record_railtie-class_method" title="Metasploit::Framework::Require.optionally_active_record_railtie (method)">optionally_active_record_railtie</a></span>, <span class='object_link'><a href="../Metasploit/Framework/Require.html#optionally_include_metasploit_credential_creation-class_method" title="Metasploit::Framework::Require.optionally_include_metasploit_credential_creation (method)">optionally_include_metasploit_credential_creation</a></span>, <span class='object_link'><a href="../Metasploit/Framework/Require.html#optionally_include_metasploit_credential_creation-instance_method" title="Metasploit::Framework::Require#optionally_include_metasploit_credential_creation (method)">#optionally_include_metasploit_credential_creation</a></span>, <span class='object_link'><a href="../Metasploit/Framework/Require.html#optionally_require_metasploit_db_gem_engines-class_method" title="Metasploit::Framework::Require.optionally_require_metasploit_db_gem_engines (method)">optionally_require_metasploit_db_gem_engines</a></span></p>
|
||
|
||
<div id="instance_attr_details" class="attr_details">
|
||
<h2>Instance Attribute Details</h2>
|
||
|
||
|
||
<span id="passive=-instance_method"></span>
|
||
<div class="method_details first">
|
||
<h3 class="signature first" id="passive-instance_method">
|
||
|
||
#<strong>passive</strong> ⇒ <tt>Boolean</tt>
|
||
|
||
|
||
|
||
|
||
|
||
</h3><div class="docstring">
|
||
<div class="discussion">
|
||
|
||
<p>True when this module is passive, false when active</p>
|
||
|
||
|
||
</div>
|
||
</div>
|
||
<div class="tags">
|
||
|
||
<p class="tag_title">Returns:</p>
|
||
<ul class="return">
|
||
|
||
<li>
|
||
|
||
|
||
<span class='type'>(<tt>Boolean</tt>)</span>
|
||
|
||
|
||
|
||
</li>
|
||
|
||
</ul>
|
||
|
||
<p class="tag_title">See Also:</p>
|
||
<ul class="see">
|
||
|
||
<li><span class='object_link'><a href="#passive%3F-instance_method" title="Msf::SessionCompatibility#passive? (method)">#passive?</a></span></li>
|
||
|
||
</ul>
|
||
|
||
</div><table class="source_code">
|
||
<tr>
|
||
<td>
|
||
<pre class="lines">
|
||
|
||
|
||
232
|
||
233
|
||
234</pre>
|
||
</td>
|
||
<td>
|
||
<pre class="code"><span class="info file"># File 'lib/msf/core/session_compatibility.rb', line 232</span>
|
||
|
||
<span class='kw'>def</span> <span class='id identifier rubyid_passive'>passive</span>
|
||
<span class='ivar'>@passive</span>
|
||
<span class='kw'>end</span></pre>
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
</div>
|
||
|
||
|
||
<span id="session_types=-instance_method"></span>
|
||
<div class="method_details ">
|
||
<h3 class="signature " id="session_types-instance_method">
|
||
|
||
#<strong>session_types</strong> ⇒ <tt>Array</tt>
|
||
|
||
|
||
|
||
|
||
|
||
</h3><div class="docstring">
|
||
<div class="discussion">
|
||
|
||
<p>A list of compatible session types</p>
|
||
|
||
|
||
</div>
|
||
</div>
|
||
<div class="tags">
|
||
|
||
<p class="tag_title">Returns:</p>
|
||
<ul class="return">
|
||
|
||
<li>
|
||
|
||
|
||
<span class='type'>(<tt>Array</tt>)</span>
|
||
|
||
|
||
|
||
</li>
|
||
|
||
</ul>
|
||
|
||
</div><table class="source_code">
|
||
<tr>
|
||
<td>
|
||
<pre class="lines">
|
||
|
||
|
||
238
|
||
239
|
||
240</pre>
|
||
</td>
|
||
<td>
|
||
<pre class="code"><span class="info file"># File 'lib/msf/core/session_compatibility.rb', line 238</span>
|
||
|
||
<span class='kw'>def</span> <span class='id identifier rubyid_session_types'>session_types</span>
|
||
<span class='ivar'>@session_types</span>
|
||
<span class='kw'>end</span></pre>
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
</div>
|
||
|
||
</div>
|
||
|
||
|
||
<div id="instance_method_details" class="method_details_list">
|
||
<h2>Instance Method Details</h2>
|
||
|
||
|
||
<div class="method_details first">
|
||
<h3 class="signature first" id="check_for_session_readiness-instance_method">
|
||
|
||
#<strong>check_for_session_readiness</strong>(tries = 6) ⇒ <tt>Object</tt>
|
||
|
||
|
||
|
||
|
||
|
||
</h3><div class="docstring">
|
||
<div class="discussion">
|
||
|
||
<p>Meterpreter sometimes needs a little bit of extra time to actually be responsive for post modules. Default tries and retries for 5 seconds.</p>
|
||
|
||
|
||
</div>
|
||
</div>
|
||
<div class="tags">
|
||
|
||
|
||
</div><table class="source_code">
|
||
<tr>
|
||
<td>
|
||
<pre class="lines">
|
||
|
||
|
||
58
|
||
59
|
||
60
|
||
61
|
||
62
|
||
63
|
||
64
|
||
65
|
||
66
|
||
67
|
||
68
|
||
69
|
||
70
|
||
71
|
||
72</pre>
|
||
</td>
|
||
<td>
|
||
<pre class="code"><span class="info file"># File 'lib/msf/core/session_compatibility.rb', line 58</span>
|
||
|
||
<span class='kw'>def</span> <span class='id identifier rubyid_check_for_session_readiness'>check_for_session_readiness</span><span class='lparen'>(</span><span class='id identifier rubyid_tries'>tries</span><span class='op'>=</span><span class='int'>6</span><span class='rparen'>)</span>
|
||
<span class='id identifier rubyid_session_ready_count'>session_ready_count</span> <span class='op'>=</span> <span class='int'>0</span>
|
||
<span class='id identifier rubyid_session_ready'>session_ready</span> <span class='op'>=</span> <span class='kw'>false</span>
|
||
<span class='kw'>until</span> <span class='id identifier rubyid_session'>session</span><span class='period'>.</span><span class='id identifier rubyid_sys'>sys</span> <span class='kw'>or</span> <span class='id identifier rubyid_session_ready_count'>session_ready_count</span> <span class='op'>></span> <span class='id identifier rubyid_tries'>tries</span>
|
||
<span class='id identifier rubyid_session_ready_count'>session_ready_count</span> <span class='op'>+=</span> <span class='int'>1</span>
|
||
<span class='id identifier rubyid_back_off_period'>back_off_period</span> <span class='op'>=</span> <span class='lparen'>(</span><span class='id identifier rubyid_session_ready_count'>session_ready_count</span><span class='op'>**</span><span class='int'>2</span><span class='rparen'>)</span><span class='op'>/</span><span class='float'>10.0</span>
|
||
<span class='id identifier rubyid_select'>select</span><span class='lparen'>(</span><span class='kw'>nil</span><span class='comma'>,</span><span class='kw'>nil</span><span class='comma'>,</span><span class='kw'>nil</span><span class='comma'>,</span><span class='id identifier rubyid_back_off_period'>back_off_period</span><span class='rparen'>)</span>
|
||
<span class='kw'>end</span>
|
||
<span class='id identifier rubyid_session_ready'>session_ready</span> <span class='op'>=</span> <span class='op'>!</span><span class='op'>!</span><span class='id identifier rubyid_session'>session</span><span class='period'>.</span><span class='id identifier rubyid_sys'>sys</span>
|
||
<span class='kw'>unless</span> <span class='id identifier rubyid_session_ready'>session_ready</span>
|
||
<span class='id identifier rubyid_raise'>raise</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>The stdapi extension has not been loaded yet.</span><span class='tstring_end'>"</span></span> <span class='kw'>unless</span> <span class='id identifier rubyid_session'>session</span><span class='period'>.</span><span class='id identifier rubyid_tlv_enc_key'>tlv_enc_key</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
|
||
<span class='id identifier rubyid_raise'>raise</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Could not get a hold of the session.</span><span class='tstring_end'>"</span></span>
|
||
<span class='kw'>end</span>
|
||
<span class='kw'>return</span> <span class='id identifier rubyid_session_ready'>session_ready</span>
|
||
<span class='kw'>end</span></pre>
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
</div>
|
||
|
||
<div class="method_details ">
|
||
<h3 class="signature " id="cleanup-instance_method">
|
||
|
||
#<strong>cleanup</strong> ⇒ <tt>Object</tt>
|
||
|
||
|
||
|
||
|
||
|
||
</h3><div class="docstring">
|
||
<div class="discussion">
|
||
|
||
<p>Default cleanup handler does nothing</p>
|
||
|
||
|
||
</div>
|
||
</div>
|
||
<div class="tags">
|
||
|
||
|
||
</div><table class="source_code">
|
||
<tr>
|
||
<td>
|
||
<pre class="lines">
|
||
|
||
|
||
77
|
||
78
|
||
79</pre>
|
||
</td>
|
||
<td>
|
||
<pre class="code"><span class="info file"># File 'lib/msf/core/session_compatibility.rb', line 77</span>
|
||
|
||
<span class='kw'>def</span> <span class='id identifier rubyid_cleanup'>cleanup</span>
|
||
<span class='kw'>super</span> <span class='kw'>if</span> <span class='kw'>defined?</span><span class='lparen'>(</span><span class='kw'>super</span><span class='rparen'>)</span>
|
||
<span class='kw'>end</span></pre>
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
</div>
|
||
|
||
<div class="method_details ">
|
||
<h3 class="signature " id="command_names_for-instance_method">
|
||
|
||
#<strong>command_names_for</strong>(command_ids) ⇒ <tt>Object</tt> <span class="extras">(protected)</span>
|
||
|
||
|
||
|
||
|
||
|
||
</h3><table class="source_code">
|
||
<tr>
|
||
<td>
|
||
<pre class="lines">
|
||
|
||
|
||
327
|
||
328
|
||
329</pre>
|
||
</td>
|
||
<td>
|
||
<pre class="code"><span class="info file"># File 'lib/msf/core/session_compatibility.rb', line 327</span>
|
||
|
||
<span class='kw'>def</span> <span class='id identifier rubyid_command_names_for'>command_names_for</span><span class='lparen'>(</span><span class='id identifier rubyid_command_ids'>command_ids</span><span class='rparen'>)</span>
|
||
<span class='id identifier rubyid_command_ids'>command_ids</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_id'>id</span><span class='op'>|</span> <span class='const'><span class='object_link'><a href="../Rex.html" title="Rex (module)">Rex</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Rex/Post.html" title="Rex::Post (module)">Post</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Rex/Post/Meterpreter.html" title="Rex::Post::Meterpreter (module)">Meterpreter</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Rex/Post/Meterpreter/CommandMapper.html" title="Rex::Post::Meterpreter::CommandMapper (class)">CommandMapper</a></span></span><span class='period'>.</span><span class='id identifier rubyid_get_command_name'><span class='object_link'><a href="../Rex/Post/Meterpreter/CommandMapper.html#get_command_name-class_method" title="Rex::Post::Meterpreter::CommandMapper.get_command_name (method)">get_command_name</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_id'>id</span><span class='rparen'>)</span> <span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_join'><span class='object_link'><a href="../top-level-namespace.html#join-instance_method" title="#join (method)">join</a></span></span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>, </span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
|
||
<span class='kw'>end</span></pre>
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
</div>
|
||
|
||
<div class="method_details ">
|
||
<h3 class="signature " id="compatible_sessions-instance_method">
|
||
|
||
#<strong>compatible_sessions</strong> ⇒ <tt>Array</tt>
|
||
|
||
|
||
|
||
|
||
|
||
</h3><div class="docstring">
|
||
<div class="discussion">
|
||
|
||
<p>Return a (possibly empty) list of all compatible sessions</p>
|
||
|
||
|
||
</div>
|
||
</div>
|
||
<div class="tags">
|
||
|
||
<p class="tag_title">Returns:</p>
|
||
<ul class="return">
|
||
|
||
<li>
|
||
|
||
|
||
<span class='type'>(<tt>Array</tt>)</span>
|
||
|
||
|
||
|
||
</li>
|
||
|
||
</ul>
|
||
|
||
</div><table class="source_code">
|
||
<tr>
|
||
<td>
|
||
<pre class="lines">
|
||
|
||
|
||
135
|
||
136
|
||
137
|
||
138
|
||
139
|
||
140
|
||
141</pre>
|
||
</td>
|
||
<td>
|
||
<pre class="code"><span class="info file"># File 'lib/msf/core/session_compatibility.rb', line 135</span>
|
||
|
||
<span class='kw'>def</span> <span class='id identifier rubyid_compatible_sessions'>compatible_sessions</span>
|
||
<span class='id identifier rubyid_sessions'>sessions</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
|
||
<span class='id identifier rubyid_framework'>framework</span><span class='period'>.</span><span class='id identifier rubyid_sessions'>sessions</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_sid'>sid</span><span class='comma'>,</span> <span class='id identifier rubyid_s'>s</span><span class='op'>|</span>
|
||
<span class='id identifier rubyid_sessions'>sessions</span> <span class='op'><<</span> <span class='id identifier rubyid_sid'>sid</span> <span class='kw'>if</span> <span class='id identifier rubyid_session_compatible?'>session_compatible?</span><span class='lparen'>(</span><span class='id identifier rubyid_s'>s</span><span class='rparen'>)</span>
|
||
<span class='kw'>end</span>
|
||
<span class='id identifier rubyid_sessions'>sessions</span>
|
||
<span class='kw'>end</span></pre>
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
</div>
|
||
|
||
<div class="method_details ">
|
||
<h3 class="signature " id="initialize-instance_method">
|
||
|
||
#<strong>initialize</strong>(info = {}) ⇒ <tt>Object</tt>
|
||
|
||
|
||
|
||
|
||
|
||
</h3><table class="source_code">
|
||
<tr>
|
||
<td>
|
||
<pre class="lines">
|
||
|
||
|
||
10
|
||
11
|
||
12
|
||
13
|
||
14
|
||
15
|
||
16</pre>
|
||
</td>
|
||
<td>
|
||
<pre class="code"><span class="info file"># File 'lib/msf/core/session_compatibility.rb', line 10</span>
|
||
|
||
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_info'>info</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
|
||
<span class='kw'>super</span>
|
||
|
||
<span class='comment'># Default stance is active
|
||
</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_passive'>passive</span> <span class='op'>=</span> <span class='id identifier rubyid_info'>info</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Passive</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='kw'>false</span>
|
||
<span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_session_types'>session_types</span> <span class='op'>=</span> <span class='id identifier rubyid_info'>info</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>SessionTypes</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
|
||
<span class='kw'>end</span></pre>
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
</div>
|
||
|
||
<div class="method_details ">
|
||
<h3 class="signature " id="meterpreter_session_incompatibility_reasons-instance_method">
|
||
|
||
#<strong>meterpreter_session_incompatibility_reasons</strong>(session) ⇒ <tt>Object</tt> <span class="extras">(protected)</span>
|
||
|
||
|
||
|
||
|
||
|
||
</h3><div class="docstring">
|
||
<div class="discussion">
|
||
|
||
<p>Return the reasons why a meterpreter session is incompatible. Checks all specified meterpreter commands are provided by the remote session</p>
|
||
|
||
|
||
</div>
|
||
</div>
|
||
<div class="tags">
|
||
|
||
|
||
</div><table class="source_code">
|
||
<tr>
|
||
<td>
|
||
<pre class="lines">
|
||
|
||
|
||
260
|
||
261
|
||
262
|
||
263
|
||
264
|
||
265
|
||
266
|
||
267
|
||
268
|
||
269
|
||
270
|
||
271
|
||
272
|
||
273
|
||
274
|
||
275
|
||
276
|
||
277
|
||
278
|
||
279
|
||
280
|
||
281
|
||
282
|
||
283
|
||
284
|
||
285
|
||
286
|
||
287
|
||
288
|
||
289
|
||
290
|
||
291
|
||
292
|
||
293
|
||
294
|
||
295
|
||
296
|
||
297
|
||
298
|
||
299
|
||
300
|
||
301
|
||
302
|
||
303
|
||
304
|
||
305
|
||
306
|
||
307
|
||
308
|
||
309
|
||
310
|
||
311
|
||
312
|
||
313
|
||
314
|
||
315
|
||
316
|
||
317
|
||
318
|
||
319
|
||
320
|
||
321
|
||
322
|
||
323
|
||
324
|
||
325</pre>
|
||
</td>
|
||
<td>
|
||
<pre class="code"><span class="info file"># File 'lib/msf/core/session_compatibility.rb', line 260</span>
|
||
|
||
<span class='kw'>def</span> <span class='id identifier rubyid_meterpreter_session_incompatibility_reasons'>meterpreter_session_incompatibility_reasons</span><span class='lparen'>(</span><span class='id identifier rubyid_session'>session</span><span class='rparen'>)</span>
|
||
<span class='id identifier rubyid_cmd_name_wildcards'>cmd_name_wildcards</span> <span class='op'>=</span> <span class='id identifier rubyid_module_info'>module_info</span><span class='period'>.</span><span class='id identifier rubyid_dig'>dig</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Compat</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Meterpreter</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Commands</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span> <span class='op'>||</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
|
||
<span class='id identifier rubyid_cmd_names'>cmd_names</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="../Rex.html" title="Rex (module)">Rex</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Rex/Post.html" title="Rex::Post (module)">Post</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Rex/Post/Meterpreter.html" title="Rex::Post::Meterpreter (module)">Meterpreter</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Rex/Post/Meterpreter/CommandMapper.html" title="Rex::Post::Meterpreter::CommandMapper (class)">CommandMapper</a></span></span><span class='period'>.</span><span class='id identifier rubyid_get_command_names'><span class='object_link'><a href="../Rex/Post/Meterpreter/CommandMapper.html#get_command_names-class_method" title="Rex::Post::Meterpreter::CommandMapper.get_command_names (method)">get_command_names</a></span></span><span class='period'>.</span><span class='id identifier rubyid_select'>select</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_cmd_name'>cmd_name</span><span class='op'>|</span>
|
||
<span class='id identifier rubyid_cmd_name_wildcards'>cmd_name_wildcards</span><span class='period'>.</span><span class='id identifier rubyid_any?'>any?</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_cmd_name_wildcard'>cmd_name_wildcard</span><span class='op'>|</span> <span class='op'>::</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_fnmatch'>fnmatch</span><span class='lparen'>(</span><span class='id identifier rubyid_cmd_name_wildcard'>cmd_name_wildcard</span><span class='comma'>,</span> <span class='id identifier rubyid_cmd_name'>cmd_name</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
|
||
<span class='kw'>end</span>
|
||
|
||
<span class='id identifier rubyid_unmatched_wildcards'>unmatched_wildcards</span> <span class='op'>=</span> <span class='id identifier rubyid_cmd_name_wildcards'>cmd_name_wildcards</span><span class='period'>.</span><span class='id identifier rubyid_select'>select</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_cmd_name_wildcard'>cmd_name_wildcard</span><span class='op'>|</span> <span class='id identifier rubyid_cmd_names'>cmd_names</span><span class='period'>.</span><span class='id identifier rubyid_none?'>none?</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_cmd_name'>cmd_name</span><span class='op'>|</span> <span class='op'>::</span><span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_fnmatch'>fnmatch</span><span class='lparen'>(</span><span class='id identifier rubyid_cmd_name_wildcard'>cmd_name_wildcard</span><span class='comma'>,</span> <span class='id identifier rubyid_cmd_name'>cmd_name</span><span class='rparen'>)</span> <span class='rbrace'>}</span> <span class='rbrace'>}</span>
|
||
<span class='kw'>unless</span> <span class='id identifier rubyid_unmatched_wildcards'>unmatched_wildcards</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span>
|
||
<span class='comment'># This implies that there was a typo in one of the wildcards because it didn't match anything. This is a developer mistake.
|
||
</span> <span class='id identifier rubyid_wlog'><span class='object_link'><a href="../top-level-namespace.html#wlog-instance_method" title="#wlog (method)">wlog</a></span></span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>The </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_fullname'>fullname</span><span class='embexpr_end'>}</span><span class='tstring_content'> module specified the following Meterpreter command wildcards that did not match anything: </span><span class='embexpr_beg'>#{</span> <span class='id identifier rubyid_unmatched_wildcards'>unmatched_wildcards</span><span class='period'>.</span><span class='id identifier rubyid_join'>join</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>, </span><span class='tstring_end'>'</span></span><span class='rparen'>)</span> <span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
||
<span class='kw'>end</span>
|
||
|
||
<span class='id identifier rubyid_cmd_ids'>cmd_ids</span> <span class='op'>=</span> <span class='id identifier rubyid_cmd_names'>cmd_names</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_name'>name</span><span class='op'>|</span> <span class='const'><span class='object_link'><a href="../Rex.html" title="Rex (module)">Rex</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Rex/Post.html" title="Rex::Post (module)">Post</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Rex/Post/Meterpreter.html" title="Rex::Post::Meterpreter (module)">Meterpreter</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Rex/Post/Meterpreter/CommandMapper.html" title="Rex::Post::Meterpreter::CommandMapper (class)">CommandMapper</a></span></span><span class='period'>.</span><span class='id identifier rubyid_get_command_id'><span class='object_link'><a href="../Rex/Post/Meterpreter/CommandMapper.html#get_command_id-class_method" title="Rex::Post::Meterpreter::CommandMapper.get_command_id (method)">get_command_id</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_name'>name</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
|
||
|
||
<span class='comment'># XXX: Remove this condition once the payloads gem has had another major version bump from 2.x to 3.x and
|
||
</span> <span class='comment'># rapid7/metasploit-payloads#451 has been landed to correct the `enumextcmd` behavior on Windows. Until then, skip
|
||
</span> <span class='comment'># proactive validation of Windows core commands. This is not the only instance of this workaround.
|
||
</span> <span class='kw'>if</span> <span class='id identifier rubyid_session'>session</span><span class='period'>.</span><span class='id identifier rubyid_base_platform'>base_platform</span> <span class='op'>==</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>windows</span><span class='tstring_end'>'</span></span>
|
||
<span class='id identifier rubyid_cmd_ids'>cmd_ids</span> <span class='op'>=</span> <span class='id identifier rubyid_cmd_ids'>cmd_ids</span><span class='period'>.</span><span class='id identifier rubyid_select'>select</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_cmd_id'>cmd_id</span><span class='op'>|</span>
|
||
<span class='op'>!</span><span class='id identifier rubyid_cmd_id'>cmd_id</span><span class='period'>.</span><span class='id identifier rubyid_between?'>between?</span><span class='lparen'>(</span>
|
||
<span class='const'><span class='object_link'><a href="../Rex.html" title="Rex (module)">Rex</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Rex/Post.html" title="Rex::Post (module)">Post</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Rex/Post/Meterpreter.html" title="Rex::Post::Meterpreter (module)">Meterpreter</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Rex/Post/Meterpreter/ClientCore.html" title="Rex::Post::Meterpreter::ClientCore (class)">ClientCore</a></span></span><span class='period'>.</span><span class='id identifier rubyid_extension_id'><span class='object_link'><a href="../Rex/Post/Meterpreter/ClientCore.html#extension_id-class_method" title="Rex::Post::Meterpreter::ClientCore.extension_id (method)">extension_id</a></span></span><span class='comma'>,</span>
|
||
<span class='const'><span class='object_link'><a href="../Rex.html" title="Rex (module)">Rex</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Rex/Post.html" title="Rex::Post (module)">Post</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Rex/Post/Meterpreter.html" title="Rex::Post::Meterpreter (module)">Meterpreter</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Rex/Post/Meterpreter/ClientCore.html" title="Rex::Post::Meterpreter::ClientCore (class)">ClientCore</a></span></span><span class='period'>.</span><span class='id identifier rubyid_extension_id'><span class='object_link'><a href="../Rex/Post/Meterpreter/ClientCore.html#extension_id-class_method" title="Rex::Post::Meterpreter::ClientCore.extension_id (method)">extension_id</a></span></span> <span class='op'>+</span> <span class='const'><span class='object_link'><a href="../Rex.html" title="Rex (module)">Rex</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Rex/Post.html" title="Rex::Post (module)">Post</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Rex/Post/Meterpreter.html" title="Rex::Post::Meterpreter (module)">Meterpreter</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Rex/Post/Meterpreter.html#COMMAND_ID_RANGE-constant" title="Rex::Post::Meterpreter::COMMAND_ID_RANGE (constant)">COMMAND_ID_RANGE</a></span></span> <span class='op'>-</span> <span class='int'>1</span>
|
||
<span class='rparen'>)</span>
|
||
<span class='kw'>end</span>
|
||
<span class='kw'>end</span>
|
||
|
||
<span class='comment'># Windows does not support chmod, but will be defined by default in the file mixin
|
||
</span> <span class='kw'>if</span> <span class='id identifier rubyid_session'>session</span><span class='period'>.</span><span class='id identifier rubyid_base_platform'>base_platform</span> <span class='op'>==</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>windows</span><span class='tstring_end'>'</span></span>
|
||
<span class='id identifier rubyid_cmd_ids'>cmd_ids</span> <span class='op'>-=</span> <span class='lbracket'>[</span><span class='const'><span class='object_link'><a href="../Rex.html" title="Rex (module)">Rex</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Rex/Post.html" title="Rex::Post (module)">Post</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Rex/Post/Meterpreter.html" title="Rex::Post::Meterpreter (module)">Meterpreter</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Rex/Post/Meterpreter/Extensions.html" title="Rex::Post::Meterpreter::Extensions (module)">Extensions</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Rex/Post/Meterpreter/Extensions/Stdapi.html" title="Rex::Post::Meterpreter::Extensions::Stdapi (module)">Stdapi</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Rex/Post/Meterpreter/Extensions/Stdapi.html#COMMAND_ID_STDAPI_FS_CHMOD-constant" title="Rex::Post::Meterpreter::Extensions::Stdapi::COMMAND_ID_STDAPI_FS_CHMOD (constant)">COMMAND_ID_STDAPI_FS_CHMOD</a></span></span><span class='rbracket'>]</span>
|
||
<span class='kw'>end</span>
|
||
|
||
<span class='id identifier rubyid_missing_cmd_ids'>missing_cmd_ids</span> <span class='op'>=</span> <span class='lparen'>(</span><span class='id identifier rubyid_cmd_ids'>cmd_ids</span> <span class='op'>-</span> <span class='id identifier rubyid_session'>session</span><span class='period'>.</span><span class='id identifier rubyid_commands'>commands</span><span class='rparen'>)</span>
|
||
<span class='kw'>unless</span> <span class='id identifier rubyid_missing_cmd_ids'>missing_cmd_ids</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span>
|
||
<span class='comment'># If there are missing commands, try to load the necessary extension.
|
||
</span>
|
||
<span class='comment'># If core_loadlib isn't supported, then extensions can't be loaded
|
||
</span> <span class='kw'>return</span> <span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>missing Meterpreter features: core can not be extended</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span> <span class='kw'>unless</span> <span class='id identifier rubyid_session'>session</span><span class='period'>.</span><span class='id identifier rubyid_commands'>commands</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span><span class='lparen'>(</span><span class='const'><span class='object_link'><a href="../Rex.html" title="Rex (module)">Rex</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Rex/Post.html" title="Rex::Post (module)">Post</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Rex/Post/Meterpreter.html" title="Rex::Post::Meterpreter (module)">Meterpreter</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Rex/Post/Meterpreter.html#COMMAND_ID_CORE_LOADLIB-constant" title="Rex::Post::Meterpreter::COMMAND_ID_CORE_LOADLIB (constant)">COMMAND_ID_CORE_LOADLIB</a></span></span><span class='rparen'>)</span>
|
||
|
||
<span class='comment'># Since core is already loaded, if the missing command is a core command then it's truly missing
|
||
</span> <span class='id identifier rubyid_missing_core_cmd_ids'>missing_core_cmd_ids</span> <span class='op'>=</span> <span class='id identifier rubyid_missing_cmd_ids'>missing_cmd_ids</span><span class='period'>.</span><span class='id identifier rubyid_select'>select</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_cmd_id'>cmd_id</span><span class='op'>|</span>
|
||
<span class='id identifier rubyid_cmd_id'>cmd_id</span><span class='period'>.</span><span class='id identifier rubyid_between?'>between?</span><span class='lparen'>(</span>
|
||
<span class='const'><span class='object_link'><a href="../Rex.html" title="Rex (module)">Rex</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Rex/Post.html" title="Rex::Post (module)">Post</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Rex/Post/Meterpreter.html" title="Rex::Post::Meterpreter (module)">Meterpreter</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Rex/Post/Meterpreter/ClientCore.html" title="Rex::Post::Meterpreter::ClientCore (class)">ClientCore</a></span></span><span class='period'>.</span><span class='id identifier rubyid_extension_id'><span class='object_link'><a href="../Rex/Post/Meterpreter/ClientCore.html#extension_id-class_method" title="Rex::Post::Meterpreter::ClientCore.extension_id (method)">extension_id</a></span></span><span class='comma'>,</span>
|
||
<span class='const'><span class='object_link'><a href="../Rex.html" title="Rex (module)">Rex</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Rex/Post.html" title="Rex::Post (module)">Post</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Rex/Post/Meterpreter.html" title="Rex::Post::Meterpreter (module)">Meterpreter</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Rex/Post/Meterpreter/ClientCore.html" title="Rex::Post::Meterpreter::ClientCore (class)">ClientCore</a></span></span><span class='period'>.</span><span class='id identifier rubyid_extension_id'><span class='object_link'><a href="../Rex/Post/Meterpreter/ClientCore.html#extension_id-class_method" title="Rex::Post::Meterpreter::ClientCore.extension_id (method)">extension_id</a></span></span> <span class='op'>+</span> <span class='const'><span class='object_link'><a href="../Rex.html" title="Rex (module)">Rex</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Rex/Post.html" title="Rex::Post (module)">Post</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Rex/Post/Meterpreter.html" title="Rex::Post::Meterpreter (module)">Meterpreter</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Rex/Post/Meterpreter.html#COMMAND_ID_RANGE-constant" title="Rex::Post::Meterpreter::COMMAND_ID_RANGE (constant)">COMMAND_ID_RANGE</a></span></span> <span class='op'>-</span> <span class='int'>1</span>
|
||
<span class='rparen'>)</span>
|
||
<span class='kw'>end</span>
|
||
<span class='kw'>if</span> <span class='id identifier rubyid_missing_core_cmd_ids'>missing_core_cmd_ids</span><span class='period'>.</span><span class='id identifier rubyid_any?'>any?</span>
|
||
<span class='kw'>return</span> <span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>missing Meterpreter features: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_command_names_for'>command_names_for</span><span class='lparen'>(</span><span class='id identifier rubyid_missing_core_cmd_ids'>missing_core_cmd_ids</span><span class='rparen'>)</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span>
|
||
<span class='kw'>end</span>
|
||
|
||
<span class='id identifier rubyid_missing_extensions'>missing_extensions</span> <span class='op'>=</span> <span class='id identifier rubyid_missing_cmd_ids'>missing_cmd_ids</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_cmd_id'>cmd_id</span><span class='op'>|</span> <span class='const'><span class='object_link'><a href="../Rex.html" title="Rex (module)">Rex</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Rex/Post.html" title="Rex::Post (module)">Post</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Rex/Post/Meterpreter.html" title="Rex::Post::Meterpreter (module)">Meterpreter</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../Rex/Post/Meterpreter/ExtensionMapper.html" title="Rex::Post::Meterpreter::ExtensionMapper (class)">ExtensionMapper</a></span></span><span class='period'>.</span><span class='id identifier rubyid_get_extension_name'><span class='object_link'><a href="../Rex/Post/Meterpreter/ExtensionMapper.html#get_extension_name-class_method" title="Rex::Post::Meterpreter::ExtensionMapper.get_extension_name (method)">get_extension_name</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_cmd_id'>cmd_id</span><span class='rparen'>)</span> <span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_uniq'>uniq</span>
|
||
<span class='id identifier rubyid_missing_extensions'>missing_extensions</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_ext_name'>ext_name</span><span class='op'>|</span>
|
||
<span class='comment'># If the extension is already loaded, the command is truly missing
|
||
</span> <span class='kw'>return</span> <span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>missing Meterpreter features: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_command_names_for'>command_names_for</span><span class='lparen'>(</span><span class='id identifier rubyid_missing_cmd_ids'>missing_cmd_ids</span><span class='rparen'>)</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span> <span class='kw'>if</span> <span class='id identifier rubyid_session'>session</span><span class='period'>.</span><span class='id identifier rubyid_ext'>ext</span><span class='period'>.</span><span class='id identifier rubyid_aliases'>aliases</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span><span class='lparen'>(</span><span class='id identifier rubyid_ext_name'>ext_name</span><span class='rparen'>)</span>
|
||
|
||
<span class='kw'>begin</span>
|
||
<span class='id identifier rubyid_session'>session</span><span class='period'>.</span><span class='id identifier rubyid_core'>core</span><span class='period'>.</span><span class='id identifier rubyid_use'>use</span><span class='lparen'>(</span><span class='id identifier rubyid_ext_name'>ext_name</span><span class='rparen'>)</span>
|
||
<span class='kw'>rescue</span> <span class='const'>RuntimeError</span>
|
||
<span class='kw'>return</span> <span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>unloadable Meterpreter extension: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_ext_name'>ext_name</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span>
|
||
<span class='kw'>end</span>
|
||
<span class='kw'>end</span>
|
||
<span class='kw'>end</span>
|
||
<span class='id identifier rubyid_missing_cmd_ids'>missing_cmd_ids</span> <span class='op'>-=</span> <span class='id identifier rubyid_session'>session</span><span class='period'>.</span><span class='id identifier rubyid_commands'>commands</span>
|
||
<span class='kw'>return</span> <span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>missing Meterpreter features: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_command_names_for'>command_names_for</span><span class='lparen'>(</span><span class='id identifier rubyid_missing_cmd_ids'>missing_cmd_ids</span><span class='rparen'>)</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span><span class='rbracket'>]</span> <span class='kw'>unless</span> <span class='id identifier rubyid_missing_cmd_ids'>missing_cmd_ids</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span>
|
||
|
||
<span class='lbracket'>[</span><span class='rbracket'>]</span>
|
||
<span class='kw'>end</span></pre>
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
</div>
|
||
|
||
<div class="method_details ">
|
||
<h3 class="signature " id="passive?-instance_method">
|
||
|
||
#<strong>passive?</strong> ⇒ <tt>Boolean</tt>
|
||
|
||
|
||
|
||
|
||
|
||
</h3><div class="docstring">
|
||
<div class="discussion">
|
||
|
||
<p>Whether this module’s <span class='object_link'><a href="Exploit/Stance.html" title="Msf::Exploit::Stance (module)">Exploit::Stance</a></span> is <span class='object_link'><a href="Exploit/Stance.html#Passive-constant" title="Msf::Exploit::Stance::Passive (constant)">passive</a></span></p>
|
||
|
||
|
||
</div>
|
||
</div>
|
||
<div class="tags">
|
||
|
||
<p class="tag_title">Returns:</p>
|
||
<ul class="return">
|
||
|
||
<li>
|
||
|
||
|
||
<span class='type'>(<tt>Boolean</tt>)</span>
|
||
|
||
|
||
|
||
</li>
|
||
|
||
</ul>
|
||
|
||
</div><table class="source_code">
|
||
<tr>
|
||
<td>
|
||
<pre class="lines">
|
||
|
||
|
||
127
|
||
128
|
||
129</pre>
|
||
</td>
|
||
<td>
|
||
<pre class="code"><span class="info file"># File 'lib/msf/core/session_compatibility.rb', line 127</span>
|
||
|
||
<span class='kw'>def</span> <span class='id identifier rubyid_passive?'>passive?</span>
|
||
<span class='id identifier rubyid_passive'>passive</span>
|
||
<span class='kw'>end</span></pre>
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
</div>
|
||
|
||
<div class="method_details ">
|
||
<h3 class="signature " id="post_commands-instance_method">
|
||
|
||
#<strong>post_commands</strong> ⇒ <tt>Object</tt>
|
||
|
||
|
||
|
||
|
||
|
||
</h3><div class="docstring">
|
||
<div class="discussion">
|
||
|
||
<p>Can be overridden by individual modules to add new commands</p>
|
||
|
||
|
||
</div>
|
||
</div>
|
||
<div class="tags">
|
||
|
||
|
||
</div><table class="source_code">
|
||
<tr>
|
||
<td>
|
||
<pre class="lines">
|
||
|
||
|
||
122
|
||
123
|
||
124</pre>
|
||
</td>
|
||
<td>
|
||
<pre class="code"><span class="info file"># File 'lib/msf/core/session_compatibility.rb', line 122</span>
|
||
|
||
<span class='kw'>def</span> <span class='id identifier rubyid_post_commands'>post_commands</span>
|
||
<span class='lbrace'>{</span><span class='rbrace'>}</span>
|
||
<span class='kw'>end</span></pre>
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
</div>
|
||
|
||
<div class="method_details ">
|
||
<h3 class="signature " id="session-instance_method">
|
||
|
||
#<strong>session</strong> ⇒ <tt><span class='object_link'><a href="Session.html" title="Msf::Session (module)">Msf::Session</a></span></tt><sup>?</sup>
|
||
|
||
|
||
|
||
<span class="aliases">Also known as:
|
||
<span class="names"><span id='client-instance_method'>client</span></span>
|
||
</span>
|
||
|
||
|
||
|
||
</h3><div class="docstring">
|
||
<div class="discussion">
|
||
|
||
<p>Return the associated session or nil if there isn’t one</p>
|
||
|
||
|
||
</div>
|
||
</div>
|
||
<div class="tags">
|
||
|
||
<p class="tag_title">Returns:</p>
|
||
<ul class="return">
|
||
|
||
<li>
|
||
|
||
|
||
<span class='type'>(<tt><span class='object_link'><a href="Session.html" title="Msf::Session (module)">Msf::Session</a></span></tt>)</span>
|
||
|
||
|
||
|
||
</li>
|
||
|
||
<li>
|
||
|
||
|
||
<span class='type'>(<tt>nil</tt>)</span>
|
||
|
||
|
||
|
||
—
|
||
<div class='inline'>
|
||
<p>if the id provided in the datastore does not correspond to a session</p>
|
||
</div>
|
||
|
||
</li>
|
||
|
||
</ul>
|
||
|
||
</div><table class="source_code">
|
||
<tr>
|
||
<td>
|
||
<pre class="lines">
|
||
|
||
|
||
87
|
||
88
|
||
89
|
||
90
|
||
91
|
||
92
|
||
93
|
||
94
|
||
95
|
||
96
|
||
97
|
||
98</pre>
|
||
</td>
|
||
<td>
|
||
<pre class="code"><span class="info file"># File 'lib/msf/core/session_compatibility.rb', line 87</span>
|
||
|
||
<span class='kw'>def</span> <span class='id identifier rubyid_session'>session</span>
|
||
<span class='comment'># Try the cached one
|
||
</span> <span class='kw'>return</span> <span class='ivar'>@session</span> <span class='kw'>if</span> <span class='ivar'>@session</span> <span class='op'>&&</span> <span class='op'>!</span><span class='id identifier rubyid_session_changed?'>session_changed?</span>
|
||
|
||
<span class='kw'>if</span> <span class='id identifier rubyid_datastore'>datastore</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>SESSION</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span>
|
||
<span class='ivar'>@session</span> <span class='op'>=</span> <span class='id identifier rubyid_framework'>framework</span><span class='period'>.</span><span class='id identifier rubyid_sessions'>sessions</span><span class='period'>.</span><span class='id identifier rubyid_get'>get</span><span class='lparen'>(</span><span class='id identifier rubyid_datastore'>datastore</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>SESSION</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_to_i'>to_i</span><span class='rparen'>)</span>
|
||
<span class='kw'>else</span>
|
||
<span class='ivar'>@session</span> <span class='op'>=</span> <span class='kw'>nil</span>
|
||
<span class='kw'>end</span>
|
||
|
||
<span class='ivar'>@session</span>
|
||
<span class='kw'>end</span></pre>
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
</div>
|
||
|
||
<div class="method_details ">
|
||
<h3 class="signature " id="session_changed?-instance_method">
|
||
|
||
#<strong>session_changed?</strong> ⇒ <tt>Boolean</tt> <span class="extras">(protected)</span>
|
||
|
||
|
||
|
||
|
||
|
||
</h3><div class="docstring">
|
||
<div class="discussion">
|
||
|
||
|
||
</div>
|
||
</div>
|
||
<div class="tags">
|
||
|
||
<p class="tag_title">Returns:</p>
|
||
<ul class="return">
|
||
|
||
<li>
|
||
|
||
|
||
<span class='type'>(<tt>Boolean</tt>)</span>
|
||
|
||
|
||
|
||
</li>
|
||
|
||
</ul>
|
||
|
||
</div><table class="source_code">
|
||
<tr>
|
||
<td>
|
||
<pre class="lines">
|
||
|
||
|
||
244
|
||
245
|
||
246
|
||
247
|
||
248
|
||
249
|
||
250
|
||
251
|
||
252
|
||
253</pre>
|
||
</td>
|
||
<td>
|
||
<pre class="code"><span class="info file"># File 'lib/msf/core/session_compatibility.rb', line 244</span>
|
||
|
||
<span class='kw'>def</span> <span class='id identifier rubyid_session_changed?'>session_changed?</span>
|
||
<span class='ivar'>@ds_session</span> <span class='op'>||=</span> <span class='id identifier rubyid_datastore'>datastore</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>SESSION</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span>
|
||
|
||
<span class='kw'>if</span> <span class='lparen'>(</span><span class='ivar'>@ds_session</span> <span class='op'>!=</span> <span class='id identifier rubyid_datastore'>datastore</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>SESSION</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='rparen'>)</span>
|
||
<span class='ivar'>@ds_session</span> <span class='op'>=</span> <span class='kw'>nil</span>
|
||
<span class='kw'>return</span> <span class='kw'>true</span>
|
||
<span class='kw'>else</span>
|
||
<span class='kw'>return</span> <span class='kw'>false</span>
|
||
<span class='kw'>end</span>
|
||
<span class='kw'>end</span></pre>
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
</div>
|
||
|
||
<div class="method_details ">
|
||
<h3 class="signature " id="session_compatible?-instance_method">
|
||
|
||
#<strong>session_compatible?</strong>(sess_or_sid) ⇒ <tt>Boolean</tt>
|
||
|
||
|
||
|
||
|
||
|
||
</h3><div class="docstring">
|
||
<div class="discussion">
|
||
|
||
<div class="note notetag">
|
||
<strong>Note:</strong>
|
||
<div class='inline'>
|
||
<p>Because it errs on the side of compatibility, a true return value from this method does not guarantee the module will work with the session. For example, ARCH_CMD modules can work on a variety of platforms and archs and thus return true in this check.</p>
|
||
</div>
|
||
</div>
|
||
|
||
|
||
<p>Return false if the given session is not compatible with this module</p>
|
||
|
||
<p>Checks the session’s type against this module’s <code>module_info["SessionTypes"]</code> as well as examining platform and arch compatibility.</p>
|
||
|
||
<p><code>sess_or_sid</code> can be a Session object, Integer, or String. In the latter cases it should be a key in <code>framework.sessions</code>.</p>
|
||
|
||
|
||
</div>
|
||
</div>
|
||
<div class="tags">
|
||
<p class="tag_title">Parameters:</p>
|
||
<ul class="param">
|
||
|
||
<li>
|
||
|
||
<span class='name'>sess_or_sid</span>
|
||
|
||
|
||
<span class='type'>(<tt><span class='object_link'><a href="Session.html" title="Msf::Session (module)">Msf::Session</a></span></tt>, <tt>Integer</tt>, <tt>String</tt>)</span>
|
||
|
||
|
||
|
||
—
|
||
<div class='inline'>
|
||
<p>A session or session ID to compare against this module for compatibility.</p>
|
||
</div>
|
||
|
||
</li>
|
||
|
||
</ul>
|
||
|
||
<p class="tag_title">Returns:</p>
|
||
<ul class="return">
|
||
|
||
<li>
|
||
|
||
|
||
<span class='type'>(<tt>Boolean</tt>)</span>
|
||
|
||
|
||
|
||
</li>
|
||
|
||
</ul>
|
||
|
||
</div><table class="source_code">
|
||
<tr>
|
||
<td>
|
||
<pre class="lines">
|
||
|
||
|
||
163
|
||
164
|
||
165</pre>
|
||
</td>
|
||
<td>
|
||
<pre class="code"><span class="info file"># File 'lib/msf/core/session_compatibility.rb', line 163</span>
|
||
|
||
<span class='kw'>def</span> <span class='id identifier rubyid_session_compatible?'>session_compatible?</span><span class='lparen'>(</span><span class='id identifier rubyid_sess_or_sid'>sess_or_sid</span><span class='rparen'>)</span>
|
||
<span class='id identifier rubyid_session_incompatibility_reasons'>session_incompatibility_reasons</span><span class='lparen'>(</span><span class='id identifier rubyid_sess_or_sid'>sess_or_sid</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span>
|
||
<span class='kw'>end</span></pre>
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
</div>
|
||
|
||
<div class="method_details ">
|
||
<h3 class="signature " id="session_display_info-instance_method">
|
||
|
||
#<strong>session_display_info</strong> ⇒ <tt>Object</tt>
|
||
|
||
|
||
|
||
|
||
|
||
</h3><table class="source_code">
|
||
<tr>
|
||
<td>
|
||
<pre class="lines">
|
||
|
||
|
||
100
|
||
101
|
||
102</pre>
|
||
</td>
|
||
<td>
|
||
<pre class="code"><span class="info file"># File 'lib/msf/core/session_compatibility.rb', line 100</span>
|
||
|
||
<span class='kw'>def</span> <span class='id identifier rubyid_session_display_info'>session_display_info</span>
|
||
<span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Session: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_session'>session</span><span class='period'>.</span><span class='id identifier rubyid_sid'>sid</span><span class='embexpr_end'>}</span><span class='tstring_content'> (</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_session'>session</span><span class='period'>.</span><span class='id identifier rubyid_session_host'>session_host</span><span class='embexpr_end'>}</span><span class='tstring_content'>)</span><span class='tstring_end'>"</span></span>
|
||
<span class='kw'>end</span></pre>
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
</div>
|
||
|
||
<div class="method_details ">
|
||
<h3 class="signature " id="session_incompatibility_reasons-instance_method">
|
||
|
||
#<strong>session_incompatibility_reasons</strong>(sess_or_sid) ⇒ <tt>Object</tt>
|
||
|
||
|
||
|
||
|
||
|
||
</h3><div class="docstring">
|
||
<div class="discussion">
|
||
|
||
<p>Return the reasons why a session is incompatible.</p>
|
||
|
||
|
||
</div>
|
||
</div>
|
||
<div class="tags">
|
||
|
||
|
||
</div><table class="source_code">
|
||
<tr>
|
||
<td>
|
||
<pre class="lines">
|
||
|
||
|
||
171
|
||
172
|
||
173
|
||
174
|
||
175
|
||
176
|
||
177
|
||
178
|
||
179
|
||
180
|
||
181
|
||
182
|
||
183
|
||
184
|
||
185
|
||
186
|
||
187
|
||
188
|
||
189
|
||
190
|
||
191
|
||
192
|
||
193
|
||
194
|
||
195
|
||
196
|
||
197
|
||
198
|
||
199
|
||
200
|
||
201
|
||
202
|
||
203
|
||
204
|
||
205
|
||
206
|
||
207
|
||
208
|
||
209
|
||
210
|
||
211
|
||
212
|
||
213
|
||
214
|
||
215
|
||
216
|
||
217
|
||
218
|
||
219
|
||
220
|
||
221
|
||
222
|
||
223
|
||
224
|
||
225</pre>
|
||
</td>
|
||
<td>
|
||
<pre class="code"><span class="info file"># File 'lib/msf/core/session_compatibility.rb', line 171</span>
|
||
|
||
<span class='kw'>def</span> <span class='id identifier rubyid_session_incompatibility_reasons'>session_incompatibility_reasons</span><span class='lparen'>(</span><span class='id identifier rubyid_sess_or_sid'>sess_or_sid</span><span class='rparen'>)</span>
|
||
<span class='comment'># Normalize the argument to an actual Session
|
||
</span> <span class='kw'>case</span> <span class='id identifier rubyid_sess_or_sid'>sess_or_sid</span>
|
||
<span class='kw'>when</span> <span class='op'>::</span><span class='const'>Integer</span><span class='comma'>,</span> <span class='op'>::</span><span class='const'>String</span>
|
||
<span class='id identifier rubyid_s'>s</span> <span class='op'>=</span> <span class='id identifier rubyid_framework'>framework</span><span class='period'>.</span><span class='id identifier rubyid_sessions'>sessions</span><span class='lbracket'>[</span><span class='id identifier rubyid_sess_or_sid'>sess_or_sid</span><span class='period'>.</span><span class='id identifier rubyid_to_i'>to_i</span><span class='rbracket'>]</span>
|
||
<span class='kw'>when</span> <span class='op'>::</span><span class='const'><span class='object_link'><a href="../Msf.html" title="Msf (module)">Msf</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Session.html" title="Msf::Session (module)">Session</a></span></span>
|
||
<span class='id identifier rubyid_s'>s</span> <span class='op'>=</span> <span class='id identifier rubyid_sess_or_sid'>sess_or_sid</span>
|
||
<span class='kw'>when</span> <span class='kw'>nil</span>
|
||
<span class='comment'># No session provided
|
||
</span> <span class='kw'>return</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
|
||
<span class='kw'>end</span>
|
||
|
||
<span class='id identifier rubyid_issues'>issues</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
|
||
|
||
<span class='comment'># Can't do anything without a session
|
||
</span> <span class='kw'>unless</span> <span class='id identifier rubyid_s'>s</span>
|
||
<span class='id identifier rubyid_issues'>issues</span> <span class='op'><<</span> <span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>invalid session</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span>
|
||
<span class='kw'>return</span> <span class='id identifier rubyid_issues'>issues</span>
|
||
<span class='kw'>end</span>
|
||
|
||
<span class='comment'># Can't be compatible if it's the wrong type
|
||
</span> <span class='kw'>if</span> <span class='id identifier rubyid_session_types'>session_types</span> <span class='op'>&&</span> <span class='op'>!</span><span class='id identifier rubyid_session_types'>session_types</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span><span class='lparen'>(</span><span class='id identifier rubyid_s'>s</span><span class='period'>.</span><span class='id identifier rubyid_type'>type</span><span class='rparen'>)</span>
|
||
<span class='id identifier rubyid_issues'>issues</span> <span class='op'><<</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>incompatible session type: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_s'>s</span><span class='period'>.</span><span class='id identifier rubyid_type'>type</span><span class='embexpr_end'>}</span><span class='tstring_content'>. This module works with: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_session_types'>session_types</span><span class='period'>.</span><span class='id identifier rubyid_join'>join</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>, </span><span class='tstring_end'>'</span></span><span class='rparen'>)</span><span class='embexpr_end'>}</span><span class='tstring_content'>.</span><span class='tstring_end'>"</span></span>
|
||
<span class='kw'>end</span>
|
||
|
||
<span class='comment'># Check to make sure architectures match
|
||
</span> <span class='id identifier rubyid_mod_arch'>mod_arch</span> <span class='op'>=</span> <span class='id identifier rubyid_module_info'>module_info</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Arch</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span>
|
||
|
||
<span class='kw'>if</span> <span class='id identifier rubyid_mod_arch'>mod_arch</span>
|
||
<span class='kw'>if</span> <span class='id identifier rubyid_s'>s</span><span class='period'>.</span><span class='id identifier rubyid_arch'>arch</span><span class='period'>.</span><span class='id identifier rubyid_blank?'>blank?</span>
|
||
<span class='id identifier rubyid_issues'>issues</span> <span class='op'><<</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Unknown session arch</span><span class='tstring_end'>'</span></span>
|
||
<span class='kw'>else</span>
|
||
<span class='id identifier rubyid_mod_arch'>mod_arch</span> <span class='op'>=</span> <span class='const'>Array</span><span class='period'>.</span><span class='id identifier rubyid_wrap'>wrap</span><span class='lparen'>(</span><span class='id identifier rubyid_mod_arch'>mod_arch</span><span class='rparen'>)</span>
|
||
<span class='comment'># Assume ARCH_CMD modules can work on supported SessionTypes since both shell and meterpreter types can execute commands
|
||
</span> <span class='id identifier rubyid_issues'>issues</span> <span class='op'><<</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>incompatible session architecture: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_s'>s</span><span class='period'>.</span><span class='id identifier rubyid_arch'>arch</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span> <span class='kw'>unless</span> <span class='id identifier rubyid_mod_arch'>mod_arch</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span><span class='lparen'>(</span><span class='id identifier rubyid_s'>s</span><span class='period'>.</span><span class='id identifier rubyid_arch'>arch</span><span class='rparen'>)</span> <span class='op'>||</span> <span class='id identifier rubyid_mod_arch'>mod_arch</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span><span class='lparen'>(</span><span class='const'>ARCH_CMD</span><span class='rparen'>)</span>
|
||
<span class='kw'>end</span>
|
||
<span class='kw'>end</span>
|
||
|
||
<span class='comment'># Arch is okay, now check the platform.
|
||
</span>
|
||
<span class='kw'>if</span> <span class='id identifier rubyid_platform'>platform</span> <span class='op'>&&</span> <span class='id identifier rubyid_platform'>platform</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'><span class='object_link'><a href="../Msf.html" title="Msf (module)">Msf</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Module.html" title="Msf::Module (class)">Module</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Module/PlatformList.html" title="Msf::Module::PlatformList (class)">PlatformList</a></span></span><span class='rparen'>)</span> <span class='op'>&&</span> <span class='op'>!</span><span class='id identifier rubyid_platform'>platform</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span>
|
||
<span class='kw'>if</span> <span class='id identifier rubyid_s'>s</span><span class='period'>.</span><span class='id identifier rubyid_platform'>platform</span><span class='period'>.</span><span class='id identifier rubyid_blank?'>blank?</span>
|
||
<span class='id identifier rubyid_issues'>issues</span> <span class='op'><<</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>Unknown session platform. This module works with: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_platform'>platform</span><span class='period'>.</span><span class='id identifier rubyid_names'>names</span><span class='period'>.</span><span class='id identifier rubyid_join'>join</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>, </span><span class='tstring_end'>'</span></span><span class='rparen'>)</span><span class='embexpr_end'>}</span><span class='tstring_content'>.</span><span class='tstring_end'>"</span></span>
|
||
<span class='kw'>elsif</span> <span class='op'>!</span><span class='id identifier rubyid_platform'>platform</span><span class='period'>.</span><span class='id identifier rubyid_supports?'>supports?</span><span class='lparen'>(</span><span class='const'><span class='object_link'><a href="../Msf.html" title="Msf (module)">Msf</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Module.html" title="Msf::Module (class)">Module</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Module/PlatformList.html" title="Msf::Module::PlatformList (class)">PlatformList</a></span></span><span class='period'>.</span><span class='id identifier rubyid_transform'><span class='object_link'><a href="Module/PlatformList.html#transform-class_method" title="Msf::Module::PlatformList.transform (method)">transform</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_s'>s</span><span class='period'>.</span><span class='id identifier rubyid_platform'>platform</span><span class='rparen'>)</span><span class='rparen'>)</span>
|
||
<span class='id identifier rubyid_issues'>issues</span> <span class='op'><<</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>incompatible session platform: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_s'>s</span><span class='period'>.</span><span class='id identifier rubyid_platform'>platform</span><span class='embexpr_end'>}</span><span class='tstring_content'>. This module works with: </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_platform'>platform</span> <span class='op'>?</span> <span class='id identifier rubyid_platform'>platform</span><span class='period'>.</span><span class='id identifier rubyid_names'>names</span><span class='period'>.</span><span class='id identifier rubyid_join'>join</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>, </span><span class='tstring_end'>'</span></span><span class='rparen'>)</span> <span class='op'>:</span> <span class='id identifier rubyid_platform'>platform</span><span class='period'>.</span><span class='id identifier rubyid_inspect'>inspect</span><span class='embexpr_end'>}</span><span class='tstring_content'>.</span><span class='tstring_end'>"</span></span>
|
||
<span class='kw'>end</span>
|
||
<span class='kw'>end</span>
|
||
|
||
<span class='comment'># Check all specified meterpreter commands are provided by the remote session
|
||
</span> <span class='kw'>if</span> <span class='id identifier rubyid_s'>s</span><span class='period'>.</span><span class='id identifier rubyid_type'>type</span> <span class='op'>==</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>meterpreter</span><span class='tstring_end'>'</span></span>
|
||
<span class='id identifier rubyid_issues'>issues</span> <span class='op'>+=</span> <span class='id identifier rubyid_meterpreter_session_incompatibility_reasons'>meterpreter_session_incompatibility_reasons</span><span class='lparen'>(</span><span class='id identifier rubyid_s'>s</span><span class='rparen'>)</span>
|
||
<span class='kw'>end</span>
|
||
|
||
<span class='id identifier rubyid_issues'>issues</span>
|
||
<span class='kw'>end</span></pre>
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
</div>
|
||
|
||
<div class="method_details ">
|
||
<h3 class="signature " id="setup-instance_method">
|
||
|
||
#<strong>setup</strong> ⇒ <tt>Object</tt>
|
||
|
||
|
||
|
||
|
||
|
||
</h3><div class="docstring">
|
||
<div class="discussion">
|
||
|
||
<p>Grabs a session object from the framework or raises <span class='object_link'><a href="OptionValidateError.html" title="Msf::OptionValidateError (class)">OptionValidateError</a></span> if one doesn’t exist and is required. Initializes user input and output on the session.</p>
|
||
|
||
|
||
</div>
|
||
</div>
|
||
<div class="tags">
|
||
|
||
<p class="tag_title">Raises:</p>
|
||
<ul class="raise">
|
||
|
||
<li>
|
||
|
||
|
||
<span class='type'>(<tt><span class='object_link'><a href="OptionValidateError.html" title="Msf::OptionValidateError (class)">OptionValidateError</a></span></tt>)</span>
|
||
|
||
|
||
|
||
—
|
||
<div class='inline'>
|
||
<p>if <span class='object_link'><a href="#session-instance_method" title="Msf::SessionCompatibility#session (method)">#session</a></span> returns nil</p>
|
||
</div>
|
||
|
||
</li>
|
||
|
||
</ul>
|
||
|
||
</div><table class="source_code">
|
||
<tr>
|
||
<td>
|
||
<pre class="lines">
|
||
|
||
|
||
23
|
||
24
|
||
25
|
||
26
|
||
27
|
||
28
|
||
29
|
||
30
|
||
31
|
||
32
|
||
33
|
||
34
|
||
35
|
||
36
|
||
37
|
||
38
|
||
39
|
||
40
|
||
41
|
||
42
|
||
43
|
||
44
|
||
45
|
||
46
|
||
47
|
||
48
|
||
49
|
||
50
|
||
51
|
||
52
|
||
53</pre>
|
||
</td>
|
||
<td>
|
||
<pre class="code"><span class="info file"># File 'lib/msf/core/session_compatibility.rb', line 23</span>
|
||
|
||
<span class='kw'>def</span> <span class='id identifier rubyid_setup'>setup</span>
|
||
<span class='id identifier rubyid_alert_user'>alert_user</span>
|
||
|
||
<span class='kw'>if</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>SESSION</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='op'>&.</span><span class='id identifier rubyid_required'>required</span> <span class='op'>&&</span> <span class='id identifier rubyid_session'>session</span><span class='period'>.</span><span class='id identifier rubyid_blank?'>blank?</span>
|
||
<span class='id identifier rubyid_raise'>raise</span> <span class='const'><span class='object_link'><a href="../Msf.html" title="Msf (module)">Msf</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="OptionValidateError.html" title="Msf::OptionValidateError (class)">OptionValidateError</a></span></span><span class='comma'>,</span> <span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>SESSION</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span>
|
||
<span class='kw'>end</span>
|
||
|
||
<span class='kw'>if</span> <span class='id identifier rubyid_datastore'>datastore</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>SESSION</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span> <span class='op'>&&</span> <span class='id identifier rubyid_session'>session</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
|
||
<span class='id identifier rubyid_raise'>raise</span> <span class='const'><span class='object_link'><a href="../Msf.html" title="Msf (module)">Msf</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="OptionValidateError.html" title="Msf::OptionValidateError (class)">OptionValidateError</a></span></span><span class='comma'>,</span> <span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>SESSION</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span>
|
||
<span class='kw'>end</span>
|
||
|
||
<span class='comment'># Msf::Exploit#setup for exploits, NoMethodError for post modules
|
||
</span> <span class='kw'>super</span> <span class='kw'>rescue</span> <span class='const'>NoMethodError</span>
|
||
|
||
<span class='kw'>return</span> <span class='kw'>unless</span> <span class='id identifier rubyid_session'>session</span>
|
||
|
||
<span class='comment'># Check session readiness before compatibility so the session can be queried
|
||
</span> <span class='comment'># for its platform, capabilities, etc.
|
||
</span> <span class='id identifier rubyid_check_for_session_readiness'>check_for_session_readiness</span> <span class='kw'>if</span> <span class='id identifier rubyid_session'>session</span><span class='period'>.</span><span class='id identifier rubyid_type'>type</span> <span class='op'>==</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>meterpreter</span><span class='tstring_end'>"</span></span>
|
||
|
||
<span class='id identifier rubyid_incompatibility_reasons'>incompatibility_reasons</span> <span class='op'>=</span> <span class='id identifier rubyid_session_incompatibility_reasons'>session_incompatibility_reasons</span><span class='lparen'>(</span><span class='id identifier rubyid_session'>session</span><span class='rparen'>)</span>
|
||
<span class='kw'>if</span> <span class='id identifier rubyid_incompatibility_reasons'>incompatibility_reasons</span><span class='period'>.</span><span class='id identifier rubyid_any?'>any?</span>
|
||
<span class='id identifier rubyid_print_warning'>print_warning</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>SESSION may not be compatible with this module:</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
|
||
<span class='id identifier rubyid_incompatibility_reasons'>incompatibility_reasons</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_reason'>reason</span><span class='op'>|</span>
|
||
<span class='id identifier rubyid_print_warning'>print_warning</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'> * </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_reason'>reason</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span>
|
||
<span class='kw'>end</span>
|
||
<span class='kw'>end</span>
|
||
|
||
<span class='ivar'>@session</span><span class='period'>.</span><span class='id identifier rubyid_init_ui'>init_ui</span><span class='lparen'>(</span><span class='id identifier rubyid_user_input'>user_input</span><span class='comma'>,</span> <span class='id identifier rubyid_user_output'>user_output</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='ivar'>@session</span>
|
||
<span class='ivar'>@sysinfo</span> <span class='op'>=</span> <span class='kw'>nil</span>
|
||
<span class='kw'>end</span></pre>
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
</div>
|
||
|
||
<div class="method_details ">
|
||
<h3 class="signature " id="sysinfo-instance_method">
|
||
|
||
#<strong>sysinfo</strong> ⇒ <tt>Hash</tt><sup>?</sup>
|
||
|
||
|
||
|
||
|
||
|
||
</h3><div class="docstring">
|
||
<div class="discussion">
|
||
|
||
<p>Cached sysinfo, returns nil for non-meterpreter sessions</p>
|
||
|
||
|
||
</div>
|
||
</div>
|
||
<div class="tags">
|
||
|
||
<p class="tag_title">Returns:</p>
|
||
<ul class="return">
|
||
|
||
<li>
|
||
|
||
|
||
<span class='type'>(<tt>Hash</tt>, <tt>nil</tt>)</span>
|
||
|
||
|
||
|
||
</li>
|
||
|
||
</ul>
|
||
|
||
</div><table class="source_code">
|
||
<tr>
|
||
<td>
|
||
<pre class="lines">
|
||
|
||
|
||
110
|
||
111
|
||
112
|
||
113
|
||
114
|
||
115
|
||
116
|
||
117</pre>
|
||
</td>
|
||
<td>
|
||
<pre class="code"><span class="info file"># File 'lib/msf/core/session_compatibility.rb', line 110</span>
|
||
|
||
<span class='kw'>def</span> <span class='id identifier rubyid_sysinfo'>sysinfo</span>
|
||
<span class='kw'>begin</span>
|
||
<span class='ivar'>@sysinfo</span> <span class='op'>||=</span> <span class='id identifier rubyid_session'>session</span><span class='period'>.</span><span class='id identifier rubyid_sys'>sys</span><span class='period'>.</span><span class='id identifier rubyid_config'>config</span><span class='period'>.</span><span class='id identifier rubyid_sysinfo'>sysinfo</span>
|
||
<span class='kw'>rescue</span> <span class='const'>NoMethodError</span>
|
||
<span class='ivar'>@sysinfo</span> <span class='op'>=</span> <span class='kw'>nil</span>
|
||
<span class='kw'>end</span>
|
||
<span class='ivar'>@sysinfo</span>
|
||
<span class='kw'>end</span></pre>
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
</div>
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div id="footer">
|
||
Generated on Fri May 8 17:01:44 2026 by
|
||
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
||
0.9.37 (ruby-3.1.5).
|
||
</div>
|
||
|
||
</div>
|
||
</body>
|
||
</html> |