Protect my code in php, laravel, javascript and css

0

Some time ago I asked this question: How to give an understandable format or ID to a css and / or js file? , now what I'm looking for is the reverse process of that.

that is: having a certain code:

   $("#btn_load").click(function(e){
      $.ajax({
          url:'{{url("liquidation/cod_unicotwo")}}',
          type:"GET",
          data:{fechai:$("#fecha_inicial").val(), fechaf: $("#fecha_final").val()},
          beforeSend: function(){
              $("#aquitabla").html($("#cargador_reporte").html());
          },
          success:function(data){
              info_print=ModeloTableSmall(data);
              $("#aquitabla").fadeIn(2000).html(info_print);
          }
      });
    });

This is shown in a single line:

$("#btn_load").click(function(e){$.ajax({url("liquidation/cod_unicotwo")}}',type:"GET",data:{fechai:$("#fecha_inicial").val(), fechaf: $("#fecha_final").val()},beforeSend: function(){$("#aquitabla").html($("#cargador_reporte").html());},success:function(data){info_print=ModeloTableSmall(data);$("#aquitabla").fadeIn(2000).html(info_print);}});});

All this in order to protect (at least something) the code.

I'm working with SublimeText3 and atom.

EDITING

As the reverse process is simple to perform, how could my code protect? Is there any way to encrypt it?

    
asked by Shassain 16.08.2018 в 16:38
source

2 answers

1

Minimizing the code is a good start.

You can try it with minimization, but a sufficiently skilled programmer should be able to devote a certain amount of time to understand it. The CKFinder developer ( link ) thinks he has his code quite well protected, in fact he uses transformed text strings to make calls to functions and access properties. Still in a week I managed to configure it to use it for free. I did not use it because for me it was only a challenge, but trying to protect the code with only minimization and transformation of text is not entirely effective.

In my experience, performing a reverse engineering process on Javascript code is usually relatively simple because the obfuscation mechanisms usually maintain much of the modularity of the original code.

What would really be problematic would be to impoverish that modularity .

Suppose there is an especially important function in your javascript code. If you only minimize it, it is very simple (although tedious) to analyze the hierarchy of function calls and infer that this function is probably important.

However, what would happen if that function were eliminated and replaced by three (for example) equivalent but not equal functions? Well, you have broken the hierarchy of calls, you have impoverished the quality of the code by breaking part of its modularity and ... you have made that part of the code less legible. The systematic application of this technique should be able to create a real headache, the problem is that I know of no code transpiler to do this. I only know that it is possible to do it automatically with the algorithms of analysis and generation of compiler theory code.

If this tool really does not exist it would be more than interesting to develop it.

    
answered by 16.08.2018 в 17:52
1
  • Code obfuscation will not protect it.
  • The php code can not be accessed if they try to search the source code of your html, that would be a security issue for the server.
  • In Sublime text you can select the code and obfuscate it automatically for this you can use the combination of keys "Ctrl + A" and then "Ctrl + J"
  • answered by 17.08.2018 в 07:04