473,795 Members | 2,914 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Any Javascript Obfuscator?

hsriat
1,654 Recognized Expert Top Contributor
Is there any free Javascript Obsfucator available?

Actually I just want the obsfucator to do two things...
1. Remove Comments
2. Rename Functions and Variables
Feb 17 '08 #1
15 4235
acoder
16,027 Recognized Expert Moderator MVP
You may find JSMin useful (at least for the first objective).
Feb 18 '08 #2
hsriat
1,654 Recognized Expert Top Contributor
You may find JSMin useful (at least for the first objective).
I downloaded the PHP code and made a php file to upload the required js file.
Like this:
[PHP]<?php
//file name: minify.php
if (!isset($_POST['Submit']))
{
?>
<html>
<form action=minify.p hp method=post enctype="multip art/form-data">
<input type=file name=js></input>
<input type=submit name=Submit value=Minify>
</form>
</html>
<?php
}
else
{
include('jsmin-1.1.0.php');

if ($_FILES['js']['error']>0)
die ('Error Uploading File');

$file_js = fopen($_FILES['js']['tmp_name'],"r");
$js = fread($file_js, $_FILES['js']['size']);
//echo $js;

$min = new JSMin;

$minified = $min->minify($js);

//echo $minified;
}
?>[/PHP]
But it gives this warning...

Missing argument 1 for JSMin::__constr uct()

What to do...

PS: I don't understand OOP Concepts :(
Feb 18 '08 #3
acoder
16,027 Recognized Expert Moderator MVP
I suggest you ask in the PHP forum.
Feb 18 '08 #4
hsriat
1,654 Recognized Expert Top Contributor
I suggest you ask in the PHP forum.
Yeah, you are right!!
My fault!!
Feb 18 '08 #5
rnd me
427 Recognized Expert Contributor
I use firefox to compress it.

wrap your code in a function, then compress by using the .toSource() method on the function.


Example:
Expand|Select|Wrap|Line Numbers
  1. function BS(){
  2.  
  3.  
  4. function el2(tid) {
  5.     return document.getElementById(tid);
  6. }
  7.  
  8. function tags(elm, tid) {
  9.     if (tid) {
  10.         if (elm.isString) {
  11.             elm = el(elm);
  12.         }
  13.         return obValsl(elm.getElementsByTagName(tid));
  14.     }
  15.     return obValsl(document.getElementsByTagName(elm));
  16. }
  17.  
  18. }
  19.  
  20.  
  21. alert(BS.toSource())
  22. /* returns:
  23. function BS() {
  24. function el2(tid) {return document.getElementById(tid);}
  25.  
  26. function tags(elm, tid) {if (tid) {if (elm.isString) {elm = el(elm);}return obValsl(elm.getElementsByTagName(tid));}return obValsl(document.getElementsByTagName(elm));}
  27. }   */
  28.  

remember to remove the first and last line of the resulting text, the function wrapper.
Feb 18 '08 #6
acoder
16,027 Recognized Expert Moderator MVP
I use firefox to compress it.

wrap your code in a function, then compress by using the .toSource() method on the function.
Nice tip (for compression, at least)!
Feb 18 '08 #7
acoder
16,027 Recognized Expert Moderator MVP
Is there any free Javascript Obsfucator available?

Actually I just want the obsfucator to do two things...
1. Remove Comments
2. Rename Functions and Variables
By the way, is this just to cut down on the size of the script? This is what minification is for.
Feb 18 '08 #8
hsriat
1,654 Recognized Expert Top Contributor
@acoder
Yeah, coz I ended up making at least 10 js files of all approx 25 kb. So I wanted to cut down the size. And I know the actual code size (w/o comments and spaces) is approx 15 kb, may be less than that.

@rnd me
Cool!! Thanks... :)
Feb 18 '08 #9
acoder
16,027 Recognized Expert Moderator MVP
@acoder
Yeah, coz I ended up making at least 10 js files of all approx 25 kb. So I wanted to cut down the size. And I know the actual code size (w/o comments and spaces) is approx 15 kb, may be less than that.
So, did you manage to cut it down in size?
Feb 19 '08 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

3
2892
by: Smugsboy | last post by:
Anyone. Where can I find a free javascript scrambler/obfuscator, that can be ran from command-line. Is there one that can be used as a frontpage plugin ? Thanks,
2
313
by: Luke Matuszewski | last post by:
Hi, Can anyone point me for some JavaScript Obfuscators ? I know one written by Dean Edwards (but it do not substitute variable names, which a would like to do). B.R. Luke Matuszewski
20
2185
by: korund | last post by:
I want encrypt javascript code in web page, however, browser need fully recognize it.. There any many Javascript Obfuscators in the Net. Is there some good and handy utility(or script) among them that can be recommended?(freeware)
30
4666
by: mistral | last post by:
Neeed good javascript unescape encoder, to protect javascript code. Some advices? Online tool, or ready javascript only. Any opinions about the Javascript Obfuscator: http://www.javascript-source.com/
20
3304
by: twigster | last post by:
Hey everyone, I'm looking for a good way to obfuscate some Javascript code. Does anyone have a good experience or bad experience with a particular software? thanks
4
326
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - How do I protect my javascript code? ----------------------------------------------------------------------- In the main, you can't as your code is distributed in source form and is easily readable. With JScript, there is the Script Encoder (see MSDN), but this is nothing more than obfuscation. Disabling the right mouse button also does nothing to protect...
2
3711
by: Laurent Bugnion [MVP] | last post by:
Hi group, A few years ago, I translated Douglas Crockford's JsMin from C to C#, because we wanted to use this functionality in our build process. JsMin is a code minimizer for JavaScript. It will remove all comments, empty lines, turn tabs into single spaces, etc... The goal is to reduce the size of JavaScript files to the minimum necessary, without modifying the functionality. Additionally to reducing the script's size, JsMin also...
4
2547
by: Peter Michaux | last post by:
Hi, I've uploaded a new version of the JavaScript::Minifier module that was on CPAN. It was a translation of JSMin but I rewrote it so it now handles missing semicolons, + ++ code, and leaves those freaky IE conditional comments in the output. The goal was that if working code is input then working code is output where working == working. Breaking code that works is not such a good idea. :) ...
11
5184
by: =?iso-8859-1?q?Martin_M=FCcke?= | last post by:
Hi, I am looking for a good javascript obfuscator - I found several on the web, but I am looking for one that can also handle javascript in jsp, html and java files - so I need a javascript obfuscator that handles my entire web project. Is there anything like that, preferable as a Eclipse plugin? Thanks,
3
1684
by: crymari2 | last post by:
Hello, I have a need to make my javascript really difficult to study. A lot of people think that this is useless waste of resources, but they are wrong IMHO. I need your recommendation of javascript obfuscator. Googling gives about 5 products. Which of commercial ones do you recommend? The javascript obfuscator by stunnix looks most appealing to me, but I didn't check neither it nor others. Any ideas?
0
9673
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10448
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10217
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10167
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10003
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6784
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5440
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5566
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4114
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.