what you don't know can hurt you
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:

August 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Aug 1st
    15 Files
  • 2
    Aug 2nd
    22 Files
  • 3
    Aug 3rd
    0 Files
  • 4
    Aug 4th
    0 Files
  • 5
    Aug 5th
    15 Files
  • 6
    Aug 6th
    11 Files
  • 7
    Aug 7th
    43 Files
  • 8
    Aug 8th
    42 Files
  • 9
    Aug 9th
    36 Files
  • 10
    Aug 10th
    0 Files
  • 11
    Aug 11th
    0 Files
  • 12
    Aug 12th
    27 Files
  • 13
    Aug 13th
    18 Files
  • 14
    Aug 14th
    0 Files
  • 15
    Aug 15th
    0 Files
  • 16
    Aug 16th
    0 Files
  • 17
    Aug 17th
    0 Files
  • 18
    Aug 18th
    0 Files
  • 19
    Aug 19th
    0 Files
  • 20
    Aug 20th
    0 Files
  • 21
    Aug 21st
    0 Files
  • 22
    Aug 22nd
    0 Files
  • 23
    Aug 23rd
    0 Files
  • 24
    Aug 24th
    0 Files
  • 25
    Aug 25th
    0 Files
  • 26
    Aug 26th
    0 Files
  • 27
    Aug 27th
    0 Files
  • 28
    Aug 28th
    0 Files
  • 29
    Aug 29th
    0 Files
  • 30
    Aug 30th
    0 Files
  • 31
    Aug 31st
    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