Skip to content

Commit

Permalink
add bidi class
Browse files Browse the repository at this point in the history
  • Loading branch information
azi-acceis committed Jan 22, 2024
1 parent df49bc1 commit f9c2bfe
Show file tree
Hide file tree
Showing 60 changed files with 2,565 additions and 128 deletions.
3 changes: 3 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ AllCops:
Layout/HashAlignment:
Exclude:
- '*.gemspec'
Layout/LineLength:
AllowedPatterns:
- !ruby/regexp /\A\s*# /
Lint/MissingSuper:
Exclude:
- 'lib/tls_map/cli/cli.rb'
Expand Down
2 changes: 1 addition & 1 deletion .tool-versions
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ruby 3.2.2
ruby 3.3.0
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ end

# Needed for the CLI & library
group :runtime, :all do
gem 'ctf-party', '~> 2.3' # string conversion
gem 'ctf-party', '~> 3.0' # string conversion
gem 'twitter_cldr', '~> 6.12' # ICU / CLDR
gem 'unicode-confusable', '~> 1.10' # confusable chars
end
Expand Down
10 changes: 6 additions & 4 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
PATH
remote: .
specs:
unisec (0.0.3)
ctf-party (~> 2.3)
unisec (0.0.4)
ctf-party (~> 3.0)
dry-cli (~> 1.0)
paint (~> 2.3)
twitter_cldr (~> 6.11, >= 6.11.5)
Expand All @@ -17,8 +17,9 @@ GEM
coderay (1.1.3)
commonmarker (0.23.10)
concurrent-ruby (1.2.2)
ctf-party (2.3.0)
ctf-party (3.0.0)
docopt (~> 0.6)
uri (>= 0.12.1, < 0.14.0)
docopt (0.6.1)
dry-cli (1.0.0)
json (2.7.1)
Expand Down Expand Up @@ -58,6 +59,7 @@ GEM
concurrent-ruby (~> 1.0)
unicode-confusable (1.10.0)
unicode-display_width (2.5.0)
uri (0.13.0)
webrick (1.8.1)
yard (0.9.34)
yard-coderay (0.1.0)
Expand All @@ -70,7 +72,7 @@ PLATFORMS
DEPENDENCIES
bundler (~> 2.1)
commonmarker (~> 0.23)
ctf-party (~> 2.3)
ctf-party (~> 3.0)
dry-cli (~> 1.0)
minitest (~> 5.21)
minitest-skip (~> 0.0)
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ A CLI tool and library to play with Unicode security.

## Features

- **BiDi spoofing**
- Craft payloads for attack using BiDi code points (e.g. spoofing a domain name or a file name)
- **Confusables / homoglyphs**
- List confusables characters for a given character
- Replace all characters from a string with random confusables
Expand Down
7 changes: 7 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
## [unreleased]

## [0.0.4]

**Features**

- 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)

## [0.0.3]

**Features**
Expand Down
6 changes: 5 additions & 1 deletion docs/pages/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ List commands:
```
$ unisec --help
Commands:
unisec bidi [SUBCOMMAND]
unisec confusables [SUBCOMMAND]
unisec grep REGEXP # Search for Unicode code point names by regular expression
unisec hexdump INPUT # Hexdump in all Unicode encodings
Expand Down Expand Up @@ -50,6 +51,8 @@ Options:

### Examples

- **BiDi**
- [Spoof](https://acceis.github.io/unisec/yard/Unisec/CLI/Commands/Bidi/Spoof)
- **Confusables**
- [List](https://acceis.github.io/unisec/yard/Unisec/CLI/Commands/Confusables/List)
- [Randomize](https://acceis.github.io/unisec/yard/Unisec/CLI/Commands/Confusables/Randomize)
Expand All @@ -71,10 +74,11 @@ Options:

See examples in [the library documentation](https://acceis.github.io/unisec/yard/Unisec).

- [Unisec::Bidi](https://acceis.github.io/unisec/yard/Unisec/Bidi)
- [Unisec::Confusables](https://acceis.github.io/unisec/yard/Unisec/Confusables)
- [Unisec::Hexdump](https://acceis.github.io/unisec/yard/Unisec/Hexdump)
- [Unisec::Properties](https://acceis.github.io/unisec/yard/Unisec/Properties)
[Unisec::Rugrep](https://acceis.github.io/unisec/yard/Unisec/Rugrep)
- [Unisec::Rugrep](https://acceis.github.io/unisec/yard/Unisec/Rugrep)
- [Unisec::Size](https://acceis.github.io/unisec/yard/Unisec/Size)
- [Unisec::Surrogates](https://acceis.github.io/unisec/yard/Unisec/Surrogates)
- [Unisec::Versions](https://acceis.github.io/unisec/yard/Unisec/Versions)
4 changes: 2 additions & 2 deletions docs/yard/Integer.html
Original file line number Diff line number Diff line change
Expand Up @@ -304,9 +304,9 @@ <h3 class="signature " id="to_hex-instance_method">
</div>

<div id="footer">
Generated on Wed Oct 18 17:02:20 2023 by
Generated on Mon Jan 22 18:11:32 2024 by
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
0.9.34 (ruby-3.2.2).
0.9.34 (ruby-3.3.0).
</div>

</div>
Expand Down
12 changes: 6 additions & 6 deletions docs/yard/Unisec.html
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@

<dl>
<dt>Defined in:</dt>
<dd>lib/unisec/size.rb<span class="defines">,<br />
lib/unisec/utils.rb,<br /> lib/unisec/rugrep.rb,<br /> lib/unisec/cli/cli.rb,<br /> lib/unisec/hexdump.rb,<br /> lib/unisec/version.rb,<br /> lib/unisec/cli/size.rb,<br /> lib/unisec/versions.rb,<br /> lib/unisec/cli/rugrep.rb,<br /> lib/unisec/properties.rb,<br /> lib/unisec/surrogates.rb,<br /> lib/unisec/cli/hexdump.rb,<br /> lib/unisec/confusables.rb,<br /> lib/unisec/cli/versions.rb,<br /> lib/unisec/cli/properties.rb,<br /> lib/unisec/cli/surrogates.rb,<br /> lib/unisec/cli/confusables.rb</span>
<dd>lib/unisec/bidi.rb<span class="defines">,<br />
lib/unisec/size.rb,<br /> lib/unisec/utils.rb,<br /> lib/unisec/rugrep.rb,<br /> lib/unisec/cli/cli.rb,<br /> lib/unisec/hexdump.rb,<br /> lib/unisec/version.rb,<br /> lib/unisec/cli/bidi.rb,<br /> lib/unisec/cli/size.rb,<br /> lib/unisec/versions.rb,<br /> lib/unisec/cli/rugrep.rb,<br /> lib/unisec/properties.rb,<br /> lib/unisec/surrogates.rb,<br /> lib/unisec/cli/hexdump.rb,<br /> lib/unisec/confusables.rb,<br /> lib/unisec/cli/versions.rb,<br /> lib/unisec/cli/properties.rb,<br /> lib/unisec/cli/surrogates.rb,<br /> lib/unisec/cli/confusables.rb</span>
</dd>
</dl>

Expand All @@ -93,7 +93,7 @@ <h2>Defined Under Namespace</h2>



<strong class="classes">Classes:</strong> <span class='object_link'><a href="Unisec/Confusables.html" title="Unisec::Confusables (class)">Confusables</a></span>, <span class='object_link'><a href="Unisec/Hexdump.html" title="Unisec::Hexdump (class)">Hexdump</a></span>, <span class='object_link'><a href="Unisec/Properties.html" title="Unisec::Properties (class)">Properties</a></span>, <span class='object_link'><a href="Unisec/Rugrep.html" title="Unisec::Rugrep (class)">Rugrep</a></span>, <span class='object_link'><a href="Unisec/Size.html" title="Unisec::Size (class)">Size</a></span>, <span class='object_link'><a href="Unisec/Surrogates.html" title="Unisec::Surrogates (class)">Surrogates</a></span>, <span class='object_link'><a href="Unisec/Versions.html" title="Unisec::Versions (class)">Versions</a></span>
<strong class="classes">Classes:</strong> <span class='object_link'><a href="Unisec/Bidi.html" title="Unisec::Bidi (class)">Bidi</a></span>, <span class='object_link'><a href="Unisec/Confusables.html" title="Unisec::Confusables (class)">Confusables</a></span>, <span class='object_link'><a href="Unisec/Hexdump.html" title="Unisec::Hexdump (class)">Hexdump</a></span>, <span class='object_link'><a href="Unisec/Properties.html" title="Unisec::Properties (class)">Properties</a></span>, <span class='object_link'><a href="Unisec/Rugrep.html" title="Unisec::Rugrep (class)">Rugrep</a></span>, <span class='object_link'><a href="Unisec/Size.html" title="Unisec::Size (class)">Size</a></span>, <span class='object_link'><a href="Unisec/Surrogates.html" title="Unisec::Surrogates (class)">Surrogates</a></span>, <span class='object_link'><a href="Unisec/Versions.html" title="Unisec::Versions (class)">Versions</a></span>


</p>
Expand All @@ -119,7 +119,7 @@ <h2>

</div>
</dt>
<dd><pre class="code"><span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710">'</span><span style="color:#D20">0.0.3</span><span style="color:#710">'</span></span></pre></dd>
<dd><pre class="code"><span style="background-color:hsla(0,100%,50%,0.05)"><span style="color:#710">'</span><span style="color:#D20">0.0.4</span><span style="color:#710">'</span></span></pre></dd>

</dl>

Expand All @@ -135,9 +135,9 @@ <h2>
</div>

<div id="footer">
Generated on Wed Oct 18 17:02:20 2023 by
Generated on Mon Jan 22 18:11:32 2024 by
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
0.9.34 (ruby-3.2.2).
0.9.34 (ruby-3.3.0).
</div>

</div>
Expand Down
141 changes: 141 additions & 0 deletions docs/yard/Unisec/Bidi.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>
Class: Unisec::Bidi

&mdash; Documentation by YARD 0.9.34

</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 = "Unisec::Bidi";
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> &raquo;
<span class='title'><span class='object_link'><a href="../Unisec.html" title="Unisec (module)">Unisec</a></span></span>
&raquo;
<span class="title">Bidi</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>Class: Unisec::Bidi



</h1>
<div class="box_info">

<dl>
<dt>Inherits:</dt>
<dd>
<span class="inheritName">Object</span>

<ul class="fullTree">
<li>Object</li>

<li class="next">Unisec::Bidi</li>

</ul>
<a href="#" class="inheritanceTree">show all</a>

</dd>
</dl>











<dl>
<dt>Defined in:</dt>
<dd>lib/unisec/bidi.rb</dd>
</dl>

</div>

<h2>Overview</h2><div class="docstring">
<div class="discussion">
<p>Manipulation of bidirectional related content</p>


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


</div><h2>Defined Under Namespace</h2>
<p class="children">




<strong class="classes">Classes:</strong> <span class='object_link'><a href="Bidi/Spoof.html" title="Unisec::Bidi::Spoof (class)">Spoof</a></span>


</p>









</div>

<div id="footer">
Generated on Mon Jan 22 18:11:32 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>

</div>
</body>
</html>
Loading

0 comments on commit f9c2bfe

Please sign in to comment.