1

I have a real estate blogspot website about nha dat go vap at www.nhadatsonnghia.com and I need to encode javascript code like below:

var _pEnbRH= "\x65\x76\x61\x6c\x28\x66\x75\x6e\x63\x74\x69\...x7c\x27\x29\x2c\x30\x2c\x7b\x7d\x29\x29\x0a";eval(_pEnbRH);

Does anyone know about coding please guide me, I will appreciate you a lot!

Thank you!

2
  • 1
    ddecode.com/hexdecoder Commented Nov 16, 2019 at 5:09
  • Wow thanks @User863 so much! Have a nice day! Commented Nov 16, 2019 at 5:15

1 Answer 1

2

Can use atob and btoa which uses base64 encoding and decoding.

<script>
    var scr = "function sample() {}";
    var jsCodeToEmbed = btoa(scr);
    var oScript = document.createElement("script");
    oScript.language = "javascript";
    oScript.type = "text/javascript";
    oScript.text = atob(jsCodeToEmbed);
    document.getElementsByTagName('body').item(0).appendChild(oScript);
</script>
Sign up to request clarification or add additional context in comments.

2 Comments

But yes this will use different encoding scheme than you had expected
Thank @SabaHassan ! I can use your suggestion and ddecode.com/hexdecoder to create 2 encryption layers. Have a nice day bro!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.