Files
wpscan/doc_yard/WpItems/Detectable.html
Christian Mehlmauer bf10b25291 docs
2013-07-19 23:10:56 +02:00

1580 lines
51 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>
Module: WpItems::Detectable
&mdash; Documentation by YARD 0.8.5.2
</title>
<link rel="stylesheet" href="../css/style.css" type="text/css" media="screen" charset="utf-8" />
<link rel="stylesheet" href="../css/common.css" type="text/css" media="screen" charset="utf-8" />
<script type="text/javascript" charset="utf-8">
hasFrames = window.top.frames.main ? true : false;
relpath = '../';
framesUrl = "../frames.html#!" + escape(window.location.href);
</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 id="header">
<div id="menu">
<a href="../_index.html">Index (D)</a> &raquo;
<span class='title'><span class='object_link'><a href="../WpItems.html" title="WpItems (class)">WpItems</a></span></span>
&raquo;
<span class="title">Detectable</span>
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
</div>
<div id="search">
<a class="full_list_link" id="class_list_link"
href="../class_list.html">
Class List
</a>
<a class="full_list_link" id="method_list_link"
href="../method_list.html">
Method List
</a>
<a class="full_list_link" id="file_list_link"
href="../file_list.html">
File List
</a>
</div>
<div class="clear"></div>
</div>
<iframe id="search_frame"></iframe>
<div id="content"><h1>Module: WpItems::Detectable
</h1>
<dl class="box">
<dt class="r1">Included in:</dt>
<dd class="r1"><span class='object_link'><a href="../WpItems.html" title="WpItems (class)">WpItems</a></span></dd>
<dt class="r2 last">Defined in:</dt>
<dd class="r2 last">lib/common/collections/wp_items/detectable.rb</dd>
</dl>
<div class="clear"></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="#item_xpath-instance_method" title="#item_xpath (instance method)">- (Object) <strong>item_xpath</strong> </a>
</span>
<span class="note title readonly">readonly</span>
<span class="summary_desc"><div class='inline'>
<p>Returns the value of attribute item_xpath.</p>
</div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#vulns_file-instance_method" title="#vulns_file (instance method)">- (Object) <strong>vulns_file</strong> </a>
</span>
<span class="note title readonly">readonly</span>
<span class="summary_desc"><div class='inline'>
<p>Returns the value of attribute vulns_file.</p>
</div></span>
</li>
</ul>
<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="#aggressive_detection-instance_method" title="#aggressive_detection (instance method)">- (WpItems) <strong>aggressive_detection</strong>(wp_target, options = {}) </a>
</span>
<span class="summary_desc"><div class='inline'></div></span>
</li>
<li class="protected ">
<span class="summary_signature">
<a href="#create_item-instance_method" title="#create_item (instance method)">- (WpItem) <strong>create_item</strong>(klass, name, wp_target, vulns_file = nil) </a>
</span>
<span class="note title protected">protected</span>
<span class="summary_desc"><div class='inline'></div></span>
</li>
<li class="protected ">
<span class="summary_signature">
<a href="#item_class-instance_method" title="#item_class (instance method)">- (Class) <strong>item_class</strong> </a>
</span>
<span class="note title protected">protected</span>
<span class="summary_desc"><div class='inline'></div></span>
</li>
<li class="protected ">
<span class="summary_signature">
<a href="#item_options-instance_method" title="#item_options (instance method)">- (Hash) <strong>item_options</strong>(wp_target) </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="#passive_detection-instance_method" title="#passive_detection (instance method)">- (WpItems) <strong>passive_detection</strong>(wp_target, options = {}) </a>
</span>
<span class="summary_desc"><div class='inline'></div></span>
</li>
<li class="public ">
<span class="summary_signature">
<a href="#progress_bar-instance_method" title="#progress_bar (instance method)">- (ProgressBar) <strong>progress_bar</strong>(targets_size, options) </a>
</span>
<span class="summary_desc"><div class='inline'>
<p>:nocov:.</p>
</div></span>
</li>
<li class="protected ">
<span class="summary_signature">
<a href="#request_params-instance_method" title="#request_params (instance method)">- (Hash) <strong>request_params</strong> </a>
</span>
<span class="note title protected">protected</span>
<span class="summary_desc"><div class='inline'>
<p>The default request parameters.</p>
</div></span>
</li>
<li class="protected ">
<span class="summary_signature">
<a href="#targets_items-instance_method" title="#targets_items (instance method)">- (Array&lt;WpItem&gt;) <strong>targets_items</strong>(wp_target, options = {}) </a>
</span>
<span class="note title protected">protected</span>
<span class="summary_desc"><div class='inline'></div></span>
</li>
<li class="protected ">
<span class="summary_signature">
<a href="#targets_items_from_file-instance_method" title="#targets_items_from_file (instance method)">- (Array&lt;WpItem&gt;) <strong>targets_items_from_file</strong>(file, wp_target, item_class, vulns_file) </a>
</span>
<span class="note title protected">protected</span>
<span class="summary_desc"><div class='inline'></div></span>
</li>
<li class="protected ">
<span class="summary_signature">
<a href="#vulnerable_targets_items-instance_method" title="#vulnerable_targets_items (instance method)">- (Array&lt;WpItem&gt;) <strong>vulnerable_targets_items</strong>(wp_target, item_class, vulns_file) </a>
</span>
<span class="note title protected">protected</span>
<span class="summary_desc"><div class='inline'></div></span>
</li>
</ul>
<div id="instance_attr_details" class="attr_details">
<h2>Instance Attribute Details</h2>
<span id=""></span>
<div class="method_details first">
<h3 class="signature first" id="item_xpath-instance_method">
- (<tt>Object</tt>) <strong>item_xpath</strong> <span class="extras">(readonly)</span>
</h3><div class="docstring">
<div class="discussion">
<p>Returns the value of attribute item_xpath</p>
</div>
</div>
<div class="tags">
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
6
7
8</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/common/collections/wp_items/detectable.rb', line 6</span>
<span class='kw'>def</span> <span class='id identifier rubyid_item_xpath'>item_xpath</span>
<span class='ivar'>@item_xpath</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<span id=""></span>
<div class="method_details ">
<h3 class="signature " id="vulns_file-instance_method">
- (<tt>Object</tt>) <strong>vulns_file</strong> <span class="extras">(readonly)</span>
</h3><div class="docstring">
<div class="discussion">
<p>Returns the value of attribute vulns_file</p>
</div>
</div>
<div class="tags">
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
6
7
8</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/common/collections/wp_items/detectable.rb', line 6</span>
<span class='kw'>def</span> <span class='id identifier rubyid_vulns_file'>vulns_file</span>
<span class='ivar'>@vulns_file</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="aggressive_detection-instance_method">
- (<tt><span class='object_link'><a href="../WpItems.html" title="WpItems (class)">WpItems</a></span></tt>) <strong>aggressive_detection</strong>(wp_target, options = {})
</h3><div class="docstring">
<div class="discussion">
</div>
</div>
<div class="tags">
<p class="tag_title">Parameters:</p>
<ul class="param">
<li>
<span class='name'>wp_target</span>
<span class='type'>(<tt><span class='object_link'><a href="../WpTarget.html" title="WpTarget (class)">WpTarget</a></span></tt>)</span>
</li>
<li>
<span class='name'>options</span>
<span class='type'>(<tt>Hash</tt>)</span>
<em class="default">(defaults to: <tt>{}</tt>)</em>
</li>
</ul>
<p class="tag_title">Options Hash (<tt>options</tt>):</p>
<ul class="option">
<li>
<span class="name">:show_progression</span>
<span class="type">(<tt>Boolean</tt>)</span>
<span class="default">
</span>
&mdash; <div class='inline'>
<p>Whether or not output the progress bar</p>
</div>
</li>
<li>
<span class="name">:only_vulnerable</span>
<span class="type">(<tt>Boolean</tt>)</span>
<span class="default">
</span>
&mdash; <div class='inline'>
<p>Only check for vulnerable items</p>
</div>
</li>
<li>
<span class="name">:exclude_content</span>
<span class="type">(<tt>String</tt>)</span>
<span class="default">
</span>
</li>
</ul>
<p class="tag_title">Returns:</p>
<ul class="return">
<li>
<span class='type'>(<tt><span class='object_link'><a href="../WpItems.html" title="WpItems (class)">WpItems</a></span></tt>)</span>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
15
16
17
18
19
20
21
22
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</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/common/collections/wp_items/detectable.rb', line 15</span>
<span class='kw'>def</span> <span class='id identifier rubyid_aggressive_detection'>aggressive_detection</span><span class='lparen'>(</span><span class='id identifier rubyid_wp_target'>wp_target</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
<span class='id identifier rubyid_browser'>browser</span> <span class='op'>=</span> <span class='const'>Browser</span><span class='period'>.</span><span class='id identifier rubyid_instance'>instance</span>
<span class='id identifier rubyid_hydra'>hydra</span> <span class='op'>=</span> <span class='id identifier rubyid_browser'>browser</span><span class='period'>.</span><span class='id identifier rubyid_hydra'>hydra</span>
<span class='id identifier rubyid_targets'>targets</span> <span class='op'>=</span> <span class='id identifier rubyid_targets_items'>targets_items</span><span class='lparen'>(</span><span class='id identifier rubyid_wp_target'>wp_target</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
<span class='id identifier rubyid_progress_bar'>progress_bar</span> <span class='op'>=</span> <span class='id identifier rubyid_progress_bar'>progress_bar</span><span class='lparen'>(</span><span class='id identifier rubyid_targets'>targets</span><span class='period'>.</span><span class='id identifier rubyid_size'>size</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
<span class='id identifier rubyid_exist_options'>exist_options</span> <span class='op'>=</span> <span class='lbrace'>{</span>
<span class='label'>error_404_hash:</span> <span class='id identifier rubyid_wp_target'>wp_target</span><span class='period'>.</span><span class='id identifier rubyid_error_404_hash'>error_404_hash</span><span class='comma'>,</span>
<span class='label'>homepage_hash:</span> <span class='id identifier rubyid_wp_target'>wp_target</span><span class='period'>.</span><span class='id identifier rubyid_homepage_hash'>homepage_hash</span><span class='comma'>,</span>
<span class='label'>exclude_content:</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:exclude_content</span><span class='rbracket'>]</span> <span class='op'>?</span> <span class='tstring'><span class='regexp_beg'>%r{</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:exclude_content</span><span class='rbracket'>]</span><span class='rbrace'>}</span><span class='regexp_end'>}</span></span> <span class='op'>:</span> <span class='kw'>nil</span>
<span class='rbrace'>}</span>
<span class='comment'># If we only want the vulnerable ones, the passive detection is ignored
</span> <span class='comment'># Otherwise, a passive detection is performed, and results will be merged
</span> <span class='id identifier rubyid_results'>results</span> <span class='op'>=</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:only_vulnerable</span><span class='rbracket'>]</span> <span class='op'>?</span> <span class='id identifier rubyid_new'>new</span> <span class='op'>:</span> <span class='id identifier rubyid_passive_detection'>passive_detection</span><span class='lparen'>(</span><span class='id identifier rubyid_wp_target'>wp_target</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
<span class='id identifier rubyid_targets'>targets</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_target_item'>target_item</span><span class='op'>|</span>
<span class='id identifier rubyid_request'>request</span> <span class='op'>=</span> <span class='id identifier rubyid_browser'>browser</span><span class='period'>.</span><span class='id identifier rubyid_forge_request'>forge_request</span><span class='lparen'>(</span><span class='id identifier rubyid_target_item'>target_item</span><span class='period'>.</span><span class='id identifier rubyid_url'>url</span><span class='comma'>,</span> <span class='id identifier rubyid_request_params'>request_params</span><span class='rparen'>)</span>
<span class='id identifier rubyid_request'>request</span><span class='period'>.</span><span class='id identifier rubyid_on_complete'>on_complete</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_response'>response</span><span class='op'>|</span>
<span class='id identifier rubyid_progress_bar'>progress_bar</span><span class='period'>.</span><span class='id identifier rubyid_progress'>progress</span> <span class='op'>+=</span> <span class='int'>1</span> <span class='kw'>if</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:show_progression</span><span class='rbracket'>]</span>
<span class='kw'>if</span> <span class='id identifier rubyid_target_item'>target_item</span><span class='period'>.</span><span class='id identifier rubyid_exists?'>exists?</span><span class='lparen'>(</span><span class='id identifier rubyid_exist_options'>exist_options</span><span class='comma'>,</span> <span class='id identifier rubyid_response'>response</span><span class='rparen'>)</span>
<span class='kw'>if</span> <span class='op'>!</span><span class='id identifier rubyid_results'>results</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span><span class='lparen'>(</span><span class='id identifier rubyid_target_item'>target_item</span><span class='rparen'>)</span>
<span class='id identifier rubyid_results'>results</span> <span class='op'>&lt;&lt;</span> <span class='id identifier rubyid_target_item'>target_item</span>
<span class='kw'>end</span>
<span class='kw'>end</span>
<span class='kw'>end</span>
<span class='id identifier rubyid_hydra'>hydra</span><span class='period'>.</span><span class='id identifier rubyid_queue'>queue</span><span class='lparen'>(</span><span class='id identifier rubyid_request'>request</span><span class='rparen'>)</span>
<span class='kw'>end</span>
<span class='id identifier rubyid_hydra'>hydra</span><span class='period'>.</span><span class='id identifier rubyid_run'>run</span>
<span class='id identifier rubyid_results'>results</span><span class='period'>.</span><span class='id identifier rubyid_sort!'>sort!</span>
<span class='id identifier rubyid_results'>results</span> <span class='comment'># can't just return results.sort because the #sort returns an array, and we want a WpItems
</span><span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="create_item-instance_method">
- (<tt><span class='object_link'><a href="../WpItem.html" title="WpItem (class)">WpItem</a></span></tt>) <strong>create_item</strong>(klass, name, wp_target, vulns_file = nil) <span class="extras">(protected)</span>
</h3><div class="docstring">
<div class="discussion">
</div>
</div>
<div class="tags">
<p class="tag_title">Parameters:</p>
<ul class="param">
<li>
<span class='name'>klass</span>
<span class='type'>(<tt>Class</tt>)</span>
</li>
<li>
<span class='name'>name</span>
<span class='type'>(<tt>String</tt>)</span>
</li>
<li>
<span class='name'>wp_target</span>
<span class='type'>(<tt><span class='object_link'><a href="../WpTarget.html" title="WpTarget (class)">WpTarget</a></span></tt>)</span>
</li>
<li>
<span class='name'>[</span>
<span class='type'>(<tt>Hash</tt>)</span>
&mdash;
<div class='inline'>
<p>a customizable set of options</p>
</div>
</li>
</ul>
<p class="tag_title">Returns:</p>
<ul class="return">
<li>
<span class='type'>(<tt><span class='object_link'><a href="../WpItem.html" title="WpItem (class)">WpItem</a></span></tt>)</span>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
160
161
162
163
164
165
166
167
168</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/common/collections/wp_items/detectable.rb', line 160</span>
<span class='kw'>def</span> <span class='id identifier rubyid_create_item'>create_item</span><span class='lparen'>(</span><span class='id identifier rubyid_klass'>klass</span><span class='comma'>,</span> <span class='id identifier rubyid_name'>name</span><span class='comma'>,</span> <span class='id identifier rubyid_wp_target'>wp_target</span><span class='comma'>,</span> <span class='id identifier rubyid_vulns_file'>vulns_file</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
<span class='id identifier rubyid_klass'>klass</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span>
<span class='id identifier rubyid_wp_target'>wp_target</span><span class='period'>.</span><span class='id identifier rubyid_uri'>uri</span><span class='comma'>,</span>
<span class='label'>name:</span> <span class='id identifier rubyid_name'>name</span><span class='comma'>,</span>
<span class='label'>vulns_file:</span> <span class='id identifier rubyid_vulns_file'>vulns_file</span><span class='comma'>,</span>
<span class='label'>wp_content_dir:</span> <span class='id identifier rubyid_wp_target'>wp_target</span><span class='period'>.</span><span class='id identifier rubyid_wp_content_dir'>wp_content_dir</span><span class='comma'>,</span>
<span class='label'>wp_plugins_dir:</span> <span class='id identifier rubyid_wp_target'>wp_target</span><span class='period'>.</span><span class='id identifier rubyid_wp_plugins_dir'>wp_plugins_dir</span>
<span class='rparen'>)</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="item_class-instance_method">
- (<tt>Class</tt>) <strong>item_class</strong> <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>Class</tt>)</span>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
193
194
195</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/common/collections/wp_items/detectable.rb', line 193</span>
<span class='kw'>def</span> <span class='id identifier rubyid_item_class'>item_class</span>
<span class='const'>Object</span><span class='period'>.</span><span class='id identifier rubyid_const_get'>const_get</span><span class='lparen'>(</span><span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='period'>.</span><span class='id identifier rubyid_gsub'>gsub</span><span class='lparen'>(</span><span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>.$</span><span class='regexp_end'>/</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span><span class='rparen'>)</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="item_options-instance_method">
- (<tt>Hash</tt>) <strong>item_options</strong>(wp_target) <span class="extras">(protected)</span>
</h3><div class="docstring">
<div class="discussion">
</div>
</div>
<div class="tags">
<p class="tag_title">Parameters:</p>
<ul class="param">
<li>
<span class='name'>wp_target</span>
<span class='type'>(<tt><span class='object_link'><a href="../WpTarget.html" title="WpTarget (class)">WpTarget</a></span></tt>)</span>
</li>
</ul>
<p class="tag_title">Returns:</p>
<ul class="return">
<li>
<span class='type'>(<tt>Hash</tt>)</span>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
97
98
99
100
101
102
103</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/common/collections/wp_items/detectable.rb', line 97</span>
<span class='kw'>def</span> <span class='id identifier rubyid_item_options'>item_options</span><span class='lparen'>(</span><span class='id identifier rubyid_wp_target'>wp_target</span><span class='rparen'>)</span>
<span class='lbrace'>{</span>
<span class='label'>wp_content_dir:</span> <span class='id identifier rubyid_wp_target'>wp_target</span><span class='period'>.</span><span class='id identifier rubyid_wp_content_dir'>wp_content_dir</span><span class='comma'>,</span>
<span class='label'>wp_plugins_dir:</span> <span class='id identifier rubyid_wp_target'>wp_target</span><span class='period'>.</span><span class='id identifier rubyid_wp_plugins_dir'>wp_plugins_dir</span><span class='comma'>,</span>
<span class='label'>vulns_file:</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_vulns_file'>vulns_file</span>
<span class='rbrace'>}</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="passive_detection-instance_method">
- (<tt><span class='object_link'><a href="../WpItems.html" title="WpItems (class)">WpItems</a></span></tt>) <strong>passive_detection</strong>(wp_target, options = {})
</h3><div class="docstring">
<div class="discussion">
</div>
</div>
<div class="tags">
<p class="tag_title">Parameters:</p>
<ul class="param">
<li>
<span class='name'>wp_target</span>
<span class='type'>(<tt><span class='object_link'><a href="../WpTarget.html" title="WpTarget (class)">WpTarget</a></span></tt>)</span>
</li>
<li>
<span class='name'>options</span>
<span class='type'>(<tt>Hash</tt>)</span>
<em class="default">(defaults to: <tt>{}</tt>)</em>
</li>
</ul>
<p class="tag_title">Returns:</p>
<ul class="return">
<li>
<span class='type'>(<tt><span class='object_link'><a href="../WpItems.html" title="WpItems (class)">WpItems</a></span></tt>)</span>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/common/collections/wp_items/detectable.rb', line 71</span>
<span class='kw'>def</span> <span class='id identifier rubyid_passive_detection'>passive_detection</span><span class='lparen'>(</span><span class='id identifier rubyid_wp_target'>wp_target</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
<span class='id identifier rubyid_results'>results</span> <span class='op'>=</span> <span class='id identifier rubyid_new'>new</span>
<span class='id identifier rubyid_item_class'>item_class</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_item_class'>item_class</span>
<span class='id identifier rubyid_type'>type</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='period'>.</span><span class='id identifier rubyid_gsub'>gsub</span><span class='lparen'>(</span><span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>Wp</span><span class='regexp_end'>/</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_downcase'>downcase</span>
<span class='id identifier rubyid_response'>response</span> <span class='op'>=</span> <span class='const'>Browser</span><span class='period'>.</span><span class='id identifier rubyid_get'>get</span><span class='lparen'>(</span><span class='id identifier rubyid_wp_target'>wp_target</span><span class='period'>.</span><span class='id identifier rubyid_url'>url</span><span class='rparen'>)</span>
<span class='id identifier rubyid_item_options'>item_options</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_item_options'>item_options</span><span class='lparen'>(</span><span class='id identifier rubyid_wp_target'>wp_target</span><span class='rparen'>)</span>
<span class='id identifier rubyid_regex1'>regex1</span> <span class='op'>=</span> <span class='tstring'><span class='regexp_beg'>%r{</span><span class='tstring_content'>(?:[^=:]+)\s?(?:=|:)\s?(?:&quot;|')[^&quot;']+\\?/</span><span class='regexp_end'>}</span></span>
<span class='id identifier rubyid_regex2'>regex2</span> <span class='op'>=</span> <span class='tstring'><span class='regexp_beg'>%r{</span><span class='tstring_content'>\\?/</span><span class='regexp_end'>}</span></span>
<span class='id identifier rubyid_regex3'>regex3</span> <span class='op'>=</span> <span class='tstring'><span class='regexp_beg'>%r{</span><span class='tstring_content'>\\?/([^/\\&quot;']+)\\?(?:/|&quot;|')</span><span class='regexp_end'>}</span></span>
<span class='id identifier rubyid_names'>names</span> <span class='op'>=</span> <span class='id identifier rubyid_response'>response</span><span class='period'>.</span><span class='id identifier rubyid_body'>body</span><span class='period'>.</span><span class='id identifier rubyid_scan'>scan</span><span class='lparen'>(</span><span class='tstring'><span class='regexp_beg'>/</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_regex1'>regex1</span><span class='rbrace'>}</span><span class='embexpr_beg'>#{</span><span class='const'>Regexp</span><span class='period'>.</span><span class='id identifier rubyid_escape'>escape</span><span class='lparen'>(</span><span class='id identifier rubyid_wp_target'>wp_target</span><span class='period'>.</span><span class='id identifier rubyid_wp_content_dir'>wp_content_dir</span><span class='rparen'>)</span><span class='rbrace'>}</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_regex2'>regex2</span><span class='rbrace'>}</span><span class='embexpr_beg'>#{</span><span class='const'>Regexp</span><span class='period'>.</span><span class='id identifier rubyid_escape'>escape</span><span class='lparen'>(</span><span class='id identifier rubyid_type'>type</span><span class='rparen'>)</span><span class='rbrace'>}</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_regex3'>regex3</span><span class='rbrace'>}</span><span class='regexp_end'>/i</span></span><span class='rparen'>)</span>
<span class='id identifier rubyid_names'>names</span><span class='period'>.</span><span class='id identifier rubyid_flatten'>flatten</span><span class='period'>.</span><span class='id identifier rubyid_uniq'>uniq</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_name'>name</span><span class='op'>|</span>
<span class='id identifier rubyid_results'>results</span> <span class='op'>&lt;&lt;</span> <span class='id identifier rubyid_item_class'>item_class</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_wp_target'>wp_target</span><span class='period'>.</span><span class='id identifier rubyid_uri'>uri</span><span class='comma'>,</span> <span class='id identifier rubyid_item_options'>item_options</span><span class='period'>.</span><span class='id identifier rubyid_merge'>merge</span><span class='lparen'>(</span><span class='label'>name:</span> <span class='id identifier rubyid_name'>name</span><span class='rparen'>)</span><span class='rparen'>)</span>
<span class='kw'>end</span>
<span class='id identifier rubyid_results'>results</span><span class='period'>.</span><span class='id identifier rubyid_sort!'>sort!</span>
<span class='id identifier rubyid_results'>results</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="progress_bar-instance_method">
- (<tt>ProgressBar</tt>) <strong>progress_bar</strong>(targets_size, options)
</h3><div class="docstring">
<div class="discussion">
<p>:nocov:</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Parameters:</p>
<ul class="param">
<li>
<span class='name'>targets_size</span>
<span class='type'>(<tt>Integer</tt>)</span>
</li>
<li>
<span class='name'>options</span>
<span class='type'>(<tt>Hash</tt>)</span>
</li>
</ul>
<p class="tag_title">Returns:</p>
<ul class="return">
<li>
<span class='type'>(<tt>ProgressBar</tt>)</span>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
56
57
58
59
60
61
62
63
64</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/common/collections/wp_items/detectable.rb', line 56</span>
<span class='kw'>def</span> <span class='id identifier rubyid_progress_bar'>progress_bar</span><span class='lparen'>(</span><span class='id identifier rubyid_targets_size'>targets_size</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span><span class='rparen'>)</span>
<span class='kw'>if</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:show_progression</span><span class='rbracket'>]</span>
<span class='const'>ProgressBar</span><span class='period'>.</span><span class='id identifier rubyid_create'>create</span><span class='lparen'>(</span>
<span class='label'>format:</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>%t %a &lt;%B&gt; (%c / %C) %P%% %e</span><span class='tstring_end'>'</span></span><span class='comma'>,</span>
<span class='label'>title:</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'> </span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='comment'># Used to craete a left margin
</span> <span class='label'>total:</span> <span class='id identifier rubyid_targets_size'>targets_size</span>
<span class='rparen'>)</span>
<span class='kw'>end</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="request_params-instance_method">
- (<tt>Hash</tt>) <strong>request_params</strong> <span class="extras">(protected)</span>
</h3><div class="docstring">
<div class="discussion">
<p>The default request parameters</p>
</div>
</div>
<div class="tags">
<p class="tag_title">Returns:</p>
<ul class="return">
<li>
<span class='type'>(<tt>Hash</tt>)</span>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
108</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/common/collections/wp_items/detectable.rb', line 108</span>
<span class='kw'>def</span> <span class='id identifier rubyid_request_params'>request_params</span><span class='semicolon'>;</span> <span class='lbrace'>{</span> <span class='label'>cache_ttl:</span> <span class='int'>0</span><span class='comma'>,</span> <span class='label'>followlocation:</span> <span class='kw'>true</span> <span class='rbrace'>}</span> <span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="targets_items-instance_method">
- (<tt><span class='object_link'><a href="../Array.html" title="Array (class)">Array</a></span>&lt;<span class='object_link'><a href="../WpItem.html" title="WpItem (class)">WpItem</a></span>&gt;</tt>) <strong>targets_items</strong>(wp_target, options = {}) <span class="extras">(protected)</span>
</h3><div class="docstring">
<div class="discussion">
</div>
</div>
<div class="tags">
<p class="tag_title">Parameters:</p>
<ul class="param">
<li>
<span class='name'>wp_target</span>
<span class='type'>(<tt><span class='object_link'><a href="../WpTarget.html" title="WpTarget (class)">WpTarget</a></span></tt>)</span>
</li>
<li>
<span class='name'>options</span>
<span class='type'>(<tt>options</tt>)</span>
<em class="default">(defaults to: <tt>{}</tt>)</em>
</li>
</ul>
<p class="tag_title">Options Hash (<tt>options</tt>):</p>
<ul class="option">
<li>
<span class="name">:only_vulnerable</span>
<span class="type">(<tt>Boolean</tt>)</span>
<span class="default">
</span>
</li>
<li>
<span class="name">:file</span>
<span class="type">(<tt>String</tt>)</span>
<span class="default">
</span>
&mdash; <div class='inline'>
<p>The path to the file containing the targets</p>
</div>
</li>
</ul>
<p class="tag_title">Returns:</p>
<ul class="return">
<li>
<span class='type'>(<tt><span class='object_link'><a href="../Array.html" title="Array (class)">Array</a></span>&lt;<span class='object_link'><a href="../WpItem.html" title="WpItem (class)">WpItem</a></span>&gt;</tt>)</span>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/common/collections/wp_items/detectable.rb', line 116</span>
<span class='kw'>def</span> <span class='id identifier rubyid_targets_items'>targets_items</span><span class='lparen'>(</span><span class='id identifier rubyid_wp_target'>wp_target</span><span class='comma'>,</span> <span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
<span class='id identifier rubyid_item_class'>item_class</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_item_class'>item_class</span>
<span class='id identifier rubyid_vulns_file'>vulns_file</span> <span class='op'>=</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_vulns_file'>vulns_file</span>
<span class='id identifier rubyid_targets'>targets</span> <span class='op'>=</span> <span class='id identifier rubyid_vulnerable_targets_items'>vulnerable_targets_items</span><span class='lparen'>(</span><span class='id identifier rubyid_wp_target'>wp_target</span><span class='comma'>,</span> <span class='id identifier rubyid_item_class'>item_class</span><span class='comma'>,</span> <span class='id identifier rubyid_vulns_file'>vulns_file</span><span class='rparen'>)</span>
<span class='kw'>unless</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:only_vulnerable</span><span class='rbracket'>]</span>
<span class='kw'>unless</span> <span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:file</span><span class='rbracket'>]</span>
<span class='id identifier rubyid_raise'>raise</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>A file must be supplied</span><span class='tstring_end'>'</span></span>
<span class='kw'>end</span>
<span class='id identifier rubyid_targets'>targets</span> <span class='op'>+=</span> <span class='id identifier rubyid_targets_items_from_file'>targets_items_from_file</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span><span class='lbracket'>[</span><span class='symbol'>:file</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='id identifier rubyid_wp_target'>wp_target</span><span class='comma'>,</span> <span class='id identifier rubyid_item_class'>item_class</span><span class='comma'>,</span> <span class='id identifier rubyid_vulns_file'>vulns_file</span><span class='rparen'>)</span>
<span class='kw'>end</span>
<span class='id identifier rubyid_targets'>targets</span><span class='period'>.</span><span class='id identifier rubyid_uniq!'>uniq!</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_t'>t</span><span class='op'>|</span> <span class='id identifier rubyid_t'>t</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span> <span class='rbrace'>}</span>
<span class='id identifier rubyid_targets'>targets</span><span class='period'>.</span><span class='id identifier rubyid_sort_by'>sort_by</span> <span class='lbrace'>{</span> <span class='id identifier rubyid_rand'>rand</span> <span class='rbrace'>}</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="targets_items_from_file-instance_method">
- (<tt><span class='object_link'><a href="../Array.html" title="Array (class)">Array</a></span>&lt;<span class='object_link'><a href="../WpItem.html" title="WpItem (class)">WpItem</a></span>&gt;</tt>) <strong>targets_items_from_file</strong>(file, wp_target, item_class, vulns_file) <span class="extras">(protected)</span>
</h3><div class="docstring">
<div class="discussion">
</div>
</div>
<div class="tags">
<p class="tag_title">Parameters:</p>
<ul class="param">
<li>
<span class='name'>file</span>
<span class='type'>(<tt>String</tt>)</span>
</li>
<li>
<span class='name'>wp_target</span>
<span class='type'>(<tt><span class='object_link'><a href="../WpTarget.html" title="WpTarget (class)">WpTarget</a></span></tt>)</span>
</li>
<li>
<span class='name'>item_class</span>
<span class='type'>(<tt>Class</tt>)</span>
</li>
<li>
<span class='name'>vulns_file</span>
<span class='type'>(<tt>String</tt>)</span>
</li>
</ul>
<p class="tag_title">Returns:</p>
<ul class="return">
<li>
<span class='type'>(<tt><span class='object_link'><a href="../Array.html" title="Array (class)">Array</a></span>&lt;<span class='object_link'><a href="../WpItem.html" title="WpItem (class)">WpItem</a></span>&gt;</tt>)</span>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/common/collections/wp_items/detectable.rb', line 176</span>
<span class='kw'>def</span> <span class='id identifier rubyid_targets_items_from_file'>targets_items_from_file</span><span class='lparen'>(</span><span class='id identifier rubyid_file'>file</span><span class='comma'>,</span> <span class='id identifier rubyid_wp_target'>wp_target</span><span class='comma'>,</span> <span class='id identifier rubyid_item_class'>item_class</span><span class='comma'>,</span> <span class='id identifier rubyid_vulns_file'>vulns_file</span><span class='rparen'>)</span>
<span class='id identifier rubyid_targets'>targets</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
<span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_open'>open</span><span class='lparen'>(</span><span class='id identifier rubyid_file'>file</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>r</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_f'>f</span><span class='op'>|</span>
<span class='id identifier rubyid_f'>f</span><span class='period'>.</span><span class='id identifier rubyid_readlines'>readlines</span><span class='period'>.</span><span class='id identifier rubyid_collect'>collect</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_item_name'>item_name</span><span class='op'>|</span>
<span class='id identifier rubyid_targets'>targets</span> <span class='op'>&lt;&lt;</span> <span class='id identifier rubyid_create_item'>create_item</span><span class='lparen'>(</span>
<span class='id identifier rubyid_item_class'>item_class</span><span class='comma'>,</span>
<span class='id identifier rubyid_item_name'>item_name</span><span class='period'>.</span><span class='id identifier rubyid_strip'>strip</span><span class='comma'>,</span>
<span class='id identifier rubyid_wp_target'>wp_target</span><span class='comma'>,</span>
<span class='id identifier rubyid_vulns_file'>vulns_file</span>
<span class='rparen'>)</span>
<span class='kw'>end</span>
<span class='kw'>end</span>
<span class='id identifier rubyid_targets'>targets</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
<div class="method_details ">
<h3 class="signature " id="vulnerable_targets_items-instance_method">
- (<tt><span class='object_link'><a href="../Array.html" title="Array (class)">Array</a></span>&lt;<span class='object_link'><a href="../WpItem.html" title="WpItem (class)">WpItem</a></span>&gt;</tt>) <strong>vulnerable_targets_items</strong>(wp_target, item_class, vulns_file) <span class="extras">(protected)</span>
</h3><div class="docstring">
<div class="discussion">
</div>
</div>
<div class="tags">
<p class="tag_title">Parameters:</p>
<ul class="param">
<li>
<span class='name'>wp_target</span>
<span class='type'>(<tt><span class='object_link'><a href="../WpTarget.html" title="WpTarget (class)">WpTarget</a></span></tt>)</span>
</li>
<li>
<span class='name'>item_class</span>
<span class='type'>(<tt>Class</tt>)</span>
</li>
<li>
<span class='name'>vulns_file</span>
<span class='type'>(<tt>String</tt>)</span>
</li>
</ul>
<p class="tag_title">Returns:</p>
<ul class="return">
<li>
<span class='type'>(<tt><span class='object_link'><a href="../Array.html" title="Array (class)">Array</a></span>&lt;<span class='object_link'><a href="../WpItem.html" title="WpItem (class)">WpItem</a></span>&gt;</tt>)</span>
</li>
</ul>
</div><table class="source_code">
<tr>
<td>
<pre class="lines">
139
140
141
142
143
144
145
146
147
148
149
150
151
152</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/common/collections/wp_items/detectable.rb', line 139</span>
<span class='kw'>def</span> <span class='id identifier rubyid_vulnerable_targets_items'>vulnerable_targets_items</span><span class='lparen'>(</span><span class='id identifier rubyid_wp_target'>wp_target</span><span class='comma'>,</span> <span class='id identifier rubyid_item_class'>item_class</span><span class='comma'>,</span> <span class='id identifier rubyid_vulns_file'>vulns_file</span><span class='rparen'>)</span>
<span class='id identifier rubyid_targets'>targets</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
<span class='id identifier rubyid_xml'>xml</span> <span class='op'>=</span> <span class='id identifier rubyid_xml'>xml</span><span class='lparen'>(</span><span class='id identifier rubyid_vulns_file'>vulns_file</span><span class='rparen'>)</span>
<span class='id identifier rubyid_xml'>xml</span><span class='period'>.</span><span class='id identifier rubyid_xpath'>xpath</span><span class='lparen'>(</span><span class='id identifier rubyid_item_xpath'>item_xpath</span><span class='rparen'>)</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_node'>node</span><span class='op'>|</span>
<span class='id identifier rubyid_targets'>targets</span> <span class='op'>&lt;&lt;</span> <span class='id identifier rubyid_create_item'>create_item</span><span class='lparen'>(</span>
<span class='id identifier rubyid_item_class'>item_class</span><span class='comma'>,</span>
<span class='id identifier rubyid_node'>node</span><span class='period'>.</span><span class='id identifier rubyid_attribute'>attribute</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>name</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_text'>text</span><span class='comma'>,</span>
<span class='id identifier rubyid_wp_target'>wp_target</span><span class='comma'>,</span>
<span class='id identifier rubyid_vulns_file'>vulns_file</span>
<span class='rparen'>)</span>
<span class='kw'>end</span>
<span class='id identifier rubyid_targets'>targets</span>
<span class='kw'>end</span></pre>
</td>
</tr>
</table>
</div>
</div>
</div>
<div id="footer">
Generated on Fri Jul 19 23:10:15 2013 by
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
0.8.5.2 (ruby-1.9.3).
</div>
</body>
</html>