Shellcode Generator



  • Also ich möchte einen Shellcode Generator schreiben aber irgendwie produziert das Script keinen funktionierenden Shellcode..

    Ein ein wenig abgeändertes Prograamm hier aus dem forum:

    #include "stdafx.h"
    
    #include <stdio.h>
    #include <stdlib.h>
    
    void main (void)
    {
      char in_name[512];
      FILE *in, *out;
      int count;
    
      printf ("file? ");
      scanf ("%s", in_name);
    
      in = fopen (in_name, "rb");
      if (!in)
      {
        puts ("can't open source file");
        exit (0);
      }
    
      out = fopen ("shellcode.h", "wb");  // <--- nach belieben ändern
      if (!out)
      {
        puts ("can't open output file");
        exit (0);
      }
    
      fputs ("char shellcode[] =\"", out);
      count = 0;
      int s =0;
      for (;;)
      {
        int c = fgetc (in);
        if (c == EOF)
        {
    
          break;
        }
    
    	    if (count++ == 50)   // line breaks
        {
          fputs ("\"\r\n\t\"", out);
          count = 0;
        }
        fprintf (out, "\\x%02x", c);  
      }
      fputs ("\";\n", out);
    
      puts ("\ndone");
    }
    

    Wenn ich versuche den Code so auszuführen funktioniert es nicht es passiert nichts...

    void main() {
       int *ret;
    
       ret = (int *)&ret + 2;
       (*ret) = (int)shellcode;
    
    }
    

    Danke



  • shellcode schrieb:

    Also ich möchte einen Shellcode Generator schreiben aber irgendwie produziert das Script keinen funktionierenden Shellcode..

    Aber du weißt schon, was für einen Sinn '*-freak's Code hatte?

    Und was ist das:

    void main() {
       int *ret;
    
       ret = (int *)&ret + 2;
       (*ret) = (int)shellcode;
    
    }
    

    😕



  • omg hatte da was verwechselt ... shellcode ist ja von assembler abhängig ...


Anmelden zum Antworten