Package: text-scrambler
Using the Unicode confusable characters and other tricks, we can transform a text into another that looks exactly like it but remains different from a machine view.ExamplesReplacing randomly the Latin characters by Greek or Cyrillic letters and adding the ZW(N)J.Original text:Herman Melville (August 1, 1819 – September 28, 1891) was an American novelist, short story writer, and poet of the American Renaissance period. Among his best-known works are Moby-Dick (1851), Typee (1846), a romanticized account of his experiences in Polynesia, and Billy Budd, Sailor, a posthumously published novella. Although his reputation was not high at the time of his death, the centennial of his birth in 1919 was the starting point of a Melville revival and Moby-Dick grew to be considered one of the great American novels.Srambled text with zw(n)j added (looking the same but totally different):H‍e‌r‌m‍a‍n‌ ‌M‍e‌l‌v‌i‍l‍l‍e‍ ‌(‍A‍u‍g‌u‌s‍t‌ ‌1‌,‌ ‍1‍8‌1‍9‌ ‌–‌ ‌S‍e‌p‌t‌e‍m‍b‍e‌r‌ ‍2‌8‍,‍ ‍1‍8‌9‌1‍)‌ ‌w‍a‌s‍ ‌a‍n‌ ‍A‌m‌e‌r‌i‌c‍a‌n‍ ‍n‌o‍v‌e‍l‌i‌s‍t‍,‍ ‌s‍h‌o‍r‍t‌ ‍s‌t‌o‌r‍y‍ ‌w‌r‍i‌t‍e‌r‌,‌ ‍a‍n‍d‍ ‌p‌o‌e‌t‌ ‍o‌f‍ ‌t‌h‍e‌ ‌A‍m‌e‍r‌i‍c‌a‌n‍ ‍R‍e‌n‍a‍i‍s‍s‌a‌n‍c‌e‍ ‌p‍e‌r‍i‌o‌d‌.‍ ‍A‌m‍o‌n‍g‍ ‍h‍i‌s‍ ‌b‍e‌s‍t‍-‌k‍n‌o‍w‌n‍ ‌w‍o‌r‍k‍s‌ ‍a‌r‍e‍ ‍M‍o‌b‍y‌-‍D‌i‍c‍k‍ ‍(‌1‍8‌5‍1‍)‍,‌ ‌T‍y‌p‍e‌e‌ ‍(‌1‍8‌4‌6‍)‌,‍ ‌a‌ ‍r‌o‌m‍a‌n‍t‌i‍c‍i‌z‌e‍d‌ ‍a‍c‌c‍o‌u‍n‌t‌ ‍o‌f‌ ‍h‌i‍s‌ ‍e‍x‍p‍e‌r‌i‌e‌n‍c‌e‍s‌ ‌i‍n‍ ‍P‍o‌l‌y‌n‍e‍s‌i‍a‌,‍ ‍a‍n‍d‍ ‍B‍i‍l‍l‌y‌ ‌B‌u‌d‍d‌,‍ ‍S‍a‌i‌l‌o‍r‌,‍ ‍a‌ ‍p‌o‌s‍t‌h‍u‍m‌o‍u‌s‍l‍y‌ ‌p‍u‌b‍l‍i‌s‌h‍e‌d‍ ‍n‌o‌v‌e‌l‍l‍a‍.‌ ‍A‍l‍t‍h‌o‍u‍g‍h‍ ‍h‌i‍s‌ ‌r‍e‌p‍u‍t‌a‍t‍i‌o‌n‍ ‌w‍a‌s‌ ‍n‌o‌t‌ ‍h‌i‌g‍h‌ ‍a‌t‌ ‌t‌h‌e‌ ‌t‍i‍m‍e‍ ‍o‍f‌ ‌h‌i‍s‍ ‌d‌e‍a‍t‍h‌,‌ ‌t‍h‌e‍ ‌c‍e‌n‍t‌e‍n‌n‌i‍a‍l‌ ‍o‍f‌ ‍h‍i‌s‍ ‍b‍i‌r‌t‍h‍ ‌i‌n‌ ‍1‌9‍1‌9‌ ‌w‍a‍s‍ ‌t‌h‌e‍ ‌s‌t‍a‍r‌t‍i‍n‍g‍ ‍p‍o‌i‌n‌t‌ ‍o‌f‌ ‍a‌ ‍M‍e‌l‌v‌i‍l‌l‌e‍ ‌r‍e‍v‌i‌v‍a‍l‍ ‌a‌n‍d‌ ‍M‍o‍b‌y‍-‌D‌i‌c‌k‍ ‍g‍r‌e‌w‍ ‌t‌o‌ ‌b‍e‍ ‌c‌o‌n‍s‌i‌d‌e‍r‌e‌d‌ ‌o‍n‍e‌ ‍o‌f‌ ‍t‌h‌e‍ ‍g‍r‌e‍a‌t‌ ‌A‌m‍e‌r‌i‍c‍a‍n‍ ‍n‌o‌v‌e‍l‌s‍.Srambled text with latin letter replaced with their Cyrillic/Greek equivalent:Неrman Melvіllе (Αuguѕt 1, 1819 – Septеmber 28, 1891) wаѕ an Аmеrісаn nοvеlist, shοrt story writеr, and poеt оf the Americаn Rеnaіssanсe pеriоd. Amоng his bеst-known works arе Μoby-Dісk (1851), Τyреe (1846), a rоmаnticizеd accоunt оf hіs eхрerіencеs in Ρоlynеѕiа, аnd Вilly Budd, Ѕаіlοr, а pοsthumously рublіshed nоvеllа. Although hiѕ reputation was nοt hіgh at thе tіme οf hіѕ dеаth, the сentennіаl оf hіs bіrth in 1919 waѕ thе stаrting point οf a Μelville revival and Μοby-Dick grew tο bе соnѕidеrеd οne оf the great American novels.Srambled text with both changes:H‍e‌r‌m‍a‍n‌ ‌Μ‍e‍l‍v‌і‍l‍l‌е‍ ‌(‍А‌u‌g‍u‍ѕ‌t‍ ‌1‍,‍ ‌1‌8‍1‍9‌ ‌–‍ ‍S‍e‌p‌t‌e‌m‍b‍e‍r‍ ‌2‍8‌,‌ ‍1‍8‍9‍1‍)‍ ‍w‍a‍ѕ‌ ‌a‍n‌ ‌Α‍m‍e‌r‌i‍с‌a‌n‍ ‌n‌o‍v‍e‌l‍i‍ѕ‌t‌,‌ ‌s‍h‌ο‍r‍t‍ ‍ѕ‌t‌ο‌r‍y‍ ‍w‌r‍i‍t‌е‌r‌,‍ ‌а‌n‌d‍ ‌p‌о‌е‌t‍ ‌ο‍f‌ ‍t‌h‍e‍ ‍А‍m‌e‌r‍і‌c‍а‍n‍ ‍R‍е‍n‍a‍i‌s‍s‍a‍n‍с‌е‌ ‌p‍е‍r‍i‍о‍d‌.‌ ‌A‍m‍ο‍n‌g‌ ‌h‌i‌ѕ‍ ‍b‍е‌s‍t‌-‍k‌n‌ο‍w‍n‍ ‌w‌о‌r‌k‌ѕ‌ ‍a‌r‌е‌ ‌M‍о‍b‍y‌-‍D‌i‍c‌k‍ ‌(‌1‍8‍5‍1‍)‌,‌ ‌T‍y‍p‌е‍е‍ ‍(‌1‌8‌4‌6‌)‍,‍ ‌a‍ ‍r‍ο‍m‌а‌n‌t‌і‍с‍і‍z‍e‌d‌ ‍a‌с‍c‍о‌u‍n‍t‍ ‌ο‌f‌ ‍h‍і‍s‍ ‍e‌x‌р‍e‍r‌і‌е‍n‍c‌e‍s‌ ‌і‌n‍ ‍Р‍о‍l‌y‌n‍е‍s‍і‍а‌,‌ ‍a‍n‍d‌ ‍В‌i‍l‍l‌y‍ ‌Β‍u‌d‍d‍,‍ ‌Ѕ‌а‍i‌l‌ο‍r‌,‍ ‌a‌ ‌p‍ο‍ѕ‌t‌h‍u‍m‍о‍u‌ѕ‍l‌y‍ ‌p‌u‍b‌l‍i‌ѕ‌h‍е‌d‍ ‌n‌о‌v‍е‍l‌l‍a‍.‍ ‍A‍l‍t‍h‌о‌u‌g‍h‍ ‍h‌i‍s‌ ‌r‌e‌р‌u‌t‍a‍t‌і‌o‍n‌ ‍w‍а‌ѕ‌ ‌n‌о‍t‌ ‍h‍і‌g‌h‍ ‍а‍t‌ ‍t‍h‌е‍ ‌t‍і‍m‍e‍ ‌o‍f‍ ‌h‌і‍s‍ ‌d‍e‍а‍t‍h‍,‍ ‍t‌h‌е‍ ‌с‌e‍n‍t‍e‌n‌n‍і‍a‌l‌ ‍o‍f‌ ‍h‍і‍ѕ‍ ‍b‌i‍r‍t‌h‌ ‌і‌n‌ ‍1‍9‍1‍9‌ ‌w‌а‌s‌ ‌t‌h‍e‍ ‌s‌t‌а‌r‌t‌і‍n‍g‍ ‌р‍ο‍і‍n‌t‍ ‌ο‌f‌ ‍a‌ ‌Μ‍e‌l‍v‍i‍l‌l‍е‌ ‍r‌е‍v‍i‌v‍а‍l‍ ‍a‌n‌d‍ ‍М‍o‌b‍y‌-‍D‌і‌с‌k‍ ‌g‍r‌е‌w‌ ‍t‍ο‍ ‌b‌e‍ ‍с‍o‍n‍s‍i‌d‌e‌r‌e‌d‍ ‍о‍n‍e‌ ‌o‍f‍ ‌t‌h‍е‍ ‌g‍r‌e‌а‍t‍ ‍А‍m‌е‌r‌i‌с‌а‍n‌ ‌n‍o‌v‍e‍l‌s‍.It is worth to notice that search engines can’t find the original webpage (as free online plagiarism checkers). Searching forΜelvillе(with cyrillic letters) (copy-paste it) on Google doesn’t return any match, though the original wordMelvilledoes.Using all of the confusable characters of unicode (see the unicode confusable characters below), we can generate weird looking text worthy of old spam messages:𝚮‍𝒆‌𝕣‍m‍𝓪‍n‍ ‍𝝡‍ҽ‌𝟙‍∨‍𝘪‍𝘐‌𞺀‍𝓮‍ ‍﴾‍𝓐‍𝞄‍𝓰‍ꞟ‌𑣁‍t‌ ‌1‌,‌ ‍1‍8‌1‍Ⳋ‌ ‍–‍ ‌Ꮥ‌𝖊‍𝞺‌𝐭‍𝖾‌m‍Ƅ‌𝔢‌𝔯‌ ‍Ƨ‍𐌚‌ꓹ‌ ‍1‍ଃ‌𝟿‍1‍］‌ ‍𝘸‍𝐚‍𝚜‍ ‍𝖺‌𝔫‍ ‍Α‍m‌ℯ‌𝔯‌𝓲‌ꮯ‌𝒶‌𝓷‌ ‍n‌ം‍𝝼‍𝔢‍𝙸‌ｉ‌s‌𝖙‍؍‍ ‍𐑈‌𝖍‌ꬽ‍ꭇ‍𝓽‍ ‌𝓼‌𝖙‍ⲟ‌r‌𑣜‍ ‍𝐰‌𝓻‌і‍𝒕‍е‍𝕣‍٫‍ ‍α‌𝒏‌𝕕‍ ‍𝙥‌𝜊‍ｅ‍𝕥‍ ‍ﮨ‍f‌ ‌𝘵‍ｈ‍𝗲‌ ‌Α‌m‍𝐞‍𝐫‌ꙇ‌𝒸‍ａ‍n‌ ‍𖼵‍𝘦‍𝑛‌𝐚‌𝒾‌𝑠‌𑣁‌𝜶‌𝕟‌𝗰‌𝒆‍ ‌𝟈‍𝖾‌r‍⍳‌ﮫ‌ᑯ‌𐩐‌ ‍Α‌m‍ｏ‍𝓃‌𝖌‍ ‌𝓱‌Ꭵ‌𝐬‍ ‌Ꮟ‍𝙚‌𝗌‍𝕥‌۔‍𝖐‌𝖓‌ｏ‌𝑤‍𝐧‍ ‌𑜎‌о‌ꮁ‍𝐤‌𝗌‍ ‌𝜶‍𝗿‍𝖾‌ ‌𝕸‍໐‍Ꮟ‍𝙮‍Ⲻ‍𝖣‍𝑖‍𝔠‌𝒌‌ ‍〔‍1‌𝟪‌5‍1‍〕‌ꓹ‌ ‌𝖳‍𝗒‌𝓹‍𝘦‌𝚎‌ ‌〔‍1‍🯸‌𝟜‌6‍❳‍ꓹ‌ ‍𝖆‍ ‌𝕣‌ꬽ‍m‍⍺‌𝘯‌𝘵‌і‌ꮯ‌𝛊‍𝐳‍ⅇ‍𝙙‍ ‍𝕒‌ｃ‍ᴄ‌ჿ‌𝚞‍𝚗‌𝐭‍ ‍𞹤‍𝔣‍ ‍𝚑‌ӏ‌𝓈‌ ‍𝕖‍𝑥‌𝙥‍𝔢‍𝗿‍ꙇ‌e‌𝓷‍ｃ‌℮‍ꮪ‌ ‌𝖎‍𝚗‍ ‌𝙋‍𝘰‌Ӏ‍γ‌𝓷‍𝖾‍𝔰‍𝚒‌𝗮‌؍‍ ‌𝛼‍𝔫‍𝖉‌ ‍𝔅‌Ꭵ‌𝖑‌l‌𝔂‌ ‌𝓑‍𝐮‌𝖉‌𝒹‌‚‌ ‍Ꮥ‌а‌ꙇ‌𝘭‍𝝈‍𝗋‌,‍ ‌α‍ ‍𝑝‍ꬽ‍𐑈‍𝓽‌һ‍𝛖‍m‍𞺄‌ᴜ‍𝔰‍𝗹‌𝑦‍ ‌𝖕‍ᴜ‍Ꮟ‍𝝞‌𝜄‌s‍ｈ‍𝗲‍ꓒ‌ ‌𝓃‍𝗈‌𝓋‍𝒆‌𐌉‌ו‌𝞪‍꘎‍ ‍𖽀‍𝜤‍𝑡‍һ‍𝙤‍𝑢‌ց‍𝘩‌ ‌𝒉‌ι‍ѕ‌ ‌𝖗‌𝒆‌𝛠‍𝚞‍𝐭‌𝓪‌𝙩‌ɪ‍ﮨ‍𝓷‍ ‌𑜊‍𝖺‍s‌ ‍𝘯‍𞹤‍𝚝‌ ‌𝐡‌𝜄‌ᶃ‍𝕙‍ ‍𝖆‍𝘁‍ ‌𝙩‍ｈ‍ꬲ‌ ‍𝓉‌𝔦‍m‍е‍ ‌𝞼‍ẝ‍ ‍ℎ‌ı‍ƽ‍ ‌𝐝‌𝕖‍𝖆‍𝚝‌𝔥‌ꓹ‌ ‍𝙩‌Ꮒ‌ꬲ‍ ‌𝗰‌ⅇ‌𝗻‌𝔱‍𝖊‌𝖓‌n‍𝛊‍𝙖‌𐌠‌ ‍ﻫ‍𝘧‌ ‌𝒽‍𝖎‍𝘴‍ ‍b‍ı‌𝚛‌𝓽‌𝘩‌ ‌ｉ‌𝐧‍ ‍1‍𑣖‌1‍𝟵‌ ‍𑜏‌α‌𝗌‌ ‌𝗍‌𝐡‌ҽ‍ ‍𝕤‍𝑡‍𝛂‌r‍𝓉‍Ꭵ‌𝚗‍ᶃ‍ ‌𝛒‍ס‌𝜾‍𝗻‌𝖙‌ ‌𝜊‌𝖋‌ ‍𝙖‌ ‍ꓟ‍𝙚‌ⵏ‌𝛎‍˛‍І‍𝘭‍ҽ‌ ‌𝔯‍𝐞‌ｖ‌𝞲‌𝚟‌𝖆‍l‍ ‍ɑ‍𝘯‍𝖽‍ ‍𝑀‌ං‌𝒃‍𝚢‌‐‍𝐷‍ͺ‌𝚌‌𝗸‍ ‌𝓰‌ꭈ‌е‌ᴡ‌ ‍𝓉‌ﮭ‌ ‌ᑲ‍ℯ‍ ‌ｃ‍ℴ‍𝙣‌𝔰‌𑣃‍d‍ⅇ‍𝔯‌℮‌ⅾ‍ ‍ﻬ‌𝓃‌℮‍ ‌੦‌𝙛‌ ‍𝙩‌𝔥‍𝔢‍ ‌𝚐‍ꮁ‌ℯ‍𝜶‍𝙩‍ ‍𝞐‍m‍𝘦‍ᴦ‌𝜾‌𝙘‌𝕒‍𝐧‍ ‍𝓃‌ｏ‌𝓿‌ⅇ‍|‍𝒔‍ꓸFull documentation athttps://text-scrambler.readthedocs.ioInstallationpipinstalltext-scramblerQuickstartPython>>>fromtext_scramblerimportScrambler>>>scr=Scrambler()>>>text="This is an example">>>text_1=scr.scramble(text,level=1)>>>#############>>># adding only zwj/zwnj characters>>>print(text,text_1,sep="\\n")ThisisanexampleT‌h‍i‍s‌‍i‌s‍‌a‌n‌‍e‍x‌a‍m‍p‌l‌e>>>asserttext!=text_1>>>print(len(text),len(text_1))1835>>># though the texts look similar, the second one has more characters>>>#############>>>text_2=scr.scramble(text,level=2)>>># replacing some latin letters by their cyrillic/greek equivalent>>>print(text_2)Тhiѕiѕanехаmple>>>forchar,char_2inzip(text,text_2):...ifchar!=char_2:...print(char,char_2)...TТsѕsѕeеxхaа>>>#############>>>text_3=scr.scramble(text,level=3)>>># adding zwj/zwnj characters and replacing latin letters>>>print(text_3)T‌h‍і‍s‌‍i‌ѕ‍‍а‌n‍‌e‌х‍а‌m‍p‌l‌e>>>print(text,text_3,sep="\\n")ThisisanexampleT‌h‍і‍s‌‍i‌ѕ‍‍а‌n‍‌e‌х‍а‌m‍p‌l‌e>>>asserttext_3!=text>>>#############>>>text_4=scr.scramble(text,level=4)>>># replacing all characters by any unicode looking like character>>>print(text_4)⊤‌𝒽‍𝐢‌𝘴‌‌𝘪‍𝙨‌‍𝞪‍ռ‍‌𝙚‍⨯‍𝚊‍m‌ρ‍𝟙‌ҽ>>>#>>># generating several versions>>>versions=scr.generate(text,10,level=4)>>>fortxtinversions:...print(txt)...𝕋‌𝗵‌𝕚‍𝔰‍‍𝙞‌ѕ‌‌ɑ‍𝗇‌‌ꬲ‍𝗑‍𝒂‍m‌𝛠‍Ⲓ‍𝚎𝔗‌һ‌𑣃‍ƽ‌‌˛‍ꜱ‍‍𝛼‍𝐧‌‌𝐞‍𝖝‍𝛼‌m‌𝜌‌𝟏‌ℯＴ‌ｈ‌𝓲‌𝔰‌‌ⅈ‌𝔰‍‌α‌n‌‍ꬲ‌⤬‌α‌m‌⍴‍𞸀‌ｅ𝗧‍𝗵‍i‍𝑠‍‌ｉ‌𝖘‌‍⍺‍𝘯‌‌𝗲‌𝔁‍а‌m‍𝘱‍𝙸‍𝔢⊤‌𝚑‍𝑖‌ｓ‌‍ɪ‌𝚜‌‍𝜶‍𝑛‌‍𝖾‍𝘅‍𝒶‍m‍𝛒‍𝑙‌𝓮𝘛‌ｈ‍𝙞‍ꮪ‍‌ⅈ‌𝗌‍‍𝗮‌𝐧‍‍ꬲ‌ᕽ‍𝓪‌m‌𝜌‌⏽‍𝓮𝙏‌𝕙‍і‍𝓈‌‌ı‍ꜱ‍‌𝔞‍𝕟‍‍𝗲‍𝕩‍𝛂‍m‍р‍𐌉‌𝚎𝕿‌Ꮒ‌ℹ‌𝐬‌‍𝗶‌𝗌‌‍𝛼‍𝔫‌‍𝗲‍𝐱‍𝓪‌m‍𝞎‌𝙡‌𝖊⟙‌ｈ‍𝜾‍ꮪ‍‌ｉ‍𝘴‍‌𝝰‍𝒏‌‌𝙚‍ᕽ‍𝗮‍m‌𝗽‌𝗜‍𝗲𝖳‌հ‌𝒊‌s‌‍𝕚‌𝙨‌‌𝖆‌𝑛‌‌𝘦‌𝔁‌а‌m‌𝜌‌𝐈‍𝗲>>>versions=scr.generate(text,1000,level=1)>>>assertlen(versions)==len(set(versions))>>># all uniqueCommand line interface (CLI)To get words from input words through CLI, run$python-mtext_scramblerusage:Usage:python-mtext_scramblerfileReplace/insertthecharatersofthefileusingtheunicodeconfusablecharacterspositionalarguments:fileencodedinUTF-8optionalarguments:-h,--helpshowthishelpmessageandexit-lLEVEL,--levelLEVEL1:insertnonprintablecharacterswithinthetext2:replacesomelatinletterstotheirGreekorCyrillicequivalent3:insertnonprintablecharactersandchangethesomelatintotheirGreekorCyrillicequivalent4:insertnonprintablechraracterschangeallpossiblelettertoarandomlypickedunicodeletterequivalentdefault=1-nN,--generateNScramblentimesthestringdefault=1LinksSeehttps://en.wikipedia.org/wiki/Word_joinerfor more info on word joinersSeehttps://unix.stackexchange.com/questions/469347/using-uniq-on-unicode-textfor why in this case thesortcommand wouldn’t work well to check the uniqueness of those stringsSeehttp://www.unicode.org/Public/security/revision-03/confusablesSummary.txtfor the complete list of confusable.