exploit the possibilities
Home Files News &[SERVICES_TAB]About Contact Add New

cartoon.c

cartoon.c
Posted Feb 24, 2003

Cartoon.c converts ELF binaries to shellcode.

tags | shellcode
SHA-256 | edd78f7120b523d108f4d89712bdfa6ff4f779d5ffcd02a305d0915f7798d3e3

cartoon.c

Change Mirror Download
/* binary (ELF) to shellcode converter */
/* by Dalnet SLACKo slacko@mail.ru */
#include <stdio.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/mman.h>
#include <linux/elf.h>
int main(int argc,char **argv) {
Elf32_Ehdr _ehdr;
Elf32_Shdr _shdr;
struct stat _info;
unsigned long _mapped;
unsigned long _offset;
int fd,i,_shnum;
int _nextsize = 0;
stat(argv[1],&_info);
if(argc!=2) {
fprintf(stderr,"Usage %s <binary-file>\n",argv[0]);
exit(1);
}
if((fd = open(argv[1],O_RDWR,0)) == -1) {
perror("open()");
exit(1);
}
(void *)_mapped = mmap(0,_info.st_size,PROT_READ|PROT_WRITE,MAP_SHARED,fd,0);
if( *(long *)_mapped != (long)0x464c457f) {
fprintf(stderr,"File is not an ELF binary file\n");
exit(1);
}
_ehdr = *(Elf32_Ehdr *)_mapped;
_shnum = _ehdr.e_shnum;
_shdr = *(Elf32_Shdr *)(_mapped + _ehdr.e_shoff);
_offset = _ehdr.e_entry - 0x08048000;
for(i=0;i<_shnum;i++) {
if(_shdr.sh_offset == _offset)
break;
else {
_nextsize += sizeof(Elf32_Shdr);
_shdr = *(Elf32_Shdr *)(_mapped + _ehdr.e_shoff + _nextsize);
}
}
printf("Shellcode size %d bytes\n",_shdr.sh_size);
for(i=0;i<_shdr.sh_size;i++) {
if(!(i % 10) && i!=0)
printf("\"\n\"");
if(i == 0)
printf("\n\"");
printf("\\x%x",*(unsigned char *)(_mapped + _offset + i));
}
printf("\"\n\n");
munmap((void *)_mapped,_info.st_size);
close(fd);
}












Login or Register to add favorites

File Archive:

April 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Apr 1st
    10 Files
  • 2
    Apr 2nd
    26 Files
  • 3
    Apr 3rd
    40 Files
  • 4
    Apr 4th
    6 Files
  • 5
    Apr 5th
    26 Files
  • 6
    Apr 6th
    0 Files
  • 7
    Apr 7th
    0 Files
  • 8
    Apr 8th
    22 Files
  • 9
    Apr 9th
    14 Files
  • 10
    Apr 10th
    10 Files
  • 11
    Apr 11th
    13 Files
  • 12
    Apr 12th
    14 Files
  • 13
    Apr 13th
    0 Files
  • 14
    Apr 14th
    0 Files
  • 15
    Apr 15th
    30 Files
  • 16
    Apr 16th
    10 Files
  • 17
    Apr 17th
    22 Files
  • 18
    Apr 18th
    45 Files
  • 19
    Apr 19th
    0 Files
  • 20
    Apr 20th
    0 Files
  • 21
    Apr 21st
    0 Files
  • 22
    Apr 22nd
    0 Files
  • 23
    Apr 23rd
    0 Files
  • 24
    Apr 24th
    0 Files
  • 25
    Apr 25th
    0 Files
  • 26
    Apr 26th
    0 Files
  • 27
    Apr 27th
    0 Files
  • 28
    Apr 28th
    0 Files
  • 29
    Apr 29th
    0 Files
  • 30
    Apr 30th
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2022 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close