Skip to content

Commit e34c2be

Browse files
authored
Merge pull request #137 from unixorn/add-icorrupt-again
Add `icorrupt` from hangops
2 parents 317093a + 8409be8 commit e34c2be

File tree

2 files changed

+146
-0
lines changed

2 files changed

+146
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ The scripts in this collection don't actually require you to be using ZSH as you
7373
| `http_headers` | | Dump http headers for a URL |
7474
| `human-path` | coffeeops slack `#commandline-fu` channel | Print `$PATH` with one entry per line to make it easier for humans to tell if something is missing |
7575
| `human-time` | | Converts integer seconds into human-understandable time. `human-time 88000` will print `1d 26m 40s` |
76+
| `icorrupt` | [twirrim/icorrupt](https://gist.github.com/twirrim/b87d08a2436437c8ff97a65877586182) | Corrupts a text string |
7677
| `iflip` | [twirrim/iflip](https://github.com/twirrim/iflip/blob/master/iflip) | Tableflips a text string |
7778
| `ipaddresses` | [email protected] | Dumps all the ip addresses for the host |
7879
| `is-remote-session` | [email protected] | Exits 0 if you're in an `ssh` remote session, 1 otherwise |

bin/icorrupt

Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
#!/usr/bin/env python3
2+
# -*- coding: utf-8 -*-
3+
#
4+
# Original source: https://gist.github.com/twirrim/b87d08a2436437c8ff97a65877586182
5+
6+
import sys
7+
import random
8+
9+
random.seed()
10+
11+
# Can't figure out a way to programmatically generate this
12+
diacritics = [
13+
"\u0300",
14+
"\u0301",
15+
"\u0302",
16+
"\u0303",
17+
"\u0304",
18+
"\u0305",
19+
"\u0306",
20+
"\u0307",
21+
"\u0308",
22+
"\u0309",
23+
"\u030A",
24+
"\u030B",
25+
"\u030C",
26+
"\u030D",
27+
"\u030E",
28+
"\u030F",
29+
"\u0310",
30+
"\u0311",
31+
"\u0312",
32+
"\u0313",
33+
"\u0314",
34+
"\u0315",
35+
"\u0316",
36+
"\u0317",
37+
"\u0318",
38+
"\u0319",
39+
"\u031A",
40+
"\u031B",
41+
"\u031C",
42+
"\u031D",
43+
"\u031E",
44+
"\u031F",
45+
"\u0320",
46+
"\u0321",
47+
"\u0322",
48+
"\u0323",
49+
"\u0324",
50+
"\u0325",
51+
"\u0326",
52+
"\u0327",
53+
"\u0328",
54+
"\u0329",
55+
"\u032A",
56+
"\u032B",
57+
"\u032C",
58+
"\u032D",
59+
"\u032E",
60+
"\u032F",
61+
"\u0330",
62+
"\u0331",
63+
"\u0332",
64+
"\u0333",
65+
"\u0334",
66+
"\u0335",
67+
"\u0336",
68+
"\u0337",
69+
"\u0338",
70+
"\u0339",
71+
"\u033A",
72+
"\u033B",
73+
"\u033C",
74+
"\u033D",
75+
"\u033E",
76+
"\u033F",
77+
"\u0340",
78+
"\u0341",
79+
"\u0342",
80+
"\u0343",
81+
"\u0344",
82+
"\u0345",
83+
"\u0346",
84+
"\u0347",
85+
"\u0348",
86+
"\u0349",
87+
"\u034A",
88+
"\u034B",
89+
"\u034C",
90+
"\u034D",
91+
"\u034E",
92+
"\u034F",
93+
"\u0350",
94+
"\u0351",
95+
"\u0352",
96+
"\u0353",
97+
"\u0354",
98+
"\u0355",
99+
"\u0356",
100+
"\u0357",
101+
"\u0358",
102+
"\u0359",
103+
"\u035A",
104+
"\u035B",
105+
"\u035C",
106+
"\u035D",
107+
"\u035E",
108+
"\u035F",
109+
"\u0350",
110+
"\u0361",
111+
"\u0362",
112+
"\u0363",
113+
"\u0364",
114+
"\u0365",
115+
"\u0366",
116+
"\u0367",
117+
"\u0368",
118+
"\u0369",
119+
"\u036A",
120+
"\u036B",
121+
"\u036C",
122+
"\u036D",
123+
"\u036E",
124+
"\u036F",
125+
]
126+
127+
def add_a_diacritic(base_letter, diacritic_mark):
128+
return base_letter + diacritic_mark
129+
130+
def corrupt_letter(letter):
131+
# Let's use 10 for now
132+
to_add = random.sample(diacritics, 10)
133+
134+
for diacrit in to_add:
135+
letter = letter + diacrit
136+
137+
return letter
138+
139+
def corrupt_text(text):
140+
corrupted = "".join(map(corrupt_letter, text))
141+
print(corrupted)
142+
143+
144+
if __name__ == "__main__":
145+
corrupt_text(sys.argv[1])

0 commit comments

Comments
 (0)