9

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> 
4

1 Answer 1

12

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

Sign up to request clarification or add additional context in comments.

3 Comments

Your second link is the right one, I think. The first tool is not very useful (it’s easy to break, it requires JavaScript, it doesn’t allow @media, it wants to host it itself without HTTPS support…).
Link is broken for HTMLMuncher - so find it here on Github: github.com/ccampbell/html-muncher
It removes the unused css? Thanks.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.