How can i pack javascript via php like javascriptobfuscator.com [closed] - javascript

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
if i put below javascript in javascriptobfuscator.com
Before
var a="Hello World!";
function MsgBox(msg){
alert(msg+"\n"+a);
}
MsgBox("OK");
it returns below packed javascript
After
var _0xd429=["\x48\x65\x6C\x6C\x6F\x20\x57\x6F\x72\x6C\x64\x21","\x0A","\x4F\x4B"];
var a=_0xd429[0];function MsgBox(_0xdb32x3){alert(_0xdb32x3+_0xd429[1]+a);};
MsgBox(_0xd429[2]);
how can i make same functionality in php.

Static asset minifying and file merges are accomplished automatically in many web frameworks (in Rails this concept is called the "asset pipeline"). You need to use a framework that has an asset minification/compilation scheme that suits you, otherwise either
use a build tool that watches your codebase and executes automatically if you change any files
write a build script and execute it yourself when creating a build
Assetic seems to be a PHP tool of choice that does all this for you.
https://github.com/kriswallsmith/assetic
Also, Asset Pipeline/Framework for PHP

I beg the question
Why do you want to secure your javascript?
Just making it unreadable to humans does not mean someone with aspbergers or with enough motivation to deobfuscate it cannot.
If you are protecting your script because you don't want people to recycle it, then minify (manually or automatically through frameworks and plugins).
If you have other security concerns then I think your time is better spent elsewhere
Sorry if this sounds harsh but I wasted a lot of time on this before realizing how futile and useless this endeavour turned out to be

Related

Similar and simplified examples (newbie questions) [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I'm currently studying about web development, I still don't know about jquery, but I've a little knowledge about javascript, html and css (basic).
I've been looking at some examples in github to improve my skills, and I've found this content;
https://github.com/stewilondanga/editables
I perfectly understand the theory, but I do not know how to put it into practice, I would like for any similar examples (simplified alternatives) and how to convert the exported code generated by javascript into a html5 table?
Any example would be appreciated! thanks for your attention!
First of all, jQuery does not generate code. It's a framework, you load it into a web page, and then you can use it from within Javascript code in that page.
I suggest you start by looking at the source of https://stewilondanga.github.io/editables/, if an editable tables is what you need. There are more general frameworks to do this, e.g. Aloha
To try it yourself, I'd suggest you bite the bullet equip yourself with some kind of web server, be it on a server somewhere, or on your local machine, so you can easily try out things like this, copy the sources, alter the code etc.., and quickly hit reload on your browser.
While it may seem easier to run a local server and point your browser at http://localhost/something, IMHO it also takes more tinkering to get browsers to embrace that fully. You don't need the extra grief while already learning all those new concepts. If you want to tackle this seriously, consider getting a hosting service or small VPS somewhere. If you don't know how to do that, get help for that first, but get it out of the way. It'll save you much grief.

What are ways to optimize scripts on js? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I noticed, that JS scripts consum a lot of RAM. Particularly, client side socket.io + node.js.
What are ways to optimize scripts on js?
What to look for in the first time and what do standards exist?
You can use some compressor to minification, sometimes I use the grunt properties or https://github.com/mishoo/UglifyJS, or you can do it online here http://jscompress.com
If you have to many files.js to import, you can use requireJs to manage it. http://requirejs.org/
The answer is: you do not need to optimize your scripts, at least not until you have a clear, overriding reason to do so. JS scripts consume as much memory as they consume. The engine manages memory and garbage collects. There is nothing specific you can do to reduce memory consumption other than processing less data, or using fewer libraries. 138MB is not a horribly large footprint, why does that bother you? If you decide that you really have nothing better to worry about than memory usage, then run a profile using your favorite browser devtools. However, if the usage is in someone else's code, and not your own, then there's not really anything you can do except, as I said, get rid of their code and do without it, or replace it with something else.
Not clear what you intend to mean by "what do standards exist". What kind of standards do you refer to? Do you mean best practices? Best practices, as I said, are not to worry about this, unless you are a library author and are trying to optimize your own library, OR, if you suspect a memory leak, which does occur but less frequently than one might think.
Add the scripts to bottom of the html content or can load the script asynchronously.

Pure JavaScript Append Text to File [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
Is it possible to append text to an existing textfile using only javaScript?
No. Browser JavaScript does not have access to the local file system for security reasons.
It does not have "arbitrary" access to the file system but it can in fact read/write local files from, eg, the browser cache directory. If you have full access to the client machine you could take advantage of this via a background script to synchronise temporary files to specific locations on the client. There are also techniques using local HTTP server daemons or modified browsers.
Of course if you wanted a "pure" JS solution the obvious question is how such a thing could be done without turning the browser into a premier malware installation system (well, assuming the browser isn't like IE that performs this task already).
As stated, not possible with pure JS. But it is possible if you use XMLHttprequest.
http://www.javascripter.net/faq/reading2.htm

Is there a prebuilt website with logins I can work from? (Just starting to use javascript) [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I need to build a website that allows users to upload files and a few other actions. I have zero experience with javascript so I was wondering if there was some type of built site that already had logins coded so I could just work on the other logic?
I'm a long time delphi developer so I'm not new to programming. Any javascript video references would be great as well.
Thanks in advance.
You don't want to be handling logins with plain-old JavaScript unless you start building a super cool NodeJS setup, which, I wouldn't recommend if you have zero experience with JavaScript.
To ease your JS adventure, check out JQuery.com which makes it easier to code JS without worrying so much about browser quirks.
For easy server-side login, I recommend PHP since there are literally millions of tutorials and free code snippets out there, hosting is cheap, and an enormous community of PHP developers online to help you. To ease your PHP adventure, start with a framework such as CodeIgniter.
To answer your question, here's an example of a PHP + JavaScript (JQuery) login solution: http://blog.webwizo.com/2011/05/04/simple-login-with-php-and-jquery-ajax/
In order to upload files, you'll need a server-sided script, possibly done in PHP.
As for communicating with the server, it can be somewhat daunting for a beginner, but it's largely done via xmlhttprequest (otherwise known as AJAX).
Here's a tutorial on how to use it by W3CSchools, but there are plenty more on the net: http://www.w3schools.com/ajax/default.asp
One word of advice; don't make the mistake of relying of a JS library too soon; familiarize yourself with the language and its capabilities. A lot of answerers are just going to say "Use JQuery." You can (and possibly should), but it's important to know how Javascript works without it.

What to call pure JavaScript standalone (web)apps which have no server side? [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 11 years ago.
Improve this question
I've been writing a few tools as standalone webapps that have no server side code and it strikes me that I'm not sure what people call such things.
I like them because they can be distributed as a single file that anybody with a web browser can run. Typically all the funky stuff is done by calling AJAX web APIs like those provided by Stack Exchange, MediaWiki, Google, etc.
The following terms all seem plausible but might also cover other things or not tell the whole story:
client-only
pure JavaScript
standalone webapp
web script
web tool
browser app
Is one of these terms or something else in common use for such apps / tools?
Here's links to some of my little tools on GitHub: travel-se-airport-tags.html, travel-se-1-or-2-answers.html, travel-se-stats.html
There are some much more app-ish examples in the 10k Challenge...
In the fantastic 10K Challenge, they are generally referred to as:
Client-side apps
or
Purely-client apps
But I think your first 3 titles are pretty self-explanatory too.

Categories

Resources