Obfuscate class names in HTML, CSS and Javascript files.
Project description
👋 HTML-Classes-Obfuscator 🔒
CLI tool that obfuscates HTML classes:
Normal HTML file :
<div class="card w-50">
<div class="card-body">Hello World</div>
</div>
Obfuscated HTML file :
<div class="oywdon tgmvkg">
<div class=emnpzm>Hello World</div>
</div>
🚀 Usage
Via command line...
git clone git@github.com:xandermann/html-classes-obfuscator.git
cp html-classes-obfuscator/html_classes_obfuscator/html_classes_obfuscator.py ./YOUR_PROJECT
python3 html_classes_obfuscator.py --htmlpath="**/*.html" --csspath="**/*.css" --jspath="**/*.js"
...Or via a python script
# https://pypi.org/project/html-classes-obfuscator/
pip install html-classes-obfuscator
import glob
import random
import string
from html_classes_obfuscator import html_classes_obfuscator
# [...]
htmlfiles = glob.glob("./**/*.html", recursive=True)
cssfiles = glob.glob("./**/*.css", recursive=True)
jsfiles = glob.glob("./**/*.js", recursive=True)
print(htmlfiles)
print(cssfiles)
print(jsfiles)
# Generate random string
def generate_class(current_classes_list):
def random_class():
# Offers (26*2)^6 random class name possibilities
return ''.join(random.choice(string.ascii_letters) for i in range(6))
res = random_class()
while res in current_classes_list.values():
res = random_class()
return res
html_classes_obfuscator.html_classes_obfuscator(htmlfiles, cssfiles, jsfiles, generate_class)
⚠️️ Important notes
- Make a backup before use.
- DON'T use if you have duplicate class names in your css files.
✅ Run tests
python3 -m unittest tests/*.py
🤝 Contributing
Contributions, issues and feature requests are welcome.
Feel free to check issues page if you want to contribute.
Check the contributing guide.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for html_classes_obfuscator-0.0.6.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 572672532b5b127d24b3b6a471e2e73425b4c79d3bbe9c18bd436877bb455896 |
|
MD5 | fa8f2d55d2cb9335737244dc1e3e0dfe |
|
BLAKE2b-256 | cbb0a70f064620e7b180411a68c76bcd8895c0559984e8ea2b5eaedb96ccf148 |
Close
Hashes for html_classes_obfuscator-0.0.6-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4275e211fae4645d5309d5f2dff1c7fb17da46c3a7c88c653cc1827d365fc126 |
|
MD5 | 4ff9fe5b56063b4b4f7d71e1b6b34932 |
|
BLAKE2b-256 | cef1e30fcaf50ee43bc15662da4ad8e8c4c28806b89142d283900754ff088c7e |