I Cracked RMIT's Sans AI Anti-Scraping Text With 20 Lines of Python

2026-12-06来源 dev.toEnglish

RMIT University's Sans AI promises text that people can read and AI scrapers cannot. I ran a short experiment against it, and every method I tried got the original text back at 100%.

The idea is appealing. Writers, artists and researchers want their work online without feeding it to training crawlers. RMIT describes two pieces: a Chrome extension that obscures text on a web page, and a scheme that gives each document its own font, so the characters in the page source are meaningless codes that only the font turns back into letters.

I wanted to know how much effort it takes to undo. I treated it like a capture-the-flag exercise: obscure a known text, then try to recover it with the tools a scraper operator would have.

Method

I ran two tracks: one against the real extension, and one against the per-document font scheme, which I rebuilt from RMIT's public description.

Track 1: the real Chrome extension. I put the standard lorem ipsum passage (444 characters) on a plain test page, obscured it with the official Sans AI extension from the Chrome Web Store, and saved the output exactly as the page stored it. Then I analyzed the code points and wrote a decoder.

Track 2: the per-document font scheme. I could not capture a per-document font from the extension, so I rebuilt the scheme in Python with fontTools:

  • Every character is replaced by a random code from the Unicode Private Use Area, which carries no meaning for a scraper.
  • A copy of a monospace font (Liberation Mono) is subset and remapped so those codes draw the right letter shapes. Glyph names and the original character map are stripped.
  • A fresh random key is drawn on every run.
  • A harder variant gives each letter several codes, chosen at random per occurrence, to flatten letter frequencies. My English test text ended up with 137 codes.

I attacked the rebuild three ways, each time with only what a scraper would download:

  1. The page's own font. Compare each glyph outline in the shipped font with a stock copy of the base font.
  2. OCR. Render the page and read it with Tesseract.
  3. Scrambled text alone. No font at all. Treat it as a substitution cipher and solve it with a language model.

Test texts were the 444-character lorem ipsum, a 1,839-character English passage written for the test, and a 500-character excerpt of it. Every score is a character-by-character comparison with the original.

The real extension: 100% with 20 lines of Python

The real extension's output decoded back to the original exactly, with no font and no OCR. For plain text it does not use a custom font at all. It rewrites the text itself: 444 characters became 1,597 code points.

Three layers do the hiding:

  • Reversed chunks (133 in my sample): the text is cut into chunks of 2 to 5 visible characters. Each chunk is stored backwards between a left-to-right isolate plus right-to-left override and a pop directional formatting plus pop directional isolate, so the browser displays it forwards.
  • Invisible characters (621): word joiners, zero-width joiners, zero-width non-joiners, invisible separators and combining grapheme joiners are sprinkled between letters.
  • Cyrillic look-alikes (186): Latin letters are swapped for Cyrillic ones that look identical: і, е, о, а, ѕ, с, р, х and capital Е.

To a naive scraper, "Lorem" arrives as two backwards fragments, "оL" and "mеr", with a Cyrillic о and е and invisible characters inside. Tokenizers and keyword search both choke on that. A human sees "Lorem".

The catch is that every layer is a standard Unicode feature with a standard inverse. Here is the decoder:

import sys, unicodedata LRI, RLO, PDF, PDI = "\u2066", "\u202e", "\u202c", "\u2069" CYR = dict(zip("аеорсхуіѕјԁһӏАЕОРСХВНКМТІЅ", "aeopcxyisjdhlAEOPCXBHKMTIS")) def decode(raw: str) -> str: out, i = [], 0 while i < len(raw): if raw.startswith(LRI + RLO, i): # chunk stored backwards j = raw.index(PDF + PDI, i) out.append(raw[i + 2:j][::-1]) i = j + 2 else: out.append(raw[i]) i += 1 text = "".join(out) text = "".join(c for c in text # drop invisible characters if unicodedata.category(c) not in ("Cf", "Mn")) return "".join(CYR.get(c, c) for c in text) # Cyrillic look-alikes -> Latin if __name__ == "__main__": print(decode(open(sys.argv[1], encoding="utf-8").read())) 

Run on the captured output, it returns all 444 characters, and a string comparison with the original returns True. Because the page displays plain letters, OCR on a screenshot works as well.

Order matters. Reverse the chunks first, while the direction controls still mark their boundaries, then strip the invisible characters, then fold the look-alikes. Stripping first destroys the chunk markers.

The look-alike table is the only part that needs care. My sample used nine Cyrillic letters. A production scraper would use the full Unicode confusables list.

The font scheme: three attacks, three wins

The font scheme is the stronger idea, and it still fell to all three attacks. Scores on the 1,839-character English text and the 444-character lorem ipsum:

  • Glyph outline match: 100% and 100%.
  • OCR, single pass: 99.5% and 99.3%.
  • OCR with voting per code: 100% and 100%.
  • Text only, letter 4-grams: 99.2% and 98.4%.
  • Text only, word-level model: 100% and 99.55% (100% with one more step, below).

Attack 1: the font is the key. The shipped font has to draw a real "e" for the reader, so its outline for each random code is the outline of a real letter. I compared every glyph in the page's font with the stock font and matched them up. That gave 100% on every run, including the variant with several codes per letter, because all the codes for one letter point to the same shape. Even against a different monospace font (DejaVu Sans Mono), image matching still got 93.8%.

Attack 2: OCR with voting. A single Tesseract pass got 99.5%. The trick that closed the gap is that each hidden code appears many times. I rendered the page at two sizes, aligned the OCR output with the codes, and let every occurrence vote on its code's letter, with one extra vote from glyph-shape matching. One misread cannot outvote twenty good reads. That gave 100% on the English text, the lorem ipsum and the 500-character excerpt.

Attack 3: no font at all. With one code per letter, the scrambled text is a classic substitution cipher, the kind printed in newspapers as a puzzle. A solver using English letter 4-gram statistics and simulated annealing reached 99.2% in about 12 seconds. A second stage that scores whole words, word pairs and word triples, in English and in Latin, reached 100% on the English text.

Lorem ipsum is the instructive edge case. The word-level model returned "Morem" for "Lorem" and "Quis" for "Duis", because neither original word is real Latin and each capital appears only once. Recognizing the decoded text as the standard lorem ipsum passage settles both and gives 100%. Context beats cryptography here.

Text-only recovery does have limits. On the 500-character excerpt the best result was 99.8%: "A fuel truck" came back as "I fuel truck", a single capital with no other clue. With several codes per letter, text-only recovery stopped at 97.7%, mostly periods read as commas. In both cases the font attack still gives 100%.

Limitations

This was a small experiment, and the results should be read with its limits in mind.

  • One real sample. The extension obscured text only once per page in my test, so I captured one output: the 444-character lorem ipsum. My English text was never run through the real extension.
  • The font scheme was a rebuild. The font results come from my reimplementation of RMIT's description. The real implementation may differ in details such as altered glyph shapes or decoy glyphs.
  • The PDF converter was not tested.
  • Short texts. My texts run from 444 to 1,839 characters. Longer documents make the text-only and OCR voting attacks stronger, because every code appears more often.
  • The decoder is fitted to this sample. A different version of the extension could use other scripts or other invisible characters. That would mean a larger table, not a new method.

Conclusion

Sans AI stops copy-paste and lazy scrapers that read raw HTML text. It does not stop anyone who spends a few minutes looking at the output.

The reason is structural, not a bug in RMIT's code. Any scheme that a browser must undo to show the text ships everything needed to undo it. The extension relies on Unicode features with documented inverses. The font scheme sends its key, the font, along with the lock. And a page that renders readable letters can always be read by OCR.

For teams building "AI-proof" content, three practical takeaways:

  1. Normalize before you trust text. Bidirectional controls, zero-width characters and homoglyphs are also how phishing links and prompt injections hide. Strip and fold them in any pipeline that ingests web text.
  2. Obfuscation is not access control. If content must stay out of training sets, keep it behind authentication, rate limits or licensing terms.
  3. Accessibility pays the bill. Screen readers and search engines read the same scrambled characters that scrapers do, so the protection hurts real readers too.

If a browser can show it, a machine can read it.

Claude, Anthropic's AI assistant, helped me run the tests and write this article.

原文:https://www.a8q9.cn/en/article/i-cracked-rmit-s-sans-ai-anti-scraping-text-with-20-lines-of-python-e69e31.html

相关文章