Source Simple cclosure hooking (Roblox)

Tiahh

Solid & Active Platinian
Original poster
Jan 12, 2018
79
46
18
37
**THIS CODE IS A SIMPLE HOOK FUNCTION AND SHOULD NOT BE USED FOR PASTE**
I admit it this code is pretty ugly but i did it in a few hours quite easy (This code is for Roblox)​
C++:
#define sizeCclosure(n) (offsetof(Closure, c.upvalue) + sizeof(TValue) * (n)) //thanks Roblox for the definition is always nice to reverse you!
std::uint32_t hookfunction(std::uintptr_t rL) {
        if (lua_type(rL, 1) != lua::types::LUA_TFUNCTION || lua_type(rL, 2) != lua::types::LUA_TFUNCTION) return error(rL, "Error, both of the arguments must be functions!");
        auto firstClosure = *reinterpret_cast<uintptr_t*>(rl_topointer(rL, 1)); //get the first function (Function that we want to be replaced)
        auto secondClosure = *reinterpret_cast<uintptr_t*>(rl_topointer(rL, 2)); //get the second function (Function that we use for replace the first function)
        auto firstClosureNups = *reinterpret_cast<std::uint8_t *>(firstClosure + closure_nups_off); //gets the first closure nups (you can find the cclosure_nups in luaf_newcclosure lol, easy to reverse)
        auto secondClosureNups = *reinterpret_cast<std::uint8_t *>(secondClosure + closure_nups_off); //gets the second closure nups (you can find the cclosure_nups in luaf_newcclosure lol, easy to reverse)
        void* newClosure = reinterpret_cast<void*>(malloc(sizeCclosure(firstClosureNups))); //allocate memory (this is the function that we will return from the hookfunction).
        std::memcpy(newClosure, (void*)firstClosure, sizeCclosure(firstClosureNups)); //copy the firstClosure bytes and insert them in newClosure
        std::memcpy(firstClosure, secondClosure, sizeCclosure(firstClosureNups));//replace the firstClosure with the secondClosure (basically the hook part is this one lol)
        /* Push the newClosure and make the hookfunction returns it */
        TValue* top = *reinterpret_cast<TValue**>(rL + top);
        top->value.p = reinterpret_cast<void*>(newClosure);
        top->tt = lua::types::LUA_TFUNCTION;
        *reinterpret_cast<uintptr_t*>(rL + top) += 16; //Increase the top obv.
        return 1;
    }

Hope you enjoyed this thread and hope it was useful for you.​
 
Last edited:

NotALegitGuy

Solid & Active Platinian
Sep 24, 2018
69
67
18
Costa Rica
Hey bro, would this impl work? I don't have a way to test it rn so yh

C++:
signed int identifyexecutor()
    {
        lua_pushstring(ls, "CSR");
        return 1;
    }
 

Tiahh

Solid & Active Platinian
Original poster
Jan 12, 2018
79
46
18
37
Hey bro, would this impl work? I don't have a way to test it rn so yh

C++:
signed int identifyexecutor()
    {
        lua_pushstring(ls, "CSR");
        return 1;
    }
Identityexecutor should have the Lua state as the first parameter.
 

NotALegitGuy

Solid & Active Platinian
Sep 24, 2018
69
67
18
Costa Rica
Identityexecutor should have the Lua state as the first parameter.
Nevermind just realized what you meant after drinking some coffee and clearing my mind.

So basically should it go something like this?

C++:
signed int identifyexecutor(std::uintptr_t ls)
    {
        lua_pushstring(ls, "CSR");
        return 1;
    }
 

Tiahh

Solid & Active Platinian
Original poster
Jan 12, 2018
79
46
18
37
Nevermind just realized what you meant after drinking some coffee and clearing my mind.

So basically should it go something like this?

C++:
signed int identifyexecutor(std::uintptr_t ls)
    {
        lua_pushstring(ls, "CSR");
        return 1;
    }
yes then push the cclosure with lua_pushcclosure
 

NotALegitGuy

Solid & Active Platinian
Sep 24, 2018
69
67
18
Costa Rica
It's actually the same but modified and added TValue support.
He grabbed it from an exploit dev called amoy who used to work for his exploit.

Go ask Kiko ( whozkiko#0001 ) if you want

You can also look closely and look at the highlighted parts to see how darn similar it is lmao.
 

0x9

Platinian
Apr 17, 2022
5
1
3
nullptr
POV: you try and expose someone even though the code is very different
No, the code is actually pretty much the same. Clearly you don't have much experience in programming. That's something I've noticed with all these platin modders. No one here knows what they're actually doing.
 

·҉ dollaz·҉. .

Approved iModder
Approved iModder
Mar 26, 2021
159
1,822
193
Somewhere
No, the code is actually pretty much the same. Clearly you don't have much experience in programming. That's something I've noticed with all these platin modders. No one here knows what they're actually doing.
Sure it works the same, isnt written exactly the exact same way, people act like there will never be duplicate lines of code
 

Tiahh

Solid & Active Platinian
Original poster
Jan 12, 2018
79
46
18
37
its not the same code kiko is a incompetent developer, this code supports nups. Sincerely the code provided by amoy is trash.
 

0x9

Platinian
Apr 17, 2022
5
1
3
nullptr
its not the same code kiko is a incompetent developer, this code supports nups. Sincerely the code provided by amoy is trash.
Without Kiko, Arceus X wouldn't even be a thing. You later kicked him because you saw he was starting to get tired of your shit. Literally almost every person that has joined your team has now left because of you being an asshole. Secondly, you just pay people to develop the executor, you don't do anything yourself on it.
 

Tiahh

Solid & Active Platinian
Original poster
Jan 12, 2018
79
46
18
37
Without Kiko, Arceus X wouldn't even be a thing. You later kicked him because you saw he was starting to get tired of your shit. Literally almost every person that has joined your team has now left because of you being an asshole. Secondly, you just pay people to develop the executor, you don't do anything yourself on it.
Sorry, but kiko did nothing on Arceus X with or without him, nothing would have changed.
 

moonxyz

Platinian
Apr 17, 2022
5
0
1
23
United States
Sorry, but kiko did nothing on Arceus X with or without him, nothing would have changed.
Your right, kiko didn't bring something cool functions when he is on Arceus X and the update was getting delayed by him.

Sorry, but kiko did nothing on Arceus X with or without him, nothing would have changed.
And also everyone skid mod menu source and people is just fucking retard

View attachment 403039
Tiahh: **THIS CODE IS A SIMPLE HOOK FUNCTION AND SHOULD NOT BE USED FOR PASTE**
Tiahh: Proceeds to paste code that he didn't make.
Reminder: everyone use mod menu templates
 

Tiahh

Solid & Active Platinian
Original poster
Jan 12, 2018
79
46
18
37
Your right, kiko didn't bring something cool functions when he is on Arceus X and the update was getting delayed by him.
That's correct. That's why i was about to kick him before he left.