obfuscate javascript code with php

Asked

Viewed 466 times

0

1 answer

0

Today most projects with serious javascript development end up doing this with nodejs and webpack as part of the process of build.

With PHP, searching fast I found this library, the PHP-Packer.

Basically with it you pass the javascript code and it returns you the obfuscated code.

 $js = file_get_contents('test.js');
 $packer = new Tholu\Packer\Packer($js, 'Normal', true, false, true);
 $packed_js = $packer->pack();
 echo $packed_js;
  • so I want to implement this because a site of mine is suffering from crawlers, are accessing my site and stealing information by html.. with this method Packer (packed) it is easy to recognize a pattern and capture what you want: https://pastebin.com/BZEsmxNm.. however with the method of this site https://damidev.000webhostapp.com leaves everything hidden: https://pastebin.com/tw90KYSi, thus making life difficult for these crawlers understood ? because if you repair it always generates a different code even with the same js input .. I was studying and I realized that it’s a method in XOR or something..

  • I get it. If the Crawler that is stealing your content has the condition to run javascript, no matter which one you will use, because for this code to render, it will have to turn HTML. Anyway, it is worth you edit the question and put that extra information.

  • maybe a captcha is a better solution.

  • captcha is not solution because the data are pages and video data things like I really need it, about Crawler he is by what I know so abstract specific parts I do not know if render more still obfuscate help a lot

Browser other questions tagged

You are not signed in. Login or sign up in order to post.