Obfuscate class names in HTML, CSS and Javascript files.
Project description
👋 HTML-Classes-Obfuscator 🔒
CLI that obfuscate HTML classes:
Normal HTML file :
<div class="content">
<div class="text">Hello World</div>
</div>
Obfuscated HTML file :
<div class="oywdon">
<div class="emnpzm">Hello World</div>
</div>
🚀 Usage
Using by 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 using in 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):
random_class = ''.join(random.choice(string.ascii_lowercase) for i in range(6))
# As we generate random strings, we need to assure that there is no collisions between already converted classes
while random_class in current_classes_list:
random_class = ''.join(random.choice(string.ascii_lowercase) for i in range(6))
return random_class
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/test_html_classes_obfuscator.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.5.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | cf386df1629d74b70c89ea94ee46800281502af9e444899568fcee479ad43ae4 |
|
MD5 | e5ee8eb765f725f24485a89ed922cda6 |
|
BLAKE2b-256 | 0744293da99b8bb86a7367f5859c22978663791ff4f2cb737eddddcab0675b0c |
Close
Hashes for html_classes_obfuscator-0.0.5-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 62f330c0842f58db2419e77055eb299eae7a8ce5a5cee5c6cd6f36b00fcccbd2 |
|
MD5 | fd0776ea02e37911f5416c3c3b03ac31 |
|
BLAKE2b-256 | cece68344d21e9b3fd129d5d5d38132f5d31bfd29005f43838bafa27ceef7c67 |