@@ -4,10 +4,10 @@ namespace Cliptok.Checks
4
4
{
5
5
public class ListChecks
6
6
{
7
- // Map of Cyrillic to Latin characters, to catch attempted bypasses using Cyrillic lookalikes
8
- // <string, string> is <Cyrillic, Latin>
9
- public static Dictionary < string , string > cyrillicAlphabetMap = new ( )
7
+ // Map of lookalike to Latin characters, to catch attempted bypasses using different language lookalikes
8
+ public static Dictionary < string , string > lookalikeAlphabetMap = new ( )
10
9
{
10
+ // <string, string> is <Cyrillic, Latin>
11
11
{ "А" , "A" } ,
12
12
{ "В" , "B" } ,
13
13
{ "С" , "C" } ,
@@ -47,13 +47,9 @@ public class ListChecks
47
47
{ "ѡ" , "w" } ,
48
48
{ "х" , "x" } ,
49
49
{ "у" , "y" } ,
50
- { "У" , "y" }
51
- } ;
52
-
53
- // Map of Greek to Latin characters, to catch attempted bypasses using Greek lookalikes
54
- // <string, string> is <Greek, Latin>
55
- public static Dictionary < string , string > greekAlphabetMap = new ( )
56
- {
50
+ { "У" , "y" } ,
51
+
52
+ // <string, string> is <Greek, Latin>
57
53
{ "Α" , "A" } ,
58
54
{ "Β" , "B" } ,
59
55
{ "Ε" , "E" } ,
@@ -83,17 +79,13 @@ public class ListChecks
83
79
{ "υ" , "y" } ,
84
80
{ "ζ" , "z" } ,
85
81
} ;
86
-
82
+
87
83
public static ( bool success , string ? flaggedWord ) CheckForNaughtyWords ( string input , WordListJson naughtyWordList )
88
84
{
89
- // Replace any Cyrillic letters found in message with Latin characters, if in the dictionary
90
- foreach ( var letter in cyrillicAlphabetMap )
85
+ // Replace any lookalike letters found in message with Latin characters, if in the dictionary
86
+ foreach ( var letter in lookalikeAlphabetMap )
91
87
input = input . Replace ( letter . Key , letter . Value ) ;
92
88
93
- // and Greek letters
94
- foreach ( var letter in greekAlphabetMap )
95
- input = input . Replace ( letter . Key , letter . Value ) ;
96
-
97
89
string [ ] naughtyWords = naughtyWordList . Words ;
98
90
input = input . Replace ( "\0 " , "" ) ;
99
91
if ( naughtyWordList . WholeWord )
0 commit comments