Skip to content

Instantly share code, notes, and snippets.

@matterpreter
Created April 21, 2020 13:35
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save matterpreter/e9f337426605b6874a7ee72461adc85a to your computer and use it in GitHub Desktop.
Save matterpreter/e9f337426605b6874a7ee72461adc85a to your computer and use it in GitHub Desktop.
Swap Latin characters to Cyrillic lookalikes
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