Giter VIP home page Giter VIP logo

Comments (9)

chopin avatar chopin commented on August 20, 2024

I tested on small test code, but the obfuscated _ _ pragma _ _ () line compiled without an error. It seems that it produces an error only in a certain situations.

from opy.

chopin avatar chopin commented on August 20, 2024

When I erased the line including _ _ pragma _ _, Transcrypt threw another error in the new _ _ pragma _ _. Following is the python source:

api = __pragma__ ('js',
    '{}',
    'BABYLON'
)

Following is the obfuscated code producing an error

l1lll1ll1ll1_opy_ = __pragma__ (l1l111l1_opy_ (u"ࠧ࡫ࡵࠪੲ"),
    l1l111l1_opy_ (u"ࠨࡽࢀࠫੳ"),
    l1l111l1_opy_ (u"ࠩࡅࡅࡇ࡟ࡌࡐࡐࠪੴ")
)

I checked the argument('l1l111l1_opy_ '). It is a function existing in the file, and it looks ok. The error message doesn't say anything helping except the line number.

I think that Transcrypt fails recognizing _ _ pragma _ _ (). after obfuscated

from opy.

JdeH avatar JdeH commented on August 20, 2024

Hi!

So you're using Opy and Transcrypt in combination...
I hadn't anticipated that, thought minifiation would do the trick well enough...

But...
It probably can be solved, from my head:
-Switch off string obfuscation altogether, it doesn't offer much protection anyhow.
-Add \_\_pragma\_\_ to the list of names that shouldn't be obfuscated.

I've never tried Opy and Transcrypt together, though.
I only use Opy (intensively) for the CPython code I write for my profession.
Curious about your results.
BTW l1l111l1_opy_ is the string deobfuscator function.

Keep me informed. Maybe some small alterations to Opy are required to spare the __pragma__'s.
But as said you may get by with just switching of string obfuscation.

Kind regards
Jacques

from opy.

chopin avatar chopin commented on August 20, 2024

Transcrypt throws an syntax error on \_\_pragma\_\_. As you can see above pragma() is used in outside comment too.

As to minification, do you mean Pyminfier? Does it support multi module? Please give me a recommendation about a good minifier. I thought that Pyminifier and most other free obfuscators worked only in a single file.

Due to the issue of source protection of Javascript, I thought that it was ok even if Transcrypt produces unreadable code. I don't really want to read translated Javascript code, and actually I don't have to apply obfuscation if unreadable. But, Transcrypt is producing clean readable Javascript, so I need obfuscation.

from opy.

JdeH avatar JdeH commented on August 20, 2024

I don't mean using Pyminifier. It wasn't usable for me.
I mean that the minified JavaScript that Transcrypt produces in the .min.js files, is hard to read anyhow and may not need any further obfuscation.

Currently I think Opy is the best Python minifier around, I wrote it because I could not find anything else.
Have you tried Opy while setting string obfuscation to False in the config file?
Does that work for you?

from opy.

chopin avatar chopin commented on August 20, 2024

I didn't know generated *.min.js files are obfuscated already. I looked at the files, it was good enough. Problem solved. Thank you again!

from opy.

JdeH avatar JdeH commented on August 20, 2024

They are not really deliberately obfuscated, but the result isn't too easy to read...
Take care not to include sourcemaps however, so don't use the -m switch.

from opy.

chopin avatar chopin commented on August 20, 2024

Does *.min.js file include source information if compiled with -m switch? I thought that source map created with -m switch was stored in *.map files. Is it still not safe to distribute only *.min.js file if compiled with -m switch?

from opy.

JdeH avatar JdeH commented on August 20, 2024

No, the .min.js file doesn't contain source information, it only contains a link to where the sourcemap should be on the server. And the sourcemap (a different file) contains info about the sourcefiles. But if you only distribute the *.min.js file, this link is worthless (or rather: harmless).

About the .min.js file: It is generated by the Google Closure compiler, and its purpose is minification, not obfuscation. So its obscurity is a side effect. In very critical cases it may not be obscure enough. E.g. not all names are mangled and there are tools around that format it neatly as indendented "pretty" source (with the mangled names, that is).

from opy.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.