what you don't know can hurt you
Home Files News &[SERVICES_TAB]About Contact Add New

fm-dmpsc.c

fm-dmpsc.c
Posted Jan 25, 2005
Authored by nemo

Small application written to make life easier. It dumps C style opcodes between two provided offsets.

tags | shellcode
SHA-256 | 4e7b34bd72aa38097381c48faee3882bfff8bfafa9e16fcbd8a7d692399b7651

fm-dmpsc.c

Change Mirror Download
/*
* ~[ fm-dmpsc.c ]
*
* Dump the opcodes from a file, starting from an offset provided.
*
* written by -( nemo @ felinemenace.org )-
*
* _,'| _.-''``-...___..--';)
* /_ \'. __..-' , ,--...--'''
* <\ .`--''' ` /'
* `-';' ; ; ;
* __...--'' ___...--_..' .;.'
* fL (,__....----''' (,..--''
* -( http://www.felinemenace.org )-
*
*/

#include <stdio.h>
#include <errno.h>

#define MAXSC 10000

void usage(char *file)
{
printf("usage: %s <file> <offset1> [<offset2>]\n",file);
exit(1);
}

int main(int ac, char **av)
{
char shellcode[MAXSC] = "char shellcode[] = {\n\"";
unsigned int curr,offset1,offset2 = 0xffffffff;
FILE *fp;
char *ptr = shellcode + strlen(shellcode) - 1;
unsigned char hex;
int cnt = 0;

if(ac < 3 || ac > 4)
usage(*av);
sscanf(av[2],"%p",&offset1);
if(av[3])
sscanf(av[3],"%p",&offset2);
if(offset2 <= offset1)
usage(*av);
if(!(fp = fopen(av[1],"r+"))) {
printf("Error opening file.\n");
exit(1);
}
if(fseek(fp,offset1,SEEK_SET) == -1){
printf("Error seeking to offset1.\n");
exit(1);
}
do {
if((offset1 + cnt) >= offset2) {
break;
}
if(cnt && !(cnt % 16)) {
strcat(ptr,"\"\n\"");
ptr+=3;
}
strcat(ptr,"\\x");
if(!(fread(&hex, 1,1,fp) ==1)) {
if(errno) {
printf("An error has occured reading from the file.\n");
exit(1);
}
break;
}
ptr+=3;
sprintf(ptr,"%02x",hex);
cnt++;
} while(ptr++ < (shellcode + MAXSC - 4)) ;
strcat(ptr,"\"\n};\n");
printf("// shellcode generated by -( nemo@felinemenace.org )-\n");
printf("%s\n",shellcode);

return 0;
}
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