|
You last visited: Today at 19:26
Advertisement
Hilfe zu c++/cli restore bytes
Discussion on Hilfe zu c++/cli restore bytes within the C/C++ forum part of the Coders Den category.
07/31/2021, 17:13
|
#1
|
elite*gold: 0
Join Date: Oct 2010
Posts: 9
Received Thanks: 0
|
Hilfe zu c++/cli restore bytes
Solved, Ty <3
|
|
|
07/31/2021, 18:56
|
#2
|
elite*gold: 966
Join Date: Apr 2010
Posts: 1,105
Received Thanks: 681
|
Verstehe das Problem nicht ganz. Wenn du die Originalbyte wiederherstellen möchtest, kopier sie halt vorher in ein eigenes Puffer, bevor du sie mit NOPs überschreibst. Dann kannst du jederzeit die Originaldaten aus deinem Puffer wieder an ihren korrekten Platz kopieren.
Ferner schlägt dein zweiter VirtualProtect-Aufruf in WriteToMemory zwingend fehl, weil du als letztes Argument NULL übergibst, s.  .
Viele Grüße
|
|
|
07/31/2021, 20:01
|
#3
|
elite*gold: 0
Join Date: Oct 2010
Posts: 9
Received Thanks: 0
|
Quote:
Originally Posted by Jeoni
Verstehe das Problem nicht ganz. Wenn du die Originalbyte wiederherstellen möchtest, kopier sie halt vorher in ein eigenes Puffer, bevor du sie mit NOPs überschreibst. Dann kannst du jederzeit die Originaldaten aus deinem Puffer wieder an ihren korrekten Platz kopieren.
Ferner schlägt dein zweiter VirtualProtect-Aufruf in WriteToMemory zwingend fehl, weil du als letztes Argument NULL übergibst, s.  .
Viele Grüße
|
Dies habe ich versucht, leider gibt er mir immer 00 bytes, daher denke ich, ich mache etwas falsch.
Habe versucht es über die Writetomemory Funktion umzuschreiben.
Code:
char testbytes[6];
void CopyToMemory(uintptr_t addressToStore, void const* valueToRead, int byteNum)
{
unsigned long OldProtection;
VirtualProtect((LPVOID)(addressToStore), byteNum, PAGE_EXECUTE_READWRITE, &OldProtection);
memcpy((LPVOID)addressToStore, valueToRead, byteNum);
VirtualProtect((LPVOID)(addressToStore), byteNum, OldProtection, &OldProtection);
}
Danach rufe ich dies vor dem nopen aus.
Code:
CopyToMemory(test, &testbytes, 6);
und nach dem ich die Checkbox unchecke ->
WriteToMemory(test, testbytes, 6);
Replacet er einfach die 6 bytes mit 6 00ern. ^^
|
|
|
07/31/2021, 20:05
|
#4
|
elite*gold: 966
Join Date: Apr 2010
Posts: 1,105
Received Thanks: 681
|
Du hast Quell- und Ziel-Pointer vertauscht. Statt von der Originaladresse in den Puffer kopierst du von deinem Puffer zur Adresse, s.  .
Viele Grüße
|
|
|
07/31/2021, 20:23
|
#5
|
elite*gold: 0
Join Date: Oct 2010
Posts: 9
Received Thanks: 0
|
Quote:
Originally Posted by Jeoni
Du hast Quell- und Ziel-Pointer vertauscht. Statt von der Originaladresse in den Puffer kopierst du von deinem Puffer zur Adresse, s.  .
Viele Grüße
|
Code:
void CopyToMemory(void* addressToStore, void const* valueToRead, int byteNum)
{
unsigned long OldProtection;
VirtualProtect((LPVOID)(addressToStore), byteNum, PAGE_EXECUTE_READWRITE, &OldProtection);
memcpy((LPVOID)addressToStore, valueToRead, byteNum);
VirtualProtect((LPVOID)(addressToStore), byteNum, OldProtection, &OldProtection);
}
CopyToMemory(&testbytes, &test, 6);
Habe es nun so probiert, Problem ist, er schreibt nun irgendwelche Random Bytes rein und nicht die "Default" Bytes.
|
|
|
08/01/2021, 03:51
|
#6
|
elite*gold: 1371
Join Date: Apr 2010
Posts: 13,778
Received Thanks: 15,040
|
Quote:
Originally Posted by boss8513
Code:
void CopyToMemory(void* addressToStore, void const* valueToRead, int byteNum)
{
unsigned long OldProtection;
VirtualProtect((LPVOID)(addressToStore), byteNum, PAGE_EXECUTE_READWRITE, &OldProtection);
memcpy((LPVOID)addressToStore, valueToRead, byteNum);
VirtualProtect((LPVOID)(addressToStore), byteNum, OldProtection, &OldProtection);
}
CopyToMemory(&testbytes, &test, 6);
Habe es nun so probiert, Problem ist, er schreibt nun irgendwelche Random Bytes rein und nicht die "Default" Bytes.
|
Code:
void CopyToMemory(void* addressToStore, void const* valueToRead, int byteNum)
{
unsigned long OldProtection;
VirtualProtect((LPVOID)(addressToStore), byteNum, PAGE_EXECUTE_READWRITE, &OldProtection);
memcpy((LPVOID)addressToStore, valueToRead, byteNum);
VirtualProtect((LPVOID)(addressToStore), byteNum, OldProtection, &OldProtection);
}
bool TestMyFunc()
{
unsigned int dummy = 0x12345678;
unsigned int _i_need_to_be_dummy = 0;
CopyToMemory(&_i_need_to_be_dummy, &dummy, sizeof(dummy));
return _i_need_to_be_dummy == dummy;
}
if (!TestMyFunc())
{
// nope i did something wrong
}
|
|
|
08/01/2021, 12:54
|
#7
|
elite*gold: 0
Join Date: Oct 2010
Posts: 9
Received Thanks: 0
|
Quote:
Originally Posted by Omdi
Code:
void CopyToMemory(void* addressToStore, void const* valueToRead, int byteNum)
{
unsigned long OldProtection;
VirtualProtect((LPVOID)(addressToStore), byteNum, PAGE_EXECUTE_READWRITE, &OldProtection);
memcpy((LPVOID)addressToStore, valueToRead, byteNum);
VirtualProtect((LPVOID)(addressToStore), byteNum, OldProtection, &OldProtection);
}
bool TestMyFunc()
{
unsigned int dummy = 0x12345678;
unsigned int _i_need_to_be_dummy = 0;
CopyToMemory(&_i_need_to_be_dummy, &dummy, sizeof(dummy));
return _i_need_to_be_dummy == dummy;
}
if (!TestMyFunc())
{
// nope i did something wrong
}
|
Habe ich 1:1 so probiert, resultat von &dummy sowie &_i_need_to_be_dummy über cout
ergeben leider aber wieder nicht die richtigen bytes :/
sie ergeben die Addresse die sie in meiner DLL haben, gehe ich nun dahin um zugucken ob sie diese bytes dort übernommen haben, haben sie nur 2 bytes die auch nichts damit zutun haben.
|
|
|
08/01/2021, 19:32
|
#8
|
elite*gold: 1371
Join Date: Apr 2010
Posts: 13,778
Received Thanks: 15,040
|
Quote:
Originally Posted by boss8513
Habe ich 1:1 so probiert, resultat von &dummy sowie &_i_need_to_be_dummy über cout
ergeben leider aber wieder nicht die richtigen bytes :/
|
Es macht auch keinen Sinn die beiden Adressen zu vergleichen.
Poste mal deinen kompletten Code, du machst wahrscheinlich nur irgendwo einen recht dummen Fehler.
|
|
|
08/01/2021, 20:47
|
#9
|
elite*gold: 0
Join Date: Oct 2010
Posts: 9
Received Thanks: 0
|
Quote:
Originally Posted by Omdi
Es macht auch keinen Sinn die beiden Adressen zu vergleichen.
Poste mal deinen kompletten Code, du machst wahrscheinlich nur irgendwo einen recht dummen Fehler.
|
Code:
void WriteToMemory(uintptr_t addressToWrite, void const* valueToWrite, int byteNum)
{
unsigned long OldProtection;
VirtualProtect((LPVOID)(addressToWrite), byteNum, PAGE_EXECUTE_READWRITE, &OldProtection);
memcpy((LPVOID)addressToWrite, valueToWrite, byteNum);
VirtualProtect((LPVOID)(addressToWrite), byteNum, OldProtection, &OldProtection);
}
void CopyToMemory(void* addressToStore, void const* valueToRead, int byteNum)
{
unsigned long OldProtection;
VirtualProtect((LPVOID)(addressToStore), byteNum, PAGE_EXECUTE_READWRITE, &OldProtection);
memcpy((LPVOID)addressToStore, valueToRead, byteNum);
VirtualProtect((LPVOID)(addressToStore), byteNum, OldProtection, &OldProtection);
}
char nopbytes[] = "\x90\x90\x90\x90\x90\x90";
DWORD test = FindPattern(testmodule, testsig, testmask);
unsigned int dummy = test;
unsigned int _i_need_to_be_dummy = 0;
bool TestMyFunc()
{
CopyToMemory(&_i_need_to_be_dummy, &dummy, sizeof(dummy));
return _i_need_to_be_dummy == dummy;
}
private: System::Void checkBox1_CheckedChanged(System::Object^ sender, System::EventArgs^ e) {
if (checkBox1->Checked == true)
{
TestMyFunc(); <- habe dies auch in form1_load getestet, um
es dann mit cout auszulesen.
WriteToMemory(test, nopbytes, 6);
}
else
{
WriteToMemory(test, &_i_need_to_be_dummy, 6);
}
}
Glaube das müsste der ganze code sein zu diesem zweck.
|
|
|
08/01/2021, 22:50
|
#10
|
elite*gold: 1371
Join Date: Apr 2010
Posts: 13,778
Received Thanks: 15,040
|
Müsste so gehen:
Code:
void WriteToMemory(uintptr_t addressToWrite, void const* valueToWrite, int byteNum)
{
unsigned long OldProtection;
VirtualProtect((LPVOID)(addressToWrite), byteNum, PAGE_EXECUTE_READWRITE, &OldProtection);
memcpy((LPVOID)addressToWrite, valueToWrite, byteNum);
VirtualProtect((LPVOID)(addressToWrite), byteNum, OldProtection, &OldProtection);
}
char origbytes[6] = {0};
DWORD test = FindPattern(testmodule, testsig, testmask);
if (test != 0)
{
WriteToMemory((uintptr_t)origbytes, test, 6);
}
private: System::Void checkBox1_CheckedChanged(System::Object^ sender, System::EventArgs^ e) {
if (checkBox1->Checked == true)
{
char nopbytes[] = "\x90\x90\x90\x90\x90\x90";
WriteToMemory(test, nopbytes, 6);
}
else
{
WriteToMemory(test, origbytes, 6);
}
}
|
|
|
08/02/2021, 00:15
|
#11
|
elite*gold: 0
Join Date: Oct 2010
Posts: 9
Received Thanks: 0
|
Quote:
Originally Posted by Omdi
Müsste so gehen:
Code:
void WriteToMemory(uintptr_t addressToWrite, void const* valueToWrite, int byteNum)
{
unsigned long OldProtection;
VirtualProtect((LPVOID)(addressToWrite), byteNum, PAGE_EXECUTE_READWRITE, &OldProtection);
memcpy((LPVOID)addressToWrite, valueToWrite, byteNum);
VirtualProtect((LPVOID)(addressToWrite), byteNum, OldProtection, &OldProtection);
}
char origbytes[6] = {0};
DWORD test = FindPattern(testmodule, testsig, testmask);
if (test != 0)
{
WriteToMemory((uintptr_t)origbytes, test, 6);
}
private: System::Void checkBox1_CheckedChanged(System::Object^ sender, System::EventArgs^ e) {
if (checkBox1->Checked == true)
{
char nopbytes[] = "\x90\x90\x90\x90\x90\x90";
WriteToMemory(test, nopbytes, 6);
}
else
{
WriteToMemory(test, origbytes, 6);
}
}
|
Hat geklappt, musste zwar test von dword noch konvertieren, da er nicht mit void will, aber es geht nun!
Code:
WriteToMemory((uintptr_t)&origbytes, (uint32_t*)test, 6);
Danke euch beiden für die hilfe  .
|
|
|
Similar Threads
|
WTS LV110 WARLOCK/CLI Satrun
08/30/2010 - Silkroad Online Trading - 5 Replies
WTS LV110 WARLOCK/CLI Satrun
for more information pm me or post ur email
only gold or chars on server helios
or psc
or cash via westren union
email verifed but i will give all email infos
|
2 Bytes oder 4 Bytes ?
02/13/2010 - Kal Online - 3 Replies
Erm wenn ich nach cooldowns schaue für Mockery mit der UCE
such ich dann mit 2 Bytes oder 4 Bytes ??
|
CLI.exe
07/21/2006 - Technical Support - 2 Replies
Kann mir jemand sagen was das viellt ist? Adaware?
|
All times are GMT +1. The time now is 19:27.
|
|