evolve or die

mfp_chksrc.c

mfp_chksrc.c
Posted Nov 8, 2003
Authored by m4rc3l0

Mfp_chksrc.c checks C source code for commonly insecure functions like gets, fgets, strcpy, strcat, setenv, getenv, scanf, sscanf, fscanf, sprintf, fprintf, snprintf, syslog, system, popen, vsprintf, and vsnprintf.

systems | unix
MD5 | 3618f9cfc226eaeca62e65754eb9bd6d

mfp_chksrc.c

Change Mirror Download
/* mfp_chksrc.c (c)oded by m4rc3l0 in 102003 *
* *
* Baseado no srcsec.c feito por bob@dtors *
* Checa o source atras d funcoes bugadas do *
* tipo(strcpy, gets, ...) entendes feosos ? *
* *
* Greetz: Julie(T AMO LINDA), BashX, akabr, *
* eSc2, tuv8, habeas, brun3rz, r0ot, qwq, *
* acubidu, deadsckt, decodi(minha putana), *
* volfi, reignu, unistd, baalcefas, morfis, *
* fingulino, sinner, japex, joshua, anjin, *
* #dnh #binaryrebels #linuxarena *
* AT BRasnet *
* *
* www.binaryrebels.cjb.net *
* www.m4rc3l0rlz.hpg.ig.com.br *
* *
* Mail-eu: m4rc3l0rlz@yahoo.com.br */

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>

#define TAG "\x6d\x66\x70"
#define UND "\x5f"

#define MAX 100


void banner();

FILE *fp;

struct {
int t; // tipo, 0x1=BOF, 0x2=FMT
char *strs; // Str Search
} listun[] = {
{0x1, "gets"}, {0x1, "fgets"}, {0x1, "strcpy"},
{0x1, "strcat"}, {0x1, "setenv"}, {0x1, "getenv"},
{0x1, "scanf"}, {0x1, "sscanf"}, {0x1, "fscanf"},
{0x2, "sprintf"}, {0x2, "fprintf"}, {0x2, "snprintf"},
{0x2, "syslog"}, {0x2, "system"}, {0x2, "popen"},
{0x2, "vsprintf"}, {0x2, "vsnprintf"},
};

int main(int argc, char *argv[]) {
int fv=0; // Flag Verbose
int x, afu;
char bufi[100];
char *arq = (char *)malloc(MAX * sizeof(char));

if(argc!=2) {
banner();
fprintf(stderr, "Usage: %s <file>\n", argv[0]);
exit(-1);
}
strncpy(arq, argv[1], strlen(argv[1]));

if((fp=fopen(arq, "r")) == NULL) {
fprintf(stderr, "Error opening file: %s\n", arq);
exit(-1);
}

printf("File: %s\n\n", arq);

fseek(fp, 0, SEEK_SET);

do {
afu = fscanf(fp, "%s\n", bufi);
for(x=0; x<17; x++) {
if((strstr(bufi, listun[x].strs)) != NULL) {
if(listun[x].t == 1) {
printf("%s():%db:BOF\n", listun[x].strs,
(ftell(fp)) - strlen(listun[x].strs)); // Valor qse certo
}
else
printf("%s():%db:FMT\n", listun[x].strs,
(ftell(fp)) - strlen(listun[x].strs)); // Valor qse certo
}
}
} while (afu != EOF);

fclose(fp);
return(0);
}


void banner(void) {
printf("%s%schksrc.c (c)oded by m4rc3l0\n", TAG, UND);
}

Comments

RSS Feed Subscribe to this comment feed

No comments yet, be the first!

Login or Register to post a comment

File Archive:

May 2012

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    May 1st
    37 Files
  • 2
    May 2nd
    53 Files
  • 3
    May 3rd
    33 Files
  • 4
    May 4th
    4 Files
  • 5
    May 5th
    10 Files
  • 6
    May 6th
    17 Files
  • 7
    May 7th
    19 Files
  • 8
    May 8th
    36 Files
  • 9
    May 9th
    34 Files
  • 10
    May 10th
    35 Files
  • 11
    May 11th
    20 Files
  • 12
    May 12th
    18 Files
  • 13
    May 13th
    11 Files
  • 14
    May 14th
    27 Files
  • 15
    May 15th
    58 Files
  • 16
    May 16th
    54 Files
  • 17
    May 17th
    25 Files
  • 18
    May 18th
    53 Files
  • 19
    May 19th
    9 Files
  • 20
    May 20th
    15 Files
  • 21
    May 21st
    25 Files
  • 22
    May 22nd
    32 Files
  • 23
    May 23rd
    35 Files
  • 24
    May 24th
    26 Files
  • 25
    May 25th
    25 Files
  • 26
    May 26th
    0 Files
  • 27
    May 27th
    0 Files
  • 28
    May 28th
    0 Files
  • 29
    May 29th
    0 Files
  • 30
    May 30th
    0 Files
  • 31
    May 31st
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2012 Packet Storm. All rights reserved.

close