| View previous topic :: View next topic |
| Author |
Message |
Lynxz Gaming Expert Cheater
Reputation: 4
Joined: 01 Jul 2017 Posts: 208 Location: help
|
Posted: Tue Jun 18, 2019 8:36 am Post subject: help string.char(unpack(t)) too many results to unpack |
|
|
help
| Code: | | string.char(unpack(t)) |
but
| Code: | Error in native thread called Unnamed::[string "local luaL = {}
..."]:106: too many results to unpack |
#t = 4866053
how to solve it?
what is max for unpack?
thx
_________________
my english is bad
discord : rynx#9828 |
|
| Back to top |
|
 |
Corroder Grandmaster Cheater Supreme
Reputation: 75
Joined: 10 Apr 2015 Posts: 1668
|
Posted: Tue Jun 18, 2019 9:17 am Post subject: |
|
|
My opinion, You try to reverse your script encoded using string.bytes which stores in Lua table t and decoded using string.char unpack from Lua table t.
Total characters on your table = 4866053 characters including white spaces.
To adjust max for unpack, adjust on _luaMaxCStack. but I don't know where to adjust _luaMaxCStack on CE. This was also known as Lua bugs issue.
Maybe, separate your script into some parts and table should fix the problem.
Or change the unpack function to custom unpack function, like this:
| Code: | function get_str(t)
local str = ""
for i,c in ipairs(t) do
if( c ~= nil ) then
str = str..string.char(c)
end
end
return str
end
|
This not too good and should running too slow, sometimes stack overflow.
or use:
| Code: | function unpack (t, i)
i = i or 1
if t[i] ~= nil then
return t[i], unpack(t, i + 1)
end
end |
_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL
Last edited by Corroder on Tue Jun 18, 2019 9:26 am; edited 1 time in total |
|
| Back to top |
|
 |
Lynxz Gaming Expert Cheater
Reputation: 4
Joined: 01 Jul 2017 Posts: 208 Location: help
|
Posted: Tue Jun 18, 2019 9:25 am Post subject: |
|
|
the t is a 4MB exe bytes
_________________
my english is bad
discord : rynx#9828 |
|
| Back to top |
|
 |
Corroder Grandmaster Cheater Supreme
Reputation: 75
Joined: 10 Apr 2015 Posts: 1668
|
Posted: Tue Jun 18, 2019 9:29 am Post subject: |
|
|
| Lynxz Gaming wrote: | | the t is a 4MB exe bytes |
Why say now?. Not on the first post.
_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL |
|
| Back to top |
|
 |
Lynxz Gaming Expert Cheater
Reputation: 4
Joined: 01 Jul 2017 Posts: 208 Location: help
|
Posted: Tue Jun 18, 2019 9:43 am Post subject: |
|
|
sorry. forgot
_________________
my english is bad
discord : rynx#9828 |
|
| Back to top |
|
 |
daspamer Grandmaster Cheater Supreme
Reputation: 54
Joined: 13 Sep 2011 Posts: 1588
|
Posted: Thu Jun 20, 2019 1:57 pm Post subject: |
|
|
I don't understand why you obtain executable as in bytes (in the first place), as if it was fetched from internet, you could have saved it directly to a file using io functions.
if you wish to store the executable in a long string, you may try to use memory stream, write those bytes, save the file locally (as readStringLocal would not suit here) and read it using io functions.
| Code: | ms = createMemoryStream(); -- memory stream;
ms.write(tab,#tab); -- your table with bytes;
-- if does not work (as I have not tested this with 4mb file) you should run in ipairs;
-- for _,byte in ipairs(tab) do
-- ms.writeByte(byte);
-- end
local path = 'C:\\folder\\file.exe';
ms.saveToFile(path);
ms.destroy();
local file = io.open(path);
text = file:read('*a'); file:close(); |
_________________
I'm rusty and getting older, help me re-learn lua. |
|
| Back to top |
|
 |
|