How to deobfuscate this? - lua

I obfuscated this script using some site
But i'm wondering how to deobfuscate it? can someone help me?
i tried using most decompilers and a lot of ways but none has worked
local howtoDEOBFUSCATEthis_Illll='2d2d341be85c64062f4287f90df25edffd08ec003b5d9491e1db542a356f64a488a1015c2a6b6d4596f2fa74fd602d30b0ecb05f4d768cd9b54d8463b39729eb1fe84630c0f8983f1a0087681fe4f2b322450ce07b
something like that for an example.
the whole script: https://pastebin.com/raw/fDGKYrH7

First reformat into a sane layout. a newline before every local and end will do a lot. Then indenting the functions that become visible is pretty easy.
After that use search replace to inline constants. For example: local howtoDEOBFUSCATEthis_IlIlIIlIlIlI=8480; means you can replace every howtoDEOBFUSCATEthis_IlIlIIlIlIlI with 8480. Though be careful about assignments to it. If there are any then it's better to rename the variable something sensible.
If an identifier has no match you can delete the statement.
Eventually you get to functions that are actually used.
Looking at the code it seems to be an interpreter implementation. I believe it's a lua interpreter
Which means that you'll need to verify that and decompile what the interpreter executes.

Related

Is it possible to load a script from a string without using loadstring

The title says it all, basically i want to load my script from a string without using loadstring so if someone could link me a pure loadstring function that would be cool, like the lua code for loadstring
Sorry for bad english, English is my second language
First of all, please say why you don't want to use loadstring, because this function is literally designed for this kind of job.
If it's a challenge you have and you don't care about it being fast you can technically:
Save the string to a file
Run that file using dofile
I hope that answers your question well!
In case you have any further questions, do let me know!
Also, here's a page from Lua docs that is related and you might want to read it!
https://www.lua.org/pil/8.html

How to keep expressions in HandleBars.Net for later evaluation?

This seems to be a simple matter and maybe it's solved already, but I'm not sure how to do it. I'd like to keep arbitrary unresolved expressions for later evaluation. Note that I still don't know which expressions are already defined.
For example, suppose I have the expression...
{{source.path}}/mainmenu{{ext}}"
...and the context defines ext as .js, but source.path is still undefined. What I get is/mainmenu.js", but I'd like to get {{source.path}}/mainmenu.js" instead so that I can evaluate {{source.path}} at a later time. HandlebarsConfiguration.UnresolvedBindingFormatter seemed promising, but it doesn't handle the complete original expression. HandlebarsConfiguration.ExpressionNameResolver also didn't help.
So, is it possible to do this at all? Thanks in advance for any help.

Is there any way that prevent lua from translating 'a.b' to 'a/b' when I require 'a.b'?

For example:
require('a.b.c/foo.lua')
Lua engine will translate 'a.b.c/...' to 'a/b/c/...' to search file in the pattern list, right?
Will there be any problem when 'a.b.c' are real folder name? If so, how to solve that?
If your module is located in a directory that contains . as part of its name, pulling it in with require will be difficult since there's no way to 'escape' that . so the \ substitution isn't done.
However, it may still be possible to point lua to look in the right place indirectly by playing with the package.path:
local restorepath = package.path
package.path = "./a.b.c/?.lua"
require 'foo'
package.path = restorepath
But I'd recommend that you try to reorg your project directory structure first so it better works with lua's require. Otherwise you'll have to do keep doing the above dance with other modules you might have.
Such translation is not on the spec, as far as I know. So it might work, but it might also not work. It might break on some platforms (i.e. work on Linux and Mac and not on Windows). It might work in one version of Lua and not on the next. So I would not recommend it.
The way to make sure you stay platform-agnostic is using dots everywhere. Also, I would recommend not putting the .lua part at the end, require does not always resolve that well either:
require('a.b.c.foo')

How to use User-Input to address specific variables in Pascal (Eval/Exec?)

I'm trying to do something very specific in the fractal program Apophysis 7X, the scripting language in use is Pascal (the project is written in Delphi).
What I want to do:
Write a script that can dynamically address certain variables. In the program I have so called transforms, and each transform has multiple variations, new variations can be added by plugins, hence I do not know all names there could be.
The variables are addressed like this:
Transform.Linear:=Sin(Pi*(FrameCount / FrameQuantity));
The Variation that is to be changed might not be Linear though, but a dozen other words, like Spherical or Zcone.
If eval would work I'd assume the solution to be something like this:
VariationName:=User-Input;
eval('Transform.' + VariationName + ':=Sin(Pi*(FrameCount / FrameQuantity));')
As far as I know though, there is no such thing like eval or exec in Pascal (Tried: Eval/eval/Exec/exec). Searching other sites and the internet didn't turn up any ideas either.
So the question is how can I use the User-Input to address those variables? Obviously:
Transform.'User-Input':=Sin(Pi*(FrameCount / FrameQuantity));
will not work. Since I don't know all names up front I can't just use an array or anything static either. Any ideas would be greatly welcome.
What you want to do is called Reflection. Delphi does have support for it (they call it Extended RTTI). Give a look at the functions IsPublishedProp and SetPropValue.

In rails.vim why do I get "E345 can't find file in path" errors?

I've been learning Ruby/Rails with vim. Tim Pope's rails.vim seems like a really good tool to traverse files with, but I keep getting these pesky "E345 can't find file in path" errors. I'm not vim expert yet, so the solution isn't obvious. Additionally, I've tried this and it doesn't apply to my problem.
As an example of the problem. I have a method format_name defined in app/helpers/application_helper.rb and it is used in app/helpers/messages_helper.rb. Within the latter file I put my cursor over the usage of format_name and then hit gf and I get that error. Similar disfunction with commands like ]f and [f
However, it works sometimes. I was able to gf from user to the app/models/user.rb
Ideas?
I think that is a limitation of rails.vim. It does not support “finding” bare methods. Supporting something like that would require one of the following:
an exhaustive search of all the source files for each “find” request
(which could be expensive with large projects),
“dumb” indexing of method names
(e.g. Exuberant Ctags and gControl-]; see :help g_CTRL-]), or
smart enough parsing of the code to make a good guess where the method might be defined
(which is hard to do properly).
If you know where the method is, you can extend many of the navigation commands with a method name:
:Rhelper application#format_name
But, you do not have to type all of that in. Assuming the cursor is on format_name you can probably just type:RhTabspaceappTab#Control-R Control-W (see :help c_CTRL-R_CTRL-W).

Resources