exploit the possibilities
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:

June 2024

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