Skip to content

Commit

Permalink
file architecture redesign
Browse files Browse the repository at this point in the history
  • Loading branch information
noraj committed Aug 10, 2021
1 parent b4baeee commit 13610bc
Show file tree
Hide file tree
Showing 28 changed files with 117 additions and 91 deletions.
2 changes: 1 addition & 1 deletion bin/tls-map
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
require 'pp'
# Project internal
require 'tls_map'
require 'tls_map/cli'
require 'tls_map/cli/cli'
# External
require 'docopt'
require 'paint'
Expand Down
8 changes: 7 additions & 1 deletion docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
# Changelog

## [Unreleased]
## [2.0.0]

**BREAKING CHANGES:**

- More modular file architecture in `lib`
- It shouldn't change anything from user perspective (CLI & lib)
- It will change the `require` path for people who want to develop on tls-map or that use some fragments of the library

Additions:

Expand Down
4 changes: 2 additions & 2 deletions docs/yard/TLSmap.html
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
<dl>
<dt>Defined in:</dt>
<dd>lib/tls_map.rb<span class="defines">,<br />
lib/tls_map/cli.rb,<br /> lib/tls_map/nss.rb,<br /> lib/tls_map/iana.rb,<br /> lib/tls_map/utils.rb,<br /> lib/tls_map/gnutls.rb,<br /> lib/tls_map/output.rb,<br /> lib/tls_map/openssl.rb,<br /> lib/tls_map/version.rb,<br /> lib/tls_map/extractor.rb,<br /> lib/tls_map/ciphersuiteinfo.rb</span>
lib/tls_map/cipher.rb,<br /> lib/tls_map/app/nss.rb,<br /> lib/tls_map/cli/cli.rb,<br /> lib/tls_map/version.rb,<br /> lib/tls_map/app/iana.rb,<br /> lib/tls_map/app/gnutls.rb,<br /> lib/tls_map/app/output.rb,<br /> lib/tls_map/app/openssl.rb,<br /> lib/tls_map/utils/utils.rb,<br /> lib/tls_map/app/extractor/extractor.rb,<br /> lib/tls_map/app/extended/ciphersuiteinfo.rb</span>
</dd>
</dl>

Expand Down Expand Up @@ -135,7 +135,7 @@ <h2>
</div>

<div id="footer">
Generated on Fri Jul 30 12:12:20 2021 by
Generated on Tue Aug 10 17:33:23 2021 by
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
0.9.26 (ruby-3.0.2).
</div>
Expand Down
6 changes: 3 additions & 3 deletions docs/yard/TLSmap/App.html
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
<dl>
<dt>Defined in:</dt>
<dd>lib/tls_map.rb<span class="defines">,<br />
lib/tls_map/nss.rb,<br /> lib/tls_map/iana.rb,<br /> lib/tls_map/gnutls.rb,<br /> lib/tls_map/output.rb,<br /> lib/tls_map/openssl.rb,<br /> lib/tls_map/extractor.rb,<br /> lib/tls_map/ciphersuiteinfo.rb</span>
lib/tls_map/cipher.rb,<br /> lib/tls_map/app/nss.rb,<br /> lib/tls_map/app/iana.rb,<br /> lib/tls_map/app/gnutls.rb,<br /> lib/tls_map/app/output.rb,<br /> lib/tls_map/app/openssl.rb,<br /> lib/tls_map/app/extractor/extractor.rb,<br /> lib/tls_map/app/extended/ciphersuiteinfo.rb</span>
</dd>
</dl>

Expand Down Expand Up @@ -540,7 +540,7 @@ <h3 class="signature " id="export-instance_method">
49</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/tls_map/output.rb', line 41</span>
<pre class="code"><span class="info file"># File 'lib/tls_map/app/output.rb', line 41</span>

<span class='kw'>def</span> <span class='id identifier rubyid_export'>export</span><span class='lparen'>(</span><span class='id identifier rubyid_filename'>filename</span><span class='comma'>,</span> <span class='id identifier rubyid_format'>format</span><span class='rparen'>)</span>
<span class='kw'>case</span> <span class='id identifier rubyid_format'>format</span>
Expand Down Expand Up @@ -686,7 +686,7 @@ <h3 class="signature " id="search-instance_method">
</div>

<div id="footer">
Generated on Fri Jul 30 12:12:20 2021 by
Generated on Tue Aug 10 17:33:23 2021 by
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
0.9.26 (ruby-3.0.2).
</div>
Expand Down
80 changes: 50 additions & 30 deletions docs/yard/TLSmap/App/Extended.html
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@

<dl>
<dt>Defined in:</dt>
<dd>lib/tls_map/ciphersuiteinfo.rb</dd>
<dd>lib/tls_map/app/extended/ciphersuiteinfo.rb</dd>
</dl>

</div>
Expand Down Expand Up @@ -231,6 +231,26 @@ <h2>
<span class='int'>2</span> <span class='op'>=&gt;</span> <span class='lbrace'>{</span> <span class='label'>title:</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>High</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span> <span class='label'>color:</span> <span class='symbol'>:red</span> <span class='rbrace'>}</span>
<span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_freeze'>freeze</span></pre></dd>

<dt id="SECURITY_LEVEL-constant" class="">SECURITY_LEVEL =
<div class="docstring">
<div class="discussion">
<p>Hash mapping the security level used by the API and color for the CLI</p>


</div>
</div>
<div class="tags">


</div>
</dt>
<dd><pre class="code"><span class='lbrace'>{</span>
<span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>recommended</span><span class='tstring_end'>&#39;</span></span> <span class='op'>=&gt;</span> <span class='lbrace'>{</span> <span class='label'>color:</span> <span class='symbol'>:green</span> <span class='rbrace'>}</span><span class='comma'>,</span>
<span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>secure</span><span class='tstring_end'>&#39;</span></span> <span class='op'>=&gt;</span> <span class='lbrace'>{</span> <span class='label'>color:</span> <span class='symbol'>:green</span> <span class='rbrace'>}</span><span class='comma'>,</span>
<span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>weak</span><span class='tstring_end'>&#39;</span></span> <span class='op'>=&gt;</span> <span class='lbrace'>{</span> <span class='label'>color:</span> <span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>orange</span><span class='tstring_end'>&#39;</span></span> <span class='rbrace'>}</span><span class='comma'>,</span>
<span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>insecure</span><span class='tstring_end'>&#39;</span></span> <span class='op'>=&gt;</span> <span class='lbrace'>{</span> <span class='label'>color:</span> <span class='symbol'>:red</span> <span class='rbrace'>}</span>
<span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_freeze'>freeze</span></pre></dd>

</dl>


Expand Down Expand Up @@ -373,15 +393,15 @@ <h3 class="signature first" id="initialize-instance_method">
<pre class="lines">


49
50
51
52
53
54</pre>
56
57
58
59
60
61</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/tls_map/ciphersuiteinfo.rb', line 49</span>
<pre class="code"><span class="info file"># File 'lib/tls_map/app/extended/ciphersuiteinfo.rb', line 56</span>

<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span>
<span class='ivar'>@tech_file</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="../Utils.html" title="TLSmap::Utils (module)">Utils</a></span></span><span class='period'>.</span><span class='id identifier rubyid_tmpfile'><span class='object_link'><a href="../Utils.html#tmpfile-class_method" title="TLSmap::Utils.tmpfile (method)">tmpfile</a></span></span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>tech</span><span class='tstring_end'>&#39;</span></span><span class='comma'>,</span> <span class='const'><span class='object_link'><a href="#TECH_DATA-constant" title="TLSmap::App::Extended::TECH_DATA (constant)">TECH_DATA</a></span></span><span class='rparen'>)</span>
Expand Down Expand Up @@ -464,24 +484,24 @@ <h3 class="signature first" id="extend-instance_method">
<pre class="lines">


61
62
63
64
65
66
67
68
69
70
71
72
73
74
75</pre>
75
76
77
78
79
80
81
82</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/tls_map/ciphersuiteinfo.rb', line 61</span>
<pre class="code"><span class="info file"># File 'lib/tls_map/app/extended/ciphersuiteinfo.rb', line 68</span>

<span class='kw'>def</span> <span class='id identifier rubyid_extend'>extend</span><span class='lparen'>(</span><span class='id identifier rubyid_iana_name'>iana_name</span><span class='rparen'>)</span> <span class='comment'># rubocop:disable Metrics/MethodLength
</span> <span class='id identifier rubyid_obj'>obj</span> <span class='op'>=</span> <span class='const'>Net</span><span class='op'>::</span><span class='const'>HTTP</span><span class='period'>.</span><span class='id identifier rubyid_get'>get</span><span class='lparen'>(</span><span class='const'>URI</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='const'><span class='object_link'><a href="#API_ROOT-constant" title="TLSmap::App::Extended::API_ROOT (constant)">API_ROOT</a></span></span><span class='embexpr_end'>}</span><span class='tstring_content'>cs/</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_iana_name'>iana_name</span><span class='embexpr_end'>}</span><span class='tstring_content'>/</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span><span class='rparen'>)</span>
Expand Down Expand Up @@ -564,14 +584,14 @@ <h3 class="signature " id="find_vuln-instance_method">
<pre class="lines">


111
112
113
114
115</pre>
118
119
120
121
122</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/tls_map/ciphersuiteinfo.rb', line 111</span>
<pre class="code"><span class="info file"># File 'lib/tls_map/app/extended/ciphersuiteinfo.rb', line 118</span>

<span class='kw'>def</span> <span class='id identifier rubyid_find_vuln'>find_vuln</span><span class='lparen'>(</span><span class='id identifier rubyid_tech'>tech</span><span class='rparen'>)</span>
<span class='kw'>return</span> <span class='ivar'>@tech</span><span class='lbracket'>[</span><span class='id identifier rubyid_tech'>tech</span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='symbol'>:vulnerabilities</span><span class='rbracket'>]</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_vuln'>vuln</span><span class='op'>|</span> <span class='ivar'>@vuln</span><span class='lbracket'>[</span><span class='id identifier rubyid_vuln'>vuln</span><span class='rbracket'>]</span> <span class='rbrace'>}</span> <span class='kw'>unless</span> <span class='ivar'>@tech</span><span class='lbracket'>[</span><span class='id identifier rubyid_tech'>tech</span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='symbol'>:vulnerabilities</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
Expand Down Expand Up @@ -644,14 +664,14 @@ <h3 class="signature " id="translate_acronym-instance_method">
<pre class="lines">


102
103
104
105
106</pre>
109
110
111
112
113</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/tls_map/ciphersuiteinfo.rb', line 102</span>
<pre class="code"><span class="info file"># File 'lib/tls_map/app/extended/ciphersuiteinfo.rb', line 109</span>

<span class='kw'>def</span> <span class='id identifier rubyid_translate_acronym'>translate_acronym</span><span class='lparen'>(</span><span class='id identifier rubyid_term'>term</span><span class='rparen'>)</span>
<span class='kw'>return</span> <span class='ivar'>@tech</span><span class='lbracket'>[</span><span class='id identifier rubyid_term'>term</span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='symbol'>:long_name</span><span class='rbracket'>]</span> <span class='kw'>unless</span> <span class='ivar'>@tech</span><span class='lbracket'>[</span><span class='id identifier rubyid_term'>term</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
Expand All @@ -668,7 +688,7 @@ <h3 class="signature " id="translate_acronym-instance_method">
</div>

<div id="footer">
Generated on Fri Jul 30 12:12:21 2021 by
Generated on Tue Aug 10 17:33:23 2021 by
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
0.9.26 (ruby-3.0.2).
</div>
Expand Down
22 changes: 11 additions & 11 deletions docs/yard/TLSmap/App/Extractor.html
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@

<dl>
<dt>Defined in:</dt>
<dd>lib/tls_map/extractor.rb</dd>
<dd>lib/tls_map/app/extractor/extractor.rb</dd>
</dl>

</div>
Expand Down Expand Up @@ -412,7 +412,7 @@ <h3 class="signature first" id="initialize-instance_method">
38</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/tls_map/extractor.rb', line 36</span>
<pre class="code"><span class="info file"># File 'lib/tls_map/app/extractor/extractor.rb', line 36</span>

<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span>
<span class='ivar'>@ciphers</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
Expand Down Expand Up @@ -476,7 +476,7 @@ <h3 class="signature first" id="ciphers-instance_method">
35</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/tls_map/extractor.rb', line 33</span>
<pre class="code"><span class="info file"># File 'lib/tls_map/app/extractor/extractor.rb', line 33</span>

<span class='kw'>def</span> <span class='id identifier rubyid_ciphers'>ciphers</span>
<span class='ivar'>@ciphers</span>
Expand Down Expand Up @@ -577,7 +577,7 @@ <h3 class="signature first" id="parse-instance_method">
85</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/tls_map/extractor.rb', line 80</span>
<pre class="code"><span class="info file"># File 'lib/tls_map/app/extractor/extractor.rb', line 80</span>

<span class='kw'>def</span> <span class='id identifier rubyid_parse'>parse</span><span class='lparen'>(</span><span class='id identifier rubyid_tool'>tool</span><span class='comma'>,</span> <span class='id identifier rubyid_file'>file</span><span class='rparen'>)</span>
<span class='comment'># Convert string to class
Expand Down Expand Up @@ -637,7 +637,7 @@ <h3 class="signature " id="ssl20-instance_method">
44</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/tls_map/extractor.rb', line 42</span>
<pre class="code"><span class="info file"># File 'lib/tls_map/app/extractor/extractor.rb', line 42</span>

<span class='kw'>def</span> <span class='id identifier rubyid_ssl20'>ssl20</span>
<span class='ivar'>@ciphers</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>SSL2.0</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span>
Expand Down Expand Up @@ -694,7 +694,7 @@ <h3 class="signature " id="ssl30-instance_method">
50</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/tls_map/extractor.rb', line 48</span>
<pre class="code"><span class="info file"># File 'lib/tls_map/app/extractor/extractor.rb', line 48</span>

<span class='kw'>def</span> <span class='id identifier rubyid_ssl30'>ssl30</span>
<span class='ivar'>@ciphers</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>SSL3.0</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span>
Expand Down Expand Up @@ -751,7 +751,7 @@ <h3 class="signature " id="tls10-instance_method">
56</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/tls_map/extractor.rb', line 54</span>
<pre class="code"><span class="info file"># File 'lib/tls_map/app/extractor/extractor.rb', line 54</span>

<span class='kw'>def</span> <span class='id identifier rubyid_tls10'>tls10</span>
<span class='ivar'>@ciphers</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>TLS1.0</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span>
Expand Down Expand Up @@ -808,7 +808,7 @@ <h3 class="signature " id="tls11-instance_method">
62</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/tls_map/extractor.rb', line 60</span>
<pre class="code"><span class="info file"># File 'lib/tls_map/app/extractor/extractor.rb', line 60</span>

<span class='kw'>def</span> <span class='id identifier rubyid_tls11'>tls11</span>
<span class='ivar'>@ciphers</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>TLS1.1</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span>
Expand Down Expand Up @@ -865,7 +865,7 @@ <h3 class="signature " id="tls12-instance_method">
68</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/tls_map/extractor.rb', line 66</span>
<pre class="code"><span class="info file"># File 'lib/tls_map/app/extractor/extractor.rb', line 66</span>

<span class='kw'>def</span> <span class='id identifier rubyid_tls12'>tls12</span>
<span class='ivar'>@ciphers</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>TLS1.2</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span>
Expand Down Expand Up @@ -922,7 +922,7 @@ <h3 class="signature " id="tls13-instance_method">
74</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/tls_map/extractor.rb', line 72</span>
<pre class="code"><span class="info file"># File 'lib/tls_map/app/extractor/extractor.rb', line 72</span>

<span class='kw'>def</span> <span class='id identifier rubyid_tls13'>tls13</span>
<span class='ivar'>@ciphers</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&#39;</span><span class='tstring_content'>TLS1.3</span><span class='tstring_end'>&#39;</span></span><span class='rbracket'>]</span>
Expand All @@ -937,7 +937,7 @@ <h3 class="signature " id="tls13-instance_method">
</div>

<div id="footer">
Generated on Fri Jul 30 12:12:20 2021 by
Generated on Tue Aug 10 17:33:23 2021 by
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
0.9.26 (ruby-3.0.2).
</div>
Expand Down
Loading

0 comments on commit 13610bc

Please sign in to comment.