I have a question about obfuscate the final output of an HTML and CSS file. Lets stay I have this HTML code below with the corresponding class names declared in a separate CSSfile:
<div class="header">
<div class="logo"></div>
<div class="session-info"></div>
</div>
<div class="bank-account-content">
<div class="account-info"></div>
<div class="account-info"></div>
<div class="here-is-my-ss-number"></div>
</div>
Is there a way to take my HTML/CSS file and process it in a way that it will take original class names/ids in a HTML/CSS file and randomly generate new files to replace the existing class names/ids with meaningless class names/ids to obscure the final output? For example, The above output would be processed and result in the html shown below with a corresponding style sheet that has the abstracted class/id names defined.
<div class="1dcx4y">
<div class="1354fs"></div>
<div class="f3wecd"></div>
</div>
<div class="retv5">
<div class="dgee2f></div>
<div class="fhg54h"></div>
<div class="dgd426"></div>
</div>
Try http://www.cssobfuscator.com/:
What it does:
- It will take your CSS file, apply minification, encoding and encypting and finally injects this unreadable crap into tailored JS library (also obfuscated).
- The result you will get is this tailored (unique) library, containing obfuscated CSS. Just include it in the place of the original CSS.
What it does not:
- It will not speed up displaying of your web.
- It will not hide CSS rules in inspector (developer's tools) - but it don't mind, attacker will probably not copy all stuff by one rule.
Or http://htmlmuncher.com/: (Dead link, Github repository)
HTML Muncher is a command line utility written in Python that rewrites classes and ids in CSS, HTML, and JavaScript files in order to save precious bytes and obfuscate your code.
How it Works
1. You pass in a list of CSS, HTML, and JavaScript files to be rewritten
2. The CSS and JavaScript files are scanned to find any class and id references
3. The classes and ids are mapped to new classes and ids with 1 or 2 letter names (a, b, c ... aa, ab, ac ...)
4. The files are rewritten with the new class and id names and saved to a new location on disk