345 lines
12 KiB
HTML
345 lines
12 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>
|
|
Module: Msf::Exploit::SQLi::BooleanBasedBlindMixin
|
|
|
|
— 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::Exploit::SQLi::BooleanBasedBlindMixin";
|
|
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 (B)</a> »
|
|
<span class='title'><span class='object_link'><a href="../../../Msf.html" title="Msf (module)">Msf</a></span></span> » <span class='title'><span class='object_link'><a href="../../Exploit.html" title="Msf::Exploit (class)">Exploit</a></span></span> » <span class='title'><span class='object_link'><a href="../SQLi.html" title="Msf::Exploit::SQLi (module)">SQLi</a></span></span>
|
|
»
|
|
<span class="title">BooleanBasedBlindMixin</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::Exploit::SQLi::BooleanBasedBlindMixin
|
|
|
|
|
|
|
|
</h1>
|
|
<div class="box_info">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<dl>
|
|
<dt>Included in:</dt>
|
|
<dd><span class='object_link'><a href="Mssqli/BooleanBasedBlind.html" title="Msf::Exploit::SQLi::Mssqli::BooleanBasedBlind (class)">Mssqli::BooleanBasedBlind</a></span>, <span class='object_link'><a href="MySQLi/BooleanBasedBlind.html" title="Msf::Exploit::SQLi::MySQLi::BooleanBasedBlind (class)">MySQLi::BooleanBasedBlind</a></span>, <span class='object_link'><a href="PostgreSQLi/BooleanBasedBlind.html" title="Msf::Exploit::SQLi::PostgreSQLi::BooleanBasedBlind (class)">PostgreSQLi::BooleanBasedBlind</a></span>, <span class='object_link'><a href="SQLitei/BooleanBasedBlind.html" title="Msf::Exploit::SQLi::SQLitei::BooleanBasedBlind (class)">SQLitei::BooleanBasedBlind</a></span></dd>
|
|
</dl>
|
|
|
|
|
|
|
|
<dl>
|
|
<dt>Defined in:</dt>
|
|
<dd>lib/msf/core/exploit/sqli/boolean_based_blind_mixin.rb</dd>
|
|
</dl>
|
|
|
|
</div>
|
|
|
|
<h2>Overview</h2><div class="docstring">
|
|
<div class="discussion">
|
|
|
|
<p>This mixin provides some methods used by boolean-based blind SQL injection implementations that are the same across implementations.</p>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
<div class="tags">
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<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="#blind_request-instance_method" title="#blind_request (instance method)">#<strong>blind_request</strong>(query) ⇒ Object </a>
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<span class="summary_desc"><div class='inline'>
|
|
<p>Performs one request, should leak one bit of information (if return value is not false or nil, 1, 0 otherwise).</p>
|
|
</div></span>
|
|
|
|
</li>
|
|
|
|
|
|
<li class="public ">
|
|
<span class="summary_signature">
|
|
|
|
<a href="#run_sql-instance_method" title="#run_sql (instance method)">#<strong>run_sql</strong>(query, output_charset: nil) ⇒ Object </a>
|
|
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<span class="summary_desc"><div class='inline'>
|
|
<p>Gets the output of the given SQL query, in a boolean-based blind manner.</p>
|
|
</div></span>
|
|
|
|
</li>
|
|
|
|
|
|
</ul>
|
|
|
|
|
|
|
|
|
|
<div id="instance_method_details" class="method_details_list">
|
|
<h2>Instance Method Details</h2>
|
|
|
|
|
|
<div class="method_details first">
|
|
<h3 class="signature first" id="blind_request-instance_method">
|
|
|
|
#<strong>blind_request</strong>(query) ⇒ <tt>Object</tt>
|
|
|
|
|
|
|
|
|
|
|
|
</h3><div class="docstring">
|
|
<div class="discussion">
|
|
|
|
<p>Performs one request, should leak one bit of information (if return value is not false or nil, 1, 0 otherwise)</p>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
<div class="tags">
|
|
<p class="tag_title">Parameters:</p>
|
|
<ul class="param">
|
|
|
|
<li>
|
|
|
|
<span class='name'>query</span>
|
|
|
|
|
|
<span class='type'>(<tt>String</tt>)</span>
|
|
|
|
|
|
|
|
—
|
|
<div class='inline'>
|
|
<p>The SQL query to run</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
<p class="tag_title">Returns:</p>
|
|
<ul class="return">
|
|
|
|
<li>
|
|
|
|
|
|
<span class='type'>(<tt>Object</tt>)</span>
|
|
|
|
|
|
|
|
—
|
|
<div class='inline'>
|
|
<p>should return a true value if the query returned a result, false or nil otherwise</p>
|
|
</div>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div><table class="source_code">
|
|
<tr>
|
|
<td>
|
|
<pre class="lines">
|
|
|
|
|
|
44
|
|
45
|
|
46</pre>
|
|
</td>
|
|
<td>
|
|
<pre class="code"><span class="info file"># File 'lib/msf/core/exploit/sqli/boolean_based_blind_mixin.rb', line 44</span>
|
|
|
|
<span class='kw'>def</span> <span class='id identifier rubyid_blind_request'>blind_request</span><span class='lparen'>(</span><span class='id identifier rubyid_query'>query</span><span class='rparen'>)</span>
|
|
<span class='ivar'>@query_proc</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span><span class='lparen'>(</span><span class='id identifier rubyid_query'>query</span><span class='rparen'>)</span>
|
|
<span class='kw'>end</span></pre>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
|
|
<div class="method_details ">
|
|
<h3 class="signature " id="run_sql-instance_method">
|
|
|
|
#<strong>run_sql</strong>(query, output_charset: nil) ⇒ <tt>Object</tt>
|
|
|
|
|
|
|
|
|
|
|
|
</h3><div class="docstring">
|
|
<div class="discussion">
|
|
|
|
<p>Gets the output of the given SQL query, in a boolean-based blind manner.</p>
|
|
|
|
<pre class="code ruby"><code class="ruby">The block given to initialize must return true if querying its parameter
|
|
gave a result, false otherwise.
|
|
@param query [String] The SQL query to execute
|
|
@param output_charset [Range] The range of characters to expect in the output, optional
|
|
can improve performance a lot, as fewer bits need to be guessed on each character.
|
|
example : ('0' .. '9') if you know the output of your query contains only numeric characters
|
|
@return [String] The query results
|
|
</code></pre>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
<div class="tags">
|
|
|
|
|
|
</div><table class="source_code">
|
|
<tr>
|
|
<td>
|
|
<pre class="lines">
|
|
|
|
|
|
19
|
|
20
|
|
21
|
|
22
|
|
23
|
|
24
|
|
25
|
|
26
|
|
27
|
|
28
|
|
29
|
|
30
|
|
31
|
|
32
|
|
33
|
|
34
|
|
35
|
|
36</pre>
|
|
</td>
|
|
<td>
|
|
<pre class="code"><span class="info file"># File 'lib/msf/core/exploit/sqli/boolean_based_blind_mixin.rb', line 19</span>
|
|
|
|
<span class='kw'>def</span> <span class='id identifier rubyid_run_sql'>run_sql</span><span class='lparen'>(</span><span class='id identifier rubyid_query'>query</span><span class='comma'>,</span> <span class='label'>output_charset:</span> <span class='kw'>nil</span><span class='rparen'>)</span>
|
|
<span class='kw'>if</span> <span class='id identifier rubyid_output_charset'>output_charset</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>Range</span><span class='rparen'>)</span> <span class='op'>&&</span> <span class='id identifier rubyid_output_charset'>output_charset</span><span class='period'>.</span><span class='id identifier rubyid_count'>count</span> <span class='op'>></span> <span class='int'>0</span>
|
|
<span class='id identifier rubyid_known_bits'>known_bits</span><span class='comma'>,</span> <span class='id identifier rubyid_bits_to_guess'>bits_to_guess</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="../../Exploit.html" title="Msf::Exploit (class)">Exploit</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="../SQLi.html" title="Msf::Exploit::SQLi (module)">SQLi</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Utils.html" title="Msf::Exploit::SQLi::Utils (module)">Utils</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Utils/Common.html" title="Msf::Exploit::SQLi::Utils::Common (module)">Common</a></span></span><span class='period'>.</span><span class='id identifier rubyid_get_bitmask'><span class='object_link'><a href="Utils/Common.html#get_bitmask-class_method" title="Msf::Exploit::SQLi::Utils::Common.get_bitmask (method)">get_bitmask</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_output_charset'>output_charset</span><span class='rparen'>)</span>
|
|
<span class='kw'>else</span>
|
|
<span class='id identifier rubyid_known_bits'>known_bits</span> <span class='op'>=</span> <span class='int'>0</span>
|
|
<span class='id identifier rubyid_bits_to_guess'>bits_to_guess</span> <span class='op'>=</span> <span class='int'>8</span>
|
|
<span class='kw'>end</span>
|
|
<span class='id identifier rubyid_vprint_status'>vprint_status</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>{SQLi} Executing (</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_query'>query</span><span class='embexpr_end'>}</span><span class='tstring_content'>)</span><span class='tstring_end'>"</span></span>
|
|
<span class='kw'>if</span> <span class='ivar'>@hex_encode_strings</span>
|
|
<span class='id identifier rubyid_query'>query</span> <span class='op'>=</span> <span class='id identifier rubyid_hex_encode_strings'>hex_encode_strings</span><span class='lparen'>(</span><span class='id identifier rubyid_query'>query</span><span class='rparen'>)</span>
|
|
<span class='id identifier rubyid_vprint_status'>vprint_status</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>{SQLi} Encoded to (</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_query'>query</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'># first, get the length of the output
|
|
</span> <span class='id identifier rubyid_output_length'>output_length</span> <span class='op'>=</span> <span class='id identifier rubyid_blind_detect_length'>blind_detect_length</span><span class='lparen'>(</span><span class='id identifier rubyid_query'>query</span><span class='comma'>,</span> <span class='kw'>false</span><span class='rparen'>)</span>
|
|
<span class='id identifier rubyid_vprint_status'>vprint_status</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>{SQLi} Boolean-based injection: expecting output of length </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_output_length'>output_length</span><span class='embexpr_end'>}</span><span class='tstring_end'>"</span></span>
|
|
<span class='comment'># now, get the output, of the given length
|
|
</span> <span class='id identifier rubyid_blind_dump_data'>blind_dump_data</span><span class='lparen'>(</span><span class='id identifier rubyid_query'>query</span><span class='comma'>,</span> <span class='id identifier rubyid_output_length'>output_length</span><span class='comma'>,</span> <span class='id identifier rubyid_known_bits'>known_bits</span><span class='comma'>,</span> <span class='id identifier rubyid_bits_to_guess'>bits_to_guess</span><span class='comma'>,</span> <span class='kw'>false</span><span class='rparen'>)</span>
|
|
<span class='kw'>end</span></pre>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div id="footer">
|
|
Generated on Fri May 8 17:02:38 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> |