Reputation: 354
I wish to convert the compiled c++ code below to a shellcode
#include <iostream>
int main()
{
std::cout << "hello world" << std::endl;
return 0;
}
I have a basic idea of the PE format, but don't really know how to go about converting an exe to shellcode, as far as I know I don't need to convert the MZ
or the dos statement.
What I am asking for is guides or links on this subject or explanation from a more experienced hacker/developer on how would he/she do it not the code it self
what to look for and what frameworks/programming languages to use
I am exploring pefile
in python but I can't tell if I am on the right track
Upvotes: 2
Views: 978
Reputation: 149
In the example code you really have a const char*
which is placed in .rdata
section (or .data
) so you can't just take the shellcode out.
And you used some external functions, you need to implement it in the shellcode.
The optimal solution is compile to MS-DOS COM to get the shellcode or implement yourself std::cout
, then relocate the "hello world" to a location in the shellcode which you don't use.
Upvotes: 0