Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define __USE_GNU
- #include <stdio.h>
- #include <stdlib.h>
- #include <unistd.h>
- #include <string.h>
- #define OUIFile "/usr/local/share/wireshark/manuf"
- FILE *ouiFile;
- unsigned long ouiFSize;
- void main(int argc, char *argv[]){
- if (argc < 2 || argc > 2){
- printf("\nUsage: %s <MAC ADDRESS>\n\n",argv[0]);
- exit(1);
- }
- if ( access("./manuf", F_OK) != -1){
- printf("USING ./manuf\n");
- ouiFile=fopen("./manuf","r");
- }
- else if ( access(OUIFile, F_OK) != -1){
- printf("USING OUIFile\n");
- ouiFile=fopen(OUIFile,"r");
- }
- else {
- printf("File not found D:\n");
- exit(1);
- }
- fseek(ouiFile, 0, SEEK_END);
- ouiFSize = ftell(ouiFile);
- rewind(ouiFile);
- printf("File Size: %li\n",ouiFSize);
- char fileBuf[ouiFSize];
- fread(fileBuf,1,ouiFSize,ouiFile);
- fileBuf[ouiFSize] = 0;//Get rid of the EOF
- char *match = strcasestr(fileBuf,argv[1]);
- if ( match != NULL ){
- char *end = strpbrk(match, "\n");
- char *ouiOut = malloc(128);
- strncpy(ouiOut, match, end - match);
- printf("\n\n%s\n",ouiOut);
- }
- else {
- printf("No match found :(\n");
- }
- //char *ouiOut; Why dosent that work?
- // you also need to add a check for full MAC and Only the OUI (lowercase only), mabey add a probability and best match scenarios also
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement