in the silk code tutorial, I saw the following example:
main(){
exit(0);
}
The idea was to create exit () - syscall. So they build:
Section .text
global _start
_start:
mov ebx, 0
mov eax, 1
int 0x80
I understand it. 0 is the exit () argument that we save in ebx, 1 is the syscall exit number, and from 0x80 we change the CPU to kernel mode and syscall is executed.
After that, they allow you to create operation codes that:
bb 00 00 00 00
b8 01 00 00 00
cd 80
Then they translate this into a C language that looks like this:
char example[] = "\xbb\x00\x00\x00\x00"
"\xb8\x01\x00\x00\x00"
"\xcd\x80"
int main(){
int *pointer;
pointer = (int *)&pointer+2;
(*pointer) = (int)example;
}
So, I understand that they take opcodes in the char array, but I don’t understand what they did in the main () method. The first line is fine. But what do they want to express on the 2nd and 3rd lines?
Yours faithfully,
source
share