Lasse Reichstein Nielsen пиÑал(а):
"mistral" <
[email protected]> writes:
Can you answer on my_specific_question,_please???????
Do not mix the "security" and "preventing from reading source" . This
is completely different thing? No any secure in Internet. But it
possible obfuscate script a little, accurately and error-free, just
make for someone difficult to read and he will lazy spend time to
decode script.
Is there some good obfuscator script, unescape, or another?
What properties should it have? I.e., by what measure should it
be "good"? Anything that makes Javascript not immediately readable
should suffice as I understand you. Anything above that would
be aiming for security, not obfuscation, which you don't want.
A simple obfuscator is:
----
<textarea cols="72" rows="10" id="input">input here</textarea>
<br>
<input type="button" value="obfuscate" onclick="
function lz(s,n) {
s = '000' + s; // sufficient for n<=4.
return s.substring(s.length-n);
}
var inp = document.getElementById('input').value;
var scr = document.getElementById('script').checked;
var res = [];
if (scr) { res.push('<script type=\'text/javascript\'>'); }
res.push('eval(\'');
for(var i = 0; i < inp.length; i++) {
var c = inp.charCodeAt(i);
var ch = c.toString(16);
if (c < 256) {
res.push('\\x', lz(ch,2));
} else {
res.push('\\u', lz(ch,4));
}
}
res.push('\');');
if (scr) { res.push('<\/script>'); }
var out = document.getElementById('output');
out.value = res.join('');
out.select();
">
<input type="checkbox" id="script" checked="checked"><label
for="script">include <script...>...</script></label>
<br>
<textarea cols="72" rows="10" id="output"
readonly="readonly"></textarea>
----
Is it "good"? That depends entirely on your requirements.
It obviously obfuscates.
==============
well, I just wanted to hear opinions those users who uses or used some
obfuscators.
What is good? good obfuscator provide code that work on most
javascript enabled browsers, that will be able to open scrambled
documents without distortion. Making them extermely difficult to study,
analyse, reuse for users, while fully retaining functionality of the
original code.
The protected form will still be the usual script, thus it will work on
all platforms the original code worked on.
Obfuscation (scrambling) of JavaScript and JScript standalone files,
flexible settings for obfuscation that allow to fine-tune level of
scrambling(include unescape); checking of missing and/or extra
semicolons in JavaScript, JScript code; generate new non-understandable
names and rename functions and variables depending on user settings;
remove comments and white spaces, reducing the file size and minimizing
the loading time; pack the code as a long line add finishing ";" when
appropriate; work with command line.
I tried script sample you show, it not work.
Mistral
--------------------------