Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

add decrypted javascript inside of javascript

I am trying to add decrypt javascript and it is not working

    var decrypedjs = "alert(\"test\")" //for example;
    function start() {
    decrypedjs
    };

and the html

<button onclick="start()">started</button>

i have looked at so many sources and what i am finding is not really helpful or not working.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

var newScript = document.createElement("script");
var inlineScript = document.createTextNode("alert('Hello World!');");
newScript.appendChild(inlineScript); 
target.appendChild(newScript);

>Solution :

I’m not going to comment on any security point other than to not use eval with external sourced strings (post-, get parameters, etc), but you’re looking for the eval method:

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/eval

    var decrypedjs = "alert(\"test\")" //for example;
    
    function start() {
      eval(decrypedjs);
    };
    
    start();
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading