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

bfdgrep.c

bfdgrep.c
Posted Apr 7, 2001
Authored by vade79, realhalo | Site realhalo.org

Bfdgrep.c looks through binaries for filenames which exist on the local system.

tags | local
systems | unix
SHA-256 | c4d7a70b3b9d5600018271aea48c7ea0d07dd88eec8756fd97a27b7d51cfb26f

bfdgrep.c

Change Mirror Download
/* BFDGREP: binary filename/directory grep. **********************************
* bfgrep.c/bfgrep, binary filename/directory grep. (from which exist) *
* for obtaining existing filename(s) or directory(s) used by a binary *
* executable. argument 1 will be treated as a (binary) file, if none is *
* provided or the provided argument isn't accessable it will revert to *
* standard input. *
* *
* EXAMPLES: *
* # bfdgrep [filename] [...] *
* # cat <filename> | bfdgrep *
* *
* DISPLAY: *
* /path/file(location found:access): /path/file found. *
* *
* COMMENTS: *
* this program will only display with full valid paths (files and dirs). *
* also, this program will not display information that is not used in a *
* function. for example, something mentioned in a printf() statement *
* would not get displayed. *
* *
* by: vade79 -> v9[v9@realhalo.org] -> realhalo.org. (88l!271w!3208b) *
*****************************************************************************/
#include <stdio.h>
#include <unistd.h>
#include <sys/stat.h>
#define MAX_PATHNAME 4096 /* maximum path storage. (max) */
#define INPUT "/dev/stdin" /* revert to this (input) if no file. */
char id[]="$Id: bfdgrep.c,v 3.0 2001/03/24 01:11:36 EST vade79 Exp $";
char *file;
int main(int argc,char **argv) {
int i=0;
if(argc>1){
for(i=1;i<argc;i++){
parse_file(argv[i]);
}
}
else
parse_file(INPUT);
}
int parse_file(char *fn){
int i=0;
int chr=0;
long loc=0x0;
char string[MAX_PATHNAME];
char mode[5];
struct stat mod;
FILE *fd;
if(!(fd=fopen(fn,"r")))
printf("%s: failed opening file for reading.\n",fn);
else{
while((chr=fgetc(fd))!=EOF){
if(isprint(chr)){
string[i++]=chr;
if(i>sizeof(string)){
bzero(string,sizeof(string));
i=0;
}
}
else if(chr==0x0){
if(strlen(string)>1&&!stat(string,&mod))
if(string[0]==0x2f){
bzero(mode,sizeof(mode));
if(!access(string,F_OK)){
sprintf(mode,"+");
if(!access(string,R_OK))
strcat(mode,"r");
if(!access(string,W_OK))
strcat(mode,"w");
if(!access(string,X_OK))
strcat(mode,"x");
}
else
sprintf(mode,"-");
fprintf(stderr,"%s(0x%lx:%s): %s\n",strcmp(fn,INPUT)?fn:"input",
(loc-strlen(string)),mode,string);
}
bzero(string,sizeof(string));
i=0;
}
else{
bzero(string,sizeof(string));
i=0;
}
loc++;
}
fclose(fd);
}
}
Login or Register to add favorites

File Archive:

December 2024

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

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2024 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close