This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
How can I obfuscate JavaScript?
I was browsing some sites and found really interesting thing. I am just starter in this coding and never seen such a thing, so I was wondering is it encrypted or encoded or packed or is there anything else?
Script sample:
V10861992380165541086199238016554108619923801655410861992380165541086199238016554108619923801655410861992380165541086199238016554='13047389474143951304738947414395130473894741439513047389474143951304738947414395130473894741439513047389474143951304738947414395130473894741439513047389474143951304738947414395130473894741439513047389474143951304738947414395130473894741439513047389474143951304738947414395130473894741439513047389474143951304738947414395130473894741439513047389474143951304738947414395130473894741439513047389474143951304738947414395130473894741439513047389474143951304738947414395130473894741439513047389474143951304738947414395'
or here is screenshot of one really long thing, couldnt even snap it all over my screen.
http://snpr.cm/8KznHp.png
http://snpr.cm/xOLfRE.png
Can anyone tell me what are these, and how can I do the same?
Do I need to pay for an program or something? Thank you for understanding.
All the line or code does is create a variable starting with V and put the number in it. Without seeing the rest of the code I cant tell if it is just encoded or encrypted as well, but if you notice the string is just repeating the number 1304738947414395.
You can definitely do a simple encoding by your self. A simple encoding is to put all the javascript code in a string like aaa="document.write('blah')" and then say aaa="atob(aaa) which converts the original string to base64. Save the base64 string and then place it in an eval statement like eval(btoa(aaa)) that converts it back to text, and then the eval executes the text. When it's finished you have some encoded mildly obfuscated code.
Related
Very worried this question may be abused, but here goes!
My server is receiving some data through a GET request in the URL, which has been encoded in some manner, I thought it would be base64 but that is not the case.
I would like to write a js function to accept this string and try all possible encodings/decodings.
Please help!
The data is in this sort of format: ZHpuxRiviOUGeOKTKdw
There is the potential it is encrypted, if that is the case I am not asking for help in decrypting it!
EDIT: my goal is not to write a perfect algorithm which can do this automatically - I simply want to try x top most popular decodings of this string and print them out.
You can't really do that, how would you know if ZHpuxRiviOUGeOKTKdw wasn't actually the string? If this is your server and this is data you're receiving then you should know how the string is encoded based on what your application does.
This question already has answers here:
Javascript - create text file on website
(5 answers)
Closed 5 years ago.
I want a user on my website to type in a string. I want this string to be stored in a txt file. When another user types in a string I want this string to be stored in a seperate line in the txt file, so I can read all the data, which was typed in later.
I searched the web for a good solution, because I don't know how to edit a txt file with JavaScript. Unfortionately everything I found is written in jQuery, which I did not learn yet. Does somebody know a simple solution to this problem?
Short answer: you can't on the client, you can on the server.
Bigger question is why? If you want to store user input so they have it later you can use LocalStorage, IndexedDB or even just a cookie to store it.
If you want to save it on the server text files are usually a bad idea - there are a lot of server side storage options that are better than plain text, but you'll need to provide a lot more information for us to help on that.
I am using GWT and an external service that returns a JSON response that contains special characters as ASCII html, for ex. the apostrophe is ' I need to properly unescape the response string so that the characters will be properly displayed.
So far, the only solution I found is:
String unescaped = new HTML(text).getText();
but it seems a little weird.
Is there another way, that doesn't include for example creation of widgets (html)?
That's really the most straight-forward way.
Yes, you're creating a temporary div, but there's nothing "weird" in that, not in a web framework like GWT at least.
Of course, you can always use some external library, like Apache Commons' StringEscapeUtils; or implement your own method to do it (though that'd be reinventing the wheel); or any of the other solutions found in a very similar question posted 5 years ago (of which yours is a clear duplicate and I should be flagging it as such, but whatever).
This question already has answers here:
How to compress/decompress a long query string in PHP?
(9 answers)
Closed 8 years ago.
I current have a URL like this
http://blahblah.com/process.php?q=[HUGEEEEEEEEEEEEEEEEEEEEEEEE STRING of 5000 chars]
My goal is to convert this something like
http://blahblah.com/process.php?q=[less charcters]
The first question:
How do I perform a function (encryption function for instance) on my GET variables before it is sent to the action page?
I've seen many questions asked with a similar topic.
The second question:
Assuming, I can do the above by some means (maybe by jQuery/JavaScript or something). How do I compress in the index.php page and decompress in the process.php page?
My attempt:
Searching for functions with fixed lengths:
I've looked at some encryptions that maintain the string size for ex. md5() gives a standard length that is short and tidy even for an extremely huge string. But unfortunately md5 cannot be decoded easily. Is there any other such function that I decode and which has a fixed length? If so, I could use that assuming I know a way to do Step 1.
EDIT: I write a request not to mark as a duplicate of that question and a question which hasn't been answered have specifically been asked again.. Please read #Jeremy 's comments, he was following this post.
I personally think it is best to use POST to send the data to the page. I am pretty much sure you can not use anything like MD5 to 'compress' the data because what MD5 does is hash the data, so it will look at your data run an algorithm to create this fixed length hash.
However, there is an extremely small possibility that two data sets will create the same hash, therefore it seems to me impossible to reliably decrypt MD5 or other similar hashes. Check out this page for more on hash collisions.
Your problem is that you are using the internet the wrong way. The URL is limited (and it depends on the browser), so don't event to try to use long URLs - even when you want to shorten it.
Please keep in mind, that we are using the WordWideWeb for a long time and if you come into a deadend you just have to rethink your problem. Maybe you are using your current technology the wrong way.
So, use POST instead to transfer your data (as others mentioned before).
If you want to "compress" your data you should use a zip like thing and then you must make that URL confirm like BASE64 afterwards. This is not suitable in any way and completly hideous. (And of course it can not guarantee the length of your URL).
MD5 is a hash not a compression thing. MD5 is not reversable. Once you hash something you can not go back again. This is not a magical way to compress tons of megabytes into a single short number. This is to have a short thing that can tell if the original data was modified (if you do that twice).
See http://en.wikipedia.org/wiki/Hash_function
See http://en.wikipedia.org/wiki/MD5
BTW: It is the same as How to compress/decompress a long query string in PHP?
This question already has answers here:
Javascript - breaking up string literals... why?
(3 answers)
Closed 9 years ago.
I've seen this a few times before, finally decided to find out why.
Given this line of code:
$("body").append('<ifr'+'ame src="foo.html"></ifr'+'ame>');
Why are they concatenating '<ifr' + 'ame' and </ifr'+'ame>'?
Bit unsure if I should answer this question or not, based on the fact there could be many reasons, and only the writer would know. But here goes anyway...
The only reason I can think of (apart from just to be annoying) would be to prevent something viewing the code and seeing the complete <iframe> tag. For example, if I search the code for "iframe" I will not get any matches.
Now for the speculative part of this answer: why would anybody wants to prevent something from finding a matching iframe tag?
Here are a couple of options, as provided by myself and Kevin B via comments:
To prevent a process from scanning the code file and detecting an iframe tag. For example, imagine you have a content management system that allows HTML/Javascript but doesn't allow the use of iframes. Part of the upload process might be to analyze the code and look for the tag. The technique of concatenation used here would prevent that scan from detecting the iframe, and thus allow the upload
Parsing software, such as a syntax highlighter may have problems working with html mixed inside JavaScript, therefore adding the concatenation method would likely allow the parser to successfully identify the string as the string it actually meant to be
In all examples, it would be fair to say this technique may also be applicable for other tags that exist within a JavaScript string, not just the iframe one shown in this example