Closed physics-sec closed 4 years ago
I don't see any obvious problem. So either there's something wrong with your struct definition, or there's something wrong with the function call, or there's something wrong with the original code. So try this:
At one of these three points, it should break. That should tell you where the problem lies.
That is a great idea, thank you!
Well I am using this repo now: https://github.com/pwndizzle/c-sharp-memory-injection/blob/master/thread-hijack.cs And I can confirm it works properly. Same issue if I translate the structs/enums into my Boo script
I am not sure how to add that project to my Boo script as a dependency, do you have any resource or example I can see? I don't wan't to waste much of your time
The idea of adding external dependencies to my Boo scripts sounds great. So far, I have been loading the .net assembly of some compiled program and then invoking the methods I want. I can just try that, but not sure how much informations it would give us about the issue
Boo is truly amazing, especially the compile from memory feature Is like .net python, I love it
Ok, turns out that the struct was well defined, the issue was how I was calling GetThreadContext. I needed to add the line in the middle:
context = CONTEXT64()
context.ContextFlags = CONTEXT_FLAGS.CONTEXT_FULL
success = GetThreadContext(threadHandle, context)
Sorry to wast your time!
Good to hear you got it working! 😄
Hi! I want to create a struct in Boolang, the struct is called Context64 from GetThreadContext This is the struct in C# (from https://github.com/illumen/Bleak/blob/master/Bleak/Etc/Native.cs):
I translated it in the following way:
yet, when I read the Rip, is 0 for all the threads, which makes no sense.
(all the inner structs like SaveFormat and M128A are defined as well) (I had to replace [MarshalAs(UnmanagedType.ByValArray, SizeConst = 26)] with [MarshalAs(UnmanagedType.ByValArray, SizeConst : 26)], because the compiler complained)
this is how i defined GetThreadContext:
Is there anything obvious that I am doing wrong? I am pretty sure that the struct is not well defined, and that is why the value in the Rip makes no sense. If the struct makes sense in as far as Boolang is concerned, then dismiss the issue.
Thanks in advance!