B4J Question javascript deobfuscator and unpacker b4x

invocker

Active Member
Hello, hope you are well.

I have a script attached hier as original_script.txt

I use this website Packer this is their source code de4js to deobfuscator and unpacker like this attached file as unpacker_script.txt


is their a way like a lib to deobfuscator and unpacker using b4x?
 
Last edited:

zed

Well-Known Member
Licensed User
de4js works as a web application, so its integration into a B4J project depends on what you want to do with it.
If you simply want to display the de4js interface in your B4J application, you can use a WebView component.
This allows you to use the tool as is, directly in your B4J app

Example:
WebView:
Dim WebView1 As WebView
WebView1.Initialize("")
MainForm.RootPane.AddNode(WebView1, 10, 10, 800, 600)
WebView1.LoadUrl("https://lelinhtinh.github.io/de4js/")


If you want to deobfuscate automatically, you can download the de4js source code, extract the useful JavaScript functions (like those for decompression or deobfuscation),
and use a JavaScript engine in B4J like Nashorn, via JavaObject.
You must include the necessary JS functions in your eval call.

Simplified example Nashorn
JavaObject:
Dim engine As JavaObject
engine = engine.InitializeStatic("javax.script.ScriptEngineManager").RunMethod("getEngineByName", Array("nashorn"))
engine.RunMethod("eval", Array("var code = 'obfuscated...'; var result = deobfuscate(code);"))
Dim result As String = engine.RunMethod("get", Array("result"))


If you prefer to run the deobfuscator externally, create a Node.js script with de4js functions
Call this script from B4J with Shell
jshell:
Dim sh As Shell
sh.Initialize("sh", "node", Array("deobfuscate.js", "code.js"))
sh.Run(10000)

These are just examples. It's up to you to explore the subject further
 
Upvote 1

invocker

Active Member
thank's for replay but i don't need to load url i have a script that packed need to a way to unpacked it like the website do, i upload two file hier but can't see it So i upload again now
 
Upvote 0

invocker

Active Member
Need to get the direct url from it to play on exoplayer this is the website Link when extract the html and load embeded url then exratc html again to get the direct url i get it obfuscator and packer
 
Upvote 0
Top