You're just pushing 3 bytes while it should be 4. You've to pass it a valid wchar_t* address.
To have it clear, 'wchar_t*' is a memory address that says where that text is. Each wchar_t value are 2 bytes long (wide chars).
So, you should 'inject' your text and pass the memory address of that text to that function, otherwise it would crash.
You can do that by directly push the string into the stack backwards or by allocating heap memory (that would demand to be done inside the process). Careful about pushing the values directly into the stack or you will run out of space.
Also, when you pass the length of your code you could use something like 'Text.length' if C# does have it. That would be the best, it will give you less headaches.
Hope it gives some insights... btw, how do you plan to run your function?
I'm not sure if you can do that, but there should be a way of doing that.
To debug it, I'd inject this shellcode at process startup, and check the address with OllyDbg to see if the code looks Ok or not (look if the addreses points to the right data/calls).
About this line:
Code:
mov ecx, dword ptr ds:10D898C
That's part of the thiscall calling convention used by Microsoft Compilers.
In fact, I think this is not a console method but part of a debug class method as all of the calls made to this method generally print a condition like "(pObject != NULL)" (which is an assert) with red colors.
I'm telling you in case you want to use other functions for this game or any other. If you made a call and it crash and before that call there is a mov to ecx, then you would know it's a thiscall.
If you jump to the call method you will see at the end of it 'retn 10', which can give you a hint of the parameters used (as well as pushedx guide), so the prototype of this function is: BYTE, wchar_t* (wide char, 2 bytes long), DWORD, BYTE.
When you push the arguments to that function, you're pushing them as BYTE, DWORD, wchar_t*, BYTE... I'm just saying this in case someone wants to cast the address to a function pointer (which might look better to human eyes).
Look at this part in your shellcode:
Code:
0x68, //Push
0xFF, 0xFF, 0xFF, //Color
As I said, the color is four bytes long... you're just pushing 3, your shellcode will crash.
So I'd suggest what I said before, inject your code at startup but don't start your thread or the target process thread, write down the addresses in which your function/text has been injected, then attach yourself with OllyDbg to your target process and look at those address and make sure it looks like what you wanted to inject.
That was copied from OllyDbg.
With that you should now complete that with the real values.
I like to have 'markers' of where should I put my variables, like:
0xCAFEBABE = here you should write 010D898C
0xFFFF0000 = your color, it's ARGB (alpha, red, green and blue)
0xDEADBEEF = the address of your text inside sro_client
0xDEADBABE = the relative jump/call address to the print console method
In your loader/tool process you can complete those markers with the real values.
Once you have those markers replaced with the real values, repeat the same: inject, check with OllyDbg.
Check if where DEADBABE is, is the print console method in there.
Check if DEADBEEF points to your string. Also, encode the string as utf-16... once it's printed on the console you might seen an square at the front of it... later you just have to skip it, it's because of the 0xFF, 0xFE mark on utf strings.
Awesome, sorry that I didn't post anything more.
I did have a short cpp file to write this shellcode, I'll post it tonight if I remember.
Code:
#include <cstdio>
#include <cstring>
#include <windows.h>
void Shellcode()
{
// Define the function prototype and says where it is
typedef void (__stdcall *__ConsolePrint) (BYTE, wchar_t*, DWORD, BYTE);
__ConsolePrint ConsolePrint = (__ConsolePrint)0x00746E60;
// Push the values into the stack
wchar_t myString[80];
myString[0] = L'T';
myString[1] = L'e';
myString[2] = L's';
myString[3] = L't';
myString[4] = L'\0';
DWORD color = 0xFFFF0000;
// Set the this pointer and make the function call
asm("pushl %ecx");
asm( "movl %%DS:%a[Offset], %%ecx" : : [Offset] "irm" (0x01098C24));
ConsolePrint(1, myString, color, 1);
asm("popl %ecx");
}
void _endMark() { };
int main(int argc, char **argv)
{
DWORD size = (DWORD)(_endMark) - (DWORD)(Shellcode);
BYTE* ptr = reinterpret_cast<BYTE*>( Shellcode );
for( DWORD i=0; i<size; i++, ptr++ )
{
printf("0x%02X ", static_cast<BYTE>(*ptr) );
}
printf("Shellcode size: %d\n", size);
printf(
"If you want to attach to this process this is the time\n"
"The shellcode address is %08X\n"
,
Shellcode
);
system("pause");
return 0;
}
That should print out the code of it.
Careful about local variables or you will run out of space.
You need gcc to compile this... Microsoft compiler seems to place jumps.
I'm just pushing ecx, since it's the only register I'm modifying.
cant found the internal.. 08/24/2011 - Cabal Hacks, Bots, Cheats, Exploits & Macros - 3 Replies guys i play cabal paradox
i down hacks and all this
but i cant found the internal of paradox
how the server works ?
the is any option to build hacks alone ?
im new in all this
the hacks for cabal elite can work for other servers ?
MY PROBLEM CAN NOT GET IP PUBLIC ADDRESS INTERNAL IP PERSIST, PLEASE DONT' CLOSE. 08/21/2011 - Metin2 Private Server - 5 Replies Friends, i have this problem, don't close the thread, i have read and do this thread bu i don't solve my problem. I have do this thread
http://www.elitepvpers.com/forum/metin2-pserver-gu ides-strategies/940456-index-2010er-serverfiles-gu ides-tutorials-releases.html
But i don't solve, please help me, give me the link ok for solve my problem.
The problem is this:
http://img844.imageshack.us/img844/1142/cattura2b .png
help mee .-.:handsdown:
_TradEmArk_ D3D Client HooK v2 [Added Functions,Fixxed Crashs] 07/20/2011 - WarRock Hacks, Bots, Cheats & Exploits - 47 Replies Nicht wundern, es kommt Failed to Inject MENU ÖFFNET SICH ABER TROTZDEM!
http://www.fotos-hochladen.net/uploads/clienthook gh4tmiqcdu.png
Download:
removed, aless virus!
Virustotal:
VirusTotal - Free Online Virus, Malware and URL Scanner
[Guide] Using Client (internal) Functions 02/21/2011 - SRO PServer Guides & Releases - 0 Replies since many people are asking for sources of my Loaders, here are some asm code pieces directly out of the zszc client.
you should be able to use them in almost all coding languages...
hope this will be useful for coders in the pserv sections. its also possible to send/recyve packets directly through the client, but that would require some hooks in the client, so i won't really explain how to do that in this post (since its not/hardly realizable in scripting languages)...
if u're interested...