Skip to content

Commit

Permalink
hexdump options
Browse files Browse the repository at this point in the history
  • Loading branch information
azi-acceis committed Jan 23, 2024
1 parent f9c2bfe commit feb09fe
Show file tree
Hide file tree
Showing 45 changed files with 80 additions and 55 deletions.
2 changes: 2 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

- Add a new class `Unisec::Bidi::Spoof` and CLI command `bidi spoof` to craft payloads for attack using BiDi code points like RtLO, for example, for spoofing a domain name or a file name
- Add a new helper method: `Unisec::Utils::String.grapheme_reverse`: Reverse a string by graphemes (not by code points)
- Add an `--enc` option for `unisec hexdump` to output only in the specified encoding
- `unisec hexdump` can now read from STDIN if the input equals to `-`

## [0.0.3]

Expand Down
2 changes: 1 addition & 1 deletion docs/yard/Integer.html
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ <h3 class="signature " id="to_hex-instance_method">
</div>

<div id="footer">
Generated on Mon Jan 22 18:11:32 2024 by
Generated on Tue Jan 23 10:38:47 2024 by
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
0.9.34 (ruby-3.3.0).
</div>
Expand Down
2 changes: 1 addition & 1 deletion docs/yard/Unisec.html
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ <h2>
</div>

<div id="footer">
Generated on Mon Jan 22 18:11:32 2024 by
Generated on Tue Jan 23 10:38:46 2024 by
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
0.9.34 (ruby-3.3.0).
</div>
Expand Down
2 changes: 1 addition & 1 deletion docs/yard/Unisec/Bidi.html
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ <h2>Overview</h2><div class="docstring">
</div>

<div id="footer">
Generated on Mon Jan 22 18:11:32 2024 by
Generated on Tue Jan 23 10:38:46 2024 by
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
0.9.34 (ruby-3.3.0).
</div>
Expand Down
2 changes: 1 addition & 1 deletion docs/yard/Unisec/Bidi/Spoof.html
Original file line number Diff line number Diff line change
Expand Up @@ -1309,7 +1309,7 @@ <h3 class="signature " id="set_target_display-instance_method">
</div>

<div id="footer">
Generated on Mon Jan 22 18:11:32 2024 by
Generated on Tue Jan 23 10:38:46 2024 by
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
0.9.34 (ruby-3.3.0).
</div>
Expand Down
2 changes: 1 addition & 1 deletion docs/yard/Unisec/CLI.html
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ <h2>Overview</h2><div class="docstring">
</div>

<div id="footer">
Generated on Mon Jan 22 18:11:32 2024 by
Generated on Tue Jan 23 10:38:46 2024 by
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
0.9.34 (ruby-3.3.0).
</div>
Expand Down
2 changes: 1 addition & 1 deletion docs/yard/Unisec/CLI/Commands.html
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ <h2>Overview</h2><div class="docstring">
</div>

<div id="footer">
Generated on Mon Jan 22 18:11:32 2024 by
Generated on Tue Jan 23 10:38:46 2024 by
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
0.9.34 (ruby-3.3.0).
</div>
Expand Down
2 changes: 1 addition & 1 deletion docs/yard/Unisec/CLI/Commands/Bidi.html
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ <h2>Overview</h2><div class="docstring">
</div>

<div id="footer">
Generated on Mon Jan 22 18:11:32 2024 by
Generated on Tue Jan 23 10:38:46 2024 by
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
0.9.34 (ruby-3.3.0).
</div>
Expand Down
2 changes: 1 addition & 1 deletion docs/yard/Unisec/CLI/Commands/Bidi/Spoof.html
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ <h3 class="signature first" id="call-instance_method">
</div>

<div id="footer">
Generated on Mon Jan 22 18:11:32 2024 by
Generated on Tue Jan 23 10:38:47 2024 by
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
0.9.34 (ruby-3.3.0).
</div>
Expand Down
2 changes: 1 addition & 1 deletion docs/yard/Unisec/CLI/Commands/Confusables.html
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ <h2>Overview</h2><div class="docstring">
</div>

<div id="footer">
Generated on Mon Jan 22 18:11:32 2024 by
Generated on Tue Jan 23 10:38:46 2024 by
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
0.9.34 (ruby-3.3.0).
</div>
Expand Down
2 changes: 1 addition & 1 deletion docs/yard/Unisec/CLI/Commands/Confusables/List.html
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ <h3 class="signature first" id="call-instance_method">
</div>

<div id="footer">
Generated on Mon Jan 22 18:11:32 2024 by
Generated on Tue Jan 23 10:38:47 2024 by
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
0.9.34 (ruby-3.3.0).
</div>
Expand Down
2 changes: 1 addition & 1 deletion docs/yard/Unisec/CLI/Commands/Confusables/Randomize.html
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ <h3 class="signature first" id="call-instance_method">
</div>

<div id="footer">
Generated on Mon Jan 22 18:11:32 2024 by
Generated on Tue Jan 23 10:38:47 2024 by
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
0.9.34 (ruby-3.3.0).
</div>
Expand Down
2 changes: 1 addition & 1 deletion docs/yard/Unisec/CLI/Commands/Grep.html
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ <h3 class="signature first" id="call-instance_method">
</div>

<div id="footer">
Generated on Mon Jan 22 18:11:32 2024 by
Generated on Tue Jan 23 10:38:47 2024 by
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
0.9.34 (ruby-3.3.0).
</div>
Expand Down
32 changes: 22 additions & 10 deletions docs/yard/Unisec/CLI/Commands/Hexdump.html
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ <h2>
<li class="public ">
<span class="summary_signature">

<a href="#call-instance_method" title="#call (instance method)">#<strong>call</strong>(input: nil) &#x21d2; Object </a>
<a href="#call-instance_method" title="#call (instance method)">#<strong>call</strong>(input: nil, **options) &#x21d2; Object </a>



Expand Down Expand Up @@ -170,7 +170,7 @@ <h2>Instance Method Details</h2>
<div class="method_details first">
<h3 class="signature first" id="call-instance_method">

#<strong>call</strong>(input: nil) &#x21d2; <tt>Object</tt>
#<strong>call</strong>(input: nil, **options) &#x21d2; <tt>Object</tt>



Expand Down Expand Up @@ -213,15 +213,27 @@ <h3 class="signature first" id="call-instance_method">
<pre class="lines">


29
30
31</pre>
32
33
34
35
36
37
38
39
40</pre>
</td>
<td>
<pre class="code"><span class="info file"># File 'lib/unisec/cli/hexdump.rb', line 29</span>

<span style="color:#080;font-weight:bold">def</span> <span style="color:#06B;font-weight:bold">call</span>(<span style="color:#606">input</span>: <span style="color:#069">nil</span>, **)
puts <span style="color:#036;font-weight:bold">Unisec</span>::<span style="color:#036;font-weight:bold">Hexdump</span>.new(input).display
<pre class="code"><span class="info file"># File 'lib/unisec/cli/hexdump.rb', line 32</span>

<span style="color:#080;font-weight:bold">def</span> <span style="color:#06B;font-weight:bold">call</span>(<span style="color:#606">input</span>: <span style="color:#069">nil</span>, **options)
input = <span style="color:#d70">$stdin</span>.read.chomp <span style="color:#080;font-weight:bold">if</span> input == <span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710">'</span><span style="color:#D20">-</span><span style="color:#710">'</span></span>
<span style="color:#080;font-weight:bold">if</span> options[<span style="color:#A60">:enc</span>].nil?
puts <span style="color:#036;font-weight:bold">Unisec</span>::<span style="color:#036;font-weight:bold">Hexdump</span>.new(input).display
<span style="color:#080;font-weight:bold">else</span>
<span style="color:#777"># using send() is safe here thanks to the value whitelist</span>
puts puts <span style="color:#036;font-weight:bold">Unisec</span>::<span style="color:#036;font-weight:bold">Hexdump</span>.send(options[<span style="color:#A60">:enc</span>], input)
<span style="color:#080;font-weight:bold">end</span>
<span style="color:#080;font-weight:bold">end</span></pre>
</td>
</tr>
Expand All @@ -233,7 +245,7 @@ <h3 class="signature first" id="call-instance_method">
</div>

<div id="footer">
Generated on Mon Jan 22 18:11:32 2024 by
Generated on Tue Jan 23 10:38:47 2024 by
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
0.9.34 (ruby-3.3.0).
</div>
Expand Down
2 changes: 1 addition & 1 deletion docs/yard/Unisec/CLI/Commands/Properties.html
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ <h2>Overview</h2><div class="docstring">
</div>

<div id="footer">
Generated on Mon Jan 22 18:11:32 2024 by
Generated on Tue Jan 23 10:38:46 2024 by
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
0.9.34 (ruby-3.3.0).
</div>
Expand Down
2 changes: 1 addition & 1 deletion docs/yard/Unisec/CLI/Commands/Properties/Char.html
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ <h3 class="signature first" id="call-instance_method">
</div>

<div id="footer">
Generated on Mon Jan 22 18:11:32 2024 by
Generated on Tue Jan 23 10:38:47 2024 by
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
0.9.34 (ruby-3.3.0).
</div>
Expand Down
2 changes: 1 addition & 1 deletion docs/yard/Unisec/CLI/Commands/Properties/Codepoints.html
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ <h3 class="signature first" id="call-instance_method">
</div>

<div id="footer">
Generated on Mon Jan 22 18:11:32 2024 by
Generated on Tue Jan 23 10:38:47 2024 by
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
0.9.34 (ruby-3.3.0).
</div>
Expand Down
2 changes: 1 addition & 1 deletion docs/yard/Unisec/CLI/Commands/Properties/List.html
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ <h3 class="signature first" id="call-instance_method">
</div>

<div id="footer">
Generated on Mon Jan 22 18:11:32 2024 by
Generated on Tue Jan 23 10:38:47 2024 by
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
0.9.34 (ruby-3.3.0).
</div>
Expand Down
2 changes: 1 addition & 1 deletion docs/yard/Unisec/CLI/Commands/Size.html
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ <h3 class="signature first" id="call-instance_method">
</div>

<div id="footer">
Generated on Mon Jan 22 18:11:32 2024 by
Generated on Tue Jan 23 10:38:47 2024 by
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
0.9.34 (ruby-3.3.0).
</div>
Expand Down
2 changes: 1 addition & 1 deletion docs/yard/Unisec/CLI/Commands/Surrogates.html
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ <h2>Overview</h2><div class="docstring">
</div>

<div id="footer">
Generated on Mon Jan 22 18:11:32 2024 by
Generated on Tue Jan 23 10:38:46 2024 by
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
0.9.34 (ruby-3.3.0).
</div>
Expand Down
2 changes: 1 addition & 1 deletion docs/yard/Unisec/CLI/Commands/Surrogates/From.html
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ <h3 class="signature first" id="call-instance_method">
</div>

<div id="footer">
Generated on Mon Jan 22 18:11:32 2024 by
Generated on Tue Jan 23 10:38:47 2024 by
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
0.9.34 (ruby-3.3.0).
</div>
Expand Down
2 changes: 1 addition & 1 deletion docs/yard/Unisec/CLI/Commands/Surrogates/To.html
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ <h3 class="signature first" id="call-instance_method">
</div>

<div id="footer">
Generated on Mon Jan 22 18:11:32 2024 by
Generated on Tue Jan 23 10:38:47 2024 by
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
0.9.34 (ruby-3.3.0).
</div>
Expand Down
2 changes: 1 addition & 1 deletion docs/yard/Unisec/CLI/Commands/Versions.html
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ <h3 class="signature first" id="call-instance_method">
</div>

<div id="footer">
Generated on Mon Jan 22 18:11:32 2024 by
Generated on Tue Jan 23 10:38:47 2024 by
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
0.9.34 (ruby-3.3.0).
</div>
Expand Down
2 changes: 1 addition & 1 deletion docs/yard/Unisec/Confusables.html
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,7 @@ <h3 class="signature " id="randomize_display-class_method">
</div>

<div id="footer">
Generated on Mon Jan 22 18:11:32 2024 by
Generated on Tue Jan 23 10:38:47 2024 by
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
0.9.34 (ruby-3.3.0).
</div>
Expand Down
2 changes: 1 addition & 1 deletion docs/yard/Unisec/Hexdump.html
Original file line number Diff line number Diff line change
Expand Up @@ -1324,7 +1324,7 @@ <h3 class="signature first" id="display-instance_method">
</div>

<div id="footer">
Generated on Mon Jan 22 18:11:32 2024 by
Generated on Tue Jan 23 10:38:47 2024 by
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
0.9.34 (ruby-3.3.0).
</div>
Expand Down
2 changes: 1 addition & 1 deletion docs/yard/Unisec/Properties.html
Original file line number Diff line number Diff line change
Expand Up @@ -1140,7 +1140,7 @@ <h3 class="signature " id="list-class_method">
</div>

<div id="footer">
Generated on Mon Jan 22 18:11:32 2024 by
Generated on Tue Jan 23 10:38:47 2024 by
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
0.9.34 (ruby-3.3.0).
</div>
Expand Down
2 changes: 1 addition & 1 deletion docs/yard/Unisec/Rugrep.html
Original file line number Diff line number Diff line change
Expand Up @@ -731,7 +731,7 @@ <h3 class="signature " id="ucd_derivedname_version-class_method">
</div>

<div id="footer">
Generated on Mon Jan 22 18:11:32 2024 by
Generated on Tue Jan 23 10:38:47 2024 by
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
0.9.34 (ruby-3.3.0).
</div>
Expand Down
2 changes: 1 addition & 1 deletion docs/yard/Unisec/Size.html
Original file line number Diff line number Diff line change
Expand Up @@ -1966,7 +1966,7 @@ <h3 class="signature first" id="display-instance_method">
</div>

<div id="footer">
Generated on Mon Jan 22 18:11:32 2024 by
Generated on Tue Jan 23 10:38:46 2024 by
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
0.9.34 (ruby-3.3.0).
</div>
Expand Down
2 changes: 1 addition & 1 deletion docs/yard/Unisec/Surrogates.html
Original file line number Diff line number Diff line change
Expand Up @@ -1229,7 +1229,7 @@ <h3 class="signature " id="low_surrogate-instance_method">
</div>

<div id="footer">
Generated on Mon Jan 22 18:11:32 2024 by
Generated on Tue Jan 23 10:38:47 2024 by
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
0.9.34 (ruby-3.3.0).
</div>
Expand Down
2 changes: 1 addition & 1 deletion docs/yard/Unisec/Utils.html
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ <h2>Overview</h2><div class="docstring">
</div>

<div id="footer">
Generated on Mon Jan 22 18:11:32 2024 by
Generated on Tue Jan 23 10:38:46 2024 by
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
0.9.34 (ruby-3.3.0).
</div>
Expand Down
2 changes: 1 addition & 1 deletion docs/yard/Unisec/Utils/String.html
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,7 @@ <h3 class="signature " id="grapheme_reverse-class_method">
</div>

<div id="footer">
Generated on Mon Jan 22 18:11:32 2024 by
Generated on Tue Jan 23 10:38:46 2024 by
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
0.9.34 (ruby-3.3.0).
</div>
Expand Down
2 changes: 1 addition & 1 deletion docs/yard/Unisec/Versions.html
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ <h3 class="signature " id="versions-class_method">
</div>

<div id="footer">
Generated on Mon Jan 22 18:11:32 2024 by
Generated on Tue Jan 23 10:38:47 2024 by
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
0.9.34 (ruby-3.3.0).
</div>
Expand Down
2 changes: 1 addition & 1 deletion docs/yard/_index.html
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ <h2>Namespace Listing A-Z</h2>
</div>

<div id="footer">
Generated on Mon Jan 22 18:11:32 2024 by
Generated on Tue Jan 23 10:38:46 2024 by
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
0.9.34 (ruby-3.3.0).
</div>
Expand Down
4 changes: 3 additions & 1 deletion docs/yard/file.CHANGELOG.html
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ <h2>[0.0.4]</h2>
<ul>
<li>Add a new class <code>Unisec::Bidi::Spoof</code> and CLI command <code>bidi spoof</code> to craft payloads for attack using BiDi code points like RtLO, for example, for spoofing a domain name or a file name</li>
<li>Add a new helper method: <code>Unisec::Utils::String.grapheme_reverse</code>: Reverse a string by graphemes (not by code points)</li>
<li>Add an <code>--enc</code> option for <code>unisec hexdump</code> to output only in the specified encoding</li>
<li><code>unisec hexdump</code> can now read from STDIN if the input equals to <code>-</code></li>
</ul>
<h2>[0.0.3]</h2>
<p><strong>Features</strong></p>
Expand Down Expand Up @@ -91,7 +93,7 @@ <h2>[0.0.1]</h2>
</div></div>

<div id="footer">
Generated on Mon Jan 22 18:11:32 2024 by
Generated on Tue Jan 23 10:38:46 2024 by
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
0.9.34 (ruby-3.3.0).
</div>
Expand Down
2 changes: 1 addition & 1 deletion docs/yard/file.LICENSE.html
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
</div></div>

<div id="footer">
Generated on Mon Jan 22 18:11:32 2024 by
Generated on Tue Jan 23 10:38:46 2024 by
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
0.9.34 (ruby-3.3.0).
</div>
Expand Down
2 changes: 1 addition & 1 deletion docs/yard/file.README.html
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ <h2>Author</h2>
</div></div>

<div id="footer">
Generated on Mon Jan 22 18:11:32 2024 by
Generated on Tue Jan 23 10:38:46 2024 by
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
0.9.34 (ruby-3.3.0).
</div>
Expand Down
2 changes: 1 addition & 1 deletion docs/yard/file.about.html
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ <h2>User documentation</h2>
</div></div>

<div id="footer">
Generated on Mon Jan 22 18:11:32 2024 by
Generated on Tue Jan 23 10:38:46 2024 by
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
0.9.34 (ruby-3.3.0).
</div>
Expand Down
Loading

0 comments on commit feb09fe

Please sign in to comment.