1 /*
2  * ccsrch (c) 2007 Mike Beekey  - zaphod2718@yahoo.com
3  * All rights reserved
4  *
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2
9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
19  *
20  */
21 
22 #include <stdio.h>
23 #include <stdlib.h>
24 #include <string.h>
25 #include <unistd.h>
26 #include <time.h>
27 #include <errno.h>
28 #include <sys/stat.h>
29 #include <sys/types.h>
30 #include <dirent.h>
31 
32 #ifndef SIGHUP
33   #define SIGHUP 1
34 #endif
35 #ifndef SIGQUIT
36   #define SIGQUIT 3
37 #endif
38 
39 #define PROG_VER "ccsrch 1.0.3 (c) 2007 zaphod2718@yahoo.com"
40 
41 #define MDBUFSIZE 512
42 #define MAXPATH 2048
43 #define BSIZE 4096
44 #define CARDTYPELEN 64
45 #define CARDSIZE 17
46 
47 extern int errno;
48 
49 int ccsrch (char *str);
50 void check_mastercard_16(long offset);
51 void check_visa_16(long offset);
52 void check_discover_16(long offset);
53 void check_jcb_16(long offset);
54 void check_amex_15(long offset);
55 void check_enroute_15(long offset);
56 void check_jcb_15(long offset);
57 void check_diners_club_cb_14(long offset);
58 void check_visa_13(long offset);
59 void cleanup_shtuff();
60 int escape_space(char *infile, char *outfile);
61 int get_file_stat(char *infile, struct stat *fattr);
62 int luhn_check (int len, long offset);
63 int open_logfile ();
64 void print_num (int *buf, int len);
65 void print_result(char *str, int len, long offset);
66 int proc_dir_list (char *instr);
67 void process_cleanup();
68 int process_prefix(int len, long offset);
69 void signal_proc();
70 int track1_srch(int len);
71 int track2_srch(int len);
72 void usage (char *prog);
73 
74