Created
April 21, 2020 13:35
-
-
Save matterpreter/e9f337426605b6874a7ee72461adc85a to your computer and use it in GitHub Desktop.
Swap Latin characters to Cyrillic lookalikes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void CyrillicSwap(string latinString) | |
{ | |
Console.OutputEncoding = Encoding.UTF8; | |
Dictionary<string, string> CyrDict = new Dictionary<string, string>() | |
{ | |
{"a", "а"}, // \u0430 | |
{"c", "с"}, // \u0441 | |
{"e", "е"}, // \u0435 | |
{"o", "о"}, // \u043e | |
{"p", "р"}, // \u0440 | |
{"x", "х"}, // \u0445 | |
{"y", "у"}, // \u0443 | |
{"A", "А"}, // \u0410 | |
{"B", "В"}, // \u0412 | |
{"C", "С"}, // \u0421 | |
{"H", "Н"}, // \u041d | |
{"E", "Е"}, // \u0415 | |
{"K", "К"}, // \u041a | |
{"M", "М"}, // \u041c | |
{"O", "О"}, // \u041e | |
{"P", "Р"} // \u0420 | |
}; | |
Random rand = new Random(); | |
StringBuilder str = new StringBuilder(latinString); | |
foreach (KeyValuePair<string, string> r in CyrDict) | |
{ | |
if (rand.Next(0, 2) == 0) | |
{ | |
Console.WriteLine("Swapping {0}", r.Key); | |
str.Replace(r.Key, r.Value); | |
} | |
} | |
Console.WriteLine(); | |
Console.WriteLine("[+] Substitued Cyrillic Output:"); | |
Console.WriteLine("-------------------------------"); | |
Console.WriteLine(str); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment