Skip to content

Commit 45c6fe1

Browse files
committed
feat: initial
0 parents  commit 45c6fe1

13 files changed

Lines changed: 2449 additions & 0 deletions

File tree

.github/actions/base/action.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: Base Workflow
2+
description: Reusable base workflow
3+
4+
inputs:
5+
go-version:
6+
description: "Go version to use"
7+
required: true
8+
9+
runs:
10+
using: "composite"
11+
steps:
12+
- name: Set up Go
13+
uses: actions/setup-go@v5
14+
with:
15+
go-version: ${{ inputs.go-version }}

.github/workflows/commit.yaml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Commit
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- master
8+
pull_request:
9+
10+
permissions:
11+
contents: read
12+
13+
jobs:
14+
build:
15+
name: Lint commits
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- name: Checkout repository
20+
uses: actions/checkout@v4
21+
22+
- name: Run base workflow
23+
uses: ./.github/actions/base
24+
with:
25+
go-version: '1.24'

.github/workflows/release.yaml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Build and Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
build:
13+
name: Build and Release Binaries
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Checkout repository
18+
uses: actions/checkout@v4
19+
20+
- name: Run base workflow
21+
uses: ./.github/actions/base
22+
with:
23+
go-version: '1.24'
24+
25+
- name: Build
26+
run: bash ./build.sh
27+
28+
- name: Create GitHub release
29+
uses: ncipollo/release-action@v1
30+
with:
31+
tag: ${{ github.ref_name }}
32+
name: Release ${{ github.ref_name }}
33+
bodyFile: release.md
34+
artifacts: ./build/*

.gitignore

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
# File created using '.gitignore Generator' for Visual Studio Code: https://bit.ly/vscode-gig
2+
# Created by https://www.toptal.com/developers/gitignore/api/windows,visualstudiocode,go,linux,macos
3+
# Edit at https://www.toptal.com/developers/gitignore?templates=windows,visualstudiocode,go,linux,macos
4+
5+
### Go ###
6+
# If you prefer the allow list template instead of the deny list, see community template:
7+
# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore
8+
#
9+
# Binaries for programs and plugins
10+
*.exe
11+
*.exe~
12+
*.dll
13+
*.so
14+
*.dylib
15+
16+
# Test binary, built with `go test -c`
17+
*.test
18+
19+
# Output of the go coverage tool, specifically when used with LiteIDE
20+
*.out
21+
22+
# Dependency directories (remove the comment below to include it)
23+
# vendor/
24+
25+
# Go workspace file
26+
go.work
27+
28+
### Linux ###
29+
*~
30+
31+
# temporary files which can be created if a process still has a handle open of a deleted file
32+
.fuse_hidden*
33+
34+
# KDE directory preferences
35+
.directory
36+
37+
# Linux trash folder which might appear on any partition or disk
38+
.Trash-*
39+
40+
# .nfs files are created when an open file is removed but is still being accessed
41+
.nfs*
42+
43+
### macOS ###
44+
# General
45+
.DS_Store
46+
.AppleDouble
47+
.LSOverride
48+
49+
# Icon must end with two \r
50+
Icon
51+
52+
53+
# Thumbnails
54+
._*
55+
56+
# Files that might appear in the root of a volume
57+
.DocumentRevisions-V100
58+
.fseventsd
59+
.Spotlight-V100
60+
.TemporaryItems
61+
.Trashes
62+
.VolumeIcon.icns
63+
.com.apple.timemachine.donotpresent
64+
65+
# Directories potentially created on remote AFP share
66+
.AppleDB
67+
.AppleDesktop
68+
Network Trash Folder
69+
Temporary Items
70+
.apdisk
71+
72+
### macOS Patch ###
73+
# iCloud generated files
74+
*.icloud
75+
76+
### VisualStudioCode ###
77+
.vscode/*
78+
!.vscode/settings.json
79+
!.vscode/tasks.json
80+
!.vscode/launch.json
81+
!.vscode/extensions.json
82+
!.vscode/*.code-snippets
83+
84+
# Local History for Visual Studio Code
85+
.history/
86+
87+
# Built Visual Studio Code Extensions
88+
*.vsix
89+
90+
### VisualStudioCode Patch ###
91+
# Ignore all local history of files
92+
.history
93+
.ionide
94+
95+
### Windows ###
96+
# Windows thumbnail cache files
97+
Thumbs.db
98+
Thumbs.db:encryptable
99+
ehthumbs.db
100+
ehthumbs_vista.db
101+
102+
# Dump file
103+
*.stackdump
104+
105+
# Folder config file
106+
[Dd]esktop.ini
107+
108+
# Recycle Bin used on file shares
109+
$RECYCLE.BIN/
110+
111+
# Windows Installer files
112+
*.cab
113+
*.msi
114+
*.msix
115+
*.msm
116+
*.msp
117+
118+
# Windows shortcuts
119+
*.lnk
120+
121+
# End of https://www.toptal.com/developers/gitignore/api/windows,visualstudiocode,go,linux,macos
122+
123+
# Custom rules (everything added below won't be overriden by 'Generate .gitignore File' if you use 'Update' option)
124+
125+
homoglitch.go
126+
homoglyph.go
127+
build

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 WoozyMasta
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# homoglyph / homoglitch
2+
3+
CLI tools to make text human-readable but machine-hostile.
4+
5+
They replace characters with visually identical or similar Unicode homoglyphs and optionally inject zero-width spaces to break indexing, searching, and translation.
6+
7+
## homoglyph example
8+
9+
Each time you get a new unique line with `homoglyph`
10+
11+
```bash
12+
# run 3 times
13+
echo 'Just a random string for example!' | homoglyph
14+
Ϳս​​ѕt а r​​​а​​​​ոԁom ѕt​ri​​ոg f​​or ех​аm​​​plеǃ
15+
Ϳ​​ս​​​ѕt а rаո​​ԁom ѕ​​​​​​tr​​​iոg f​or ех​​​аm​plеǃ
16+
Ϳս​ѕt а r​​​​​​​аոԁom ѕ​tr​​​​​iոg f​​​or е​​х​​​​аmplеǃ
17+
```
18+
19+
Which a machine won't always be able to recognize
20+
21+
![example](example.png)
22+
23+
A string of different length with a different set and number of characters
24+
is always generated
25+
26+
```bash
27+
for _ in {0..10}; do
28+
echo 'Just a random string for example!' | ./homoglitch | wc -c | tr -d '\n'
29+
printf ' '
30+
done
31+
32+
169 186 156 194 164 174 166 189 156 169 161
33+
```
34+
35+
## homoglitch example
36+
37+
But if the result is not good enough, there is a more hardcore
38+
solution `homoglitch`
39+
40+
```bash
41+
# run 3 times
42+
echo 'Just a random string for example!' | homoglitch
43+
Ϳ​​​​​​𝓾𝑠𝒕 ɑ 𝘳​𝚊​​​𝒏​​​ꓒ𝗢m 𝐬𝕥​​​ꭈ𝑙𝑛𝗴 𝕗​​​ﮨ𝗋 𝓮​x​𝒂​​m⍴іⅇǃ
44+
𝗝​​ꭒ​ƽ𝘵 𝖺 𝕣​​​𝛼​​𝖓𝓭​𑣗m 𝐬​​𝓽​𝗋𝚒ռ𝑔 ẝ​𝛐𝐫 е​​​​​​​​​​𝔁​​​аm𝞀𝙡𝐞ⵑ
45+
ꓙ​​​𝑢​𝐬𝔱 𝛂 ᴦ𝖺​​​​​​𝗇ⅾ૦m 𝖘​𝖙​​𝚛⏽ո𝖌 ẝ​​​𐐬𝓇 𝙚​⤫ɑm𝝔​​𝚕e!
46+
```
47+
48+
## Build
49+
50+
First, generate `homoglyphs.go` from a homoglyph set:
51+
52+
### homoglyph
53+
54+
```bash
55+
# For a visually invisible replacement
56+
rm homo*.go
57+
go run generate.go glyph.txt
58+
CGO_ENABLED=0 go build -o homoglyph.exe -ldflags "-s -w" -trimpath -gcflags=all="-N -l" ./...
59+
rm homoglyph.go
60+
# or
61+
./build.sh glyph.txt
62+
```
63+
64+
### homoglitch
65+
66+
```bash
67+
# For aggressive chaotic substitution
68+
rm homo*.go
69+
go run generate.go glitch.txt
70+
CGO_ENABLED=0 go build -o homoglitch.exe -ldflags "-s -w" -trimpath -gcflags=all="-N -l" ./...
71+
rm homoglitch.go
72+
# or
73+
./build.sh glitch.txt
74+
```
75+
76+
The glitch.txt file is based on
77+
[codebox/homoglyph](http://github.com/codebox/homoglyph).

build.sh

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#!/usr/bin/env bash
2+
# require upx
3+
set -eu
4+
5+
: "${WORK_DIR:=./}"
6+
: "${CHARS_FILE:=${1:-glyph.txt}}"
7+
8+
build() {
9+
local GOOS="${1:-linux}" GOARCH="${2:-amd64}" bin
10+
11+
bin="homo${CHARS_FILE%.txt}-$GOOS-$GOARCH"
12+
[ "$GOOS" = windows ] && bin+=.exe
13+
14+
printf 'Build:\t%-10s%-7s' "$GOOS" "$GOARCH"
15+
16+
CGO_ENABLED=0 GOARCH="$GOARCH" GOOS="$GOOS" \
17+
GOFLAGS="-buildvcs=false -trimpath" \
18+
go build -ldflags="-s -w " -o "./build/$bin" "$WORK_DIR"/...
19+
20+
echo "./build/$bin"
21+
}
22+
23+
mkdir -p ./build
24+
rm -f homoglyph.go homoglitch.go
25+
go mod tidy
26+
go run generate.go "$CHARS_FILE"
27+
28+
if [ -z "${3:-}" ]; then
29+
build darwin amd64
30+
build darwin arm64
31+
build linux 386
32+
build linux amd64
33+
build linux arm
34+
build linux arm64
35+
build windows 386
36+
build windows amd64
37+
build windows arm64
38+
else
39+
build "${@:3}"
40+
fi
41+
42+
rm "homo${CHARS_FILE%.txt}.go"

example.png

39 KB
Loading

0 commit comments

Comments
 (0)