@@ -6,7 +6,7 @@ public class ListChecks
6
6
{
7
7
// Map of Cyrillic to Latin characters, to catch attempted bypasses using Cyrillic lookalikes
8
8
// <string, string> is <Cyrillic, Latin>
9
- public static Dictionary < string , string > alphabetMap = new ( )
9
+ public static Dictionary < string , string > cyrillicAlphabetMap = new ( )
10
10
{
11
11
{ "А" , "A" } ,
12
12
{ "В" , "B" } ,
@@ -49,11 +49,49 @@ public class ListChecks
49
49
{ "у" , "y" } ,
50
50
{ "У" , "y" }
51
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
+ {
57
+ { "Α" , "A" } ,
58
+ { "Β" , "B" } ,
59
+ { "Ε" , "E" } ,
60
+ { "Η" , "H" } ,
61
+ { "Ι" , "I" } ,
62
+ { "Κ" , "K" } ,
63
+ { "Μ" , "M" } ,
64
+ { "Ν" , "N" } ,
65
+ { "Ο" , "O" } ,
66
+ { "Ρ" , "P" } ,
67
+ { "Τ" , "T" } ,
68
+ { "Χ" , "X" } ,
69
+ { "Υ" , "Y" } ,
70
+ { "Ζ" , "Z" } ,
71
+ { "α" , "a" } ,
72
+ { "β" , "b" } ,
73
+ { "ε" , "e" } ,
74
+ { "η" , "h" } ,
75
+ { "ι" , "i" } ,
76
+ { "κ" , "k" } ,
77
+ { "μ" , "m" } ,
78
+ { "ν" , "n" } ,
79
+ { "ο" , "o" } ,
80
+ { "ρ" , "p" } ,
81
+ { "τ" , "t" } ,
82
+ { "χ" , "x" } ,
83
+ { "υ" , "y" } ,
84
+ { "ζ" , "z" } ,
85
+ } ;
52
86
53
87
public static ( bool success , string ? flaggedWord ) CheckForNaughtyWords ( string input , WordListJson naughtyWordList )
54
88
{
55
89
// Replace any Cyrillic letters found in message with Latin characters, if in the dictionary
56
- foreach ( var letter in alphabetMap )
90
+ foreach ( var letter in cyrillicAlphabetMap )
91
+ input = input . Replace ( letter . Key , letter . Value ) ;
92
+
93
+ // and Greek letters
94
+ foreach ( var letter in greekAlphabetMap )
57
95
input = input . Replace ( letter . Key , letter . Value ) ;
58
96
59
97
string [ ] naughtyWords = naughtyWordList . Words ;
0 commit comments