1 /***************************************************************************
2                           definitions.h  -  description
3                              -------------------
4     begin                : Sun Dec 29 2002
5     copyright           : (C) 2002 by Proxy Labs (www.proxylabs.com)
6     email                : yaph@proxylabs.com
7  ***************************************************************************/
8 
9 /***************************************************************************
10  *                                                                         *
11  *   This program is free software; you can redistribute it and/or modify  *
12  *   it under the terms of the GNU General Public License as published by  *
13  *   the Free Software Foundation; either version 2 of the License, or     *
14  *   (at your option) any later version.                                   *
15  *                                                                         *
16  ***************************************************************************/
17 
18 //-- errcodes
19 #define READ_LINE_ERROR_READ_FD -1
20 #define READ_LINE_ERROR_SIZE_EXCEEDED -2
21 
22 #define READ_N_BYTES_ERROR_READ_FD -1
23 
24 //-- buffers
25 #define BUFF_SIZ (1024*10)
26 #define CONTENT_BUFF_SIZ (1024*256)
27 #define BUFF_TARGET_SIZ 100
28 #define BUFF_HOST_SIZ 20
29 #define BUFF_PORT_SIZ 7
30 
31 // log line
32 #define  FFL __FILE__, __FUNCTION__ , __LINE__
33 
34 //-- macros
35 #define exit_error(x)   {\
36 FILE *f=NULL;\
37 int sig=SIGKILL;\
38 char d_stamp[100];\
39 struct tm tm;\
40 time_t t;\
41 if(globals->log_file_f)\
42    f=globals->log_file_f;\
43 else\
44    f=stderr;\
45 t=time(NULL);\
46 localtime_r(&t,&tm);\
47 strftime(d_stamp,99,"%a %d/%b %H:%M:%S",&tm);\
48 fprintf(f,"[%s]:%s:%s:%d:FATAL ERROR: %s , errno=%d\n",d_stamp,FFL,strerror(x),x);\
49 fflush(f);\
50 if(globals && globals->nmap_pid)\
51  kill(globals->nmap_pid,sig);\
52 kill(0,sig);\
53 exit(x);}
54 
55 //-- version
56 #define YAPH_VERSION "0.91"
57 
58 
59 
60 typedef enum {  NMAP_E=0,HUNTER_FILE_E,OUR_FILE_E} engine_type;
61 //-- structures
62 typedef struct bank_node_st
63 {
64    struct sockaddr_in addr;
65    struct bank_node_st * next;
66 } bank_node;
67 
68 typedef struct global_st
69 {
70    char ** nmap_string;
71    char *content_host;
72    char *content_data;
73    char *content_request;
74    int debug_level;
75    int content_port;
76    pthread_mutex_t mutex;
77    pid_t nmap_pid;
78    int target_output_fd;
79    int target_input_fd;
80    int nmap_output_fd;
81    int nmap_input_fd;
82    int tcp_read_time_out;
83    int tcp_connect_time_out;
84    FILE * result_f;
85    FILE * log_file_f;
86    engine_type et;
87    sem_t check_sem;
88    int paral_checks;
89    bank_node *bank;
90 }  global_data;
91 
92 typedef enum {  ALL_TYPES=0,HTTP_TYPE,SOCKS4_TYPE,SOCKS5_TYPE } check_type;
93 typedef struct
94 {
95 struct sockaddr_in target_addr;
96 check_type	type;
97 } target_st;
98 
99 // some defaults
100 #define CONTENT_PORT 80
101 #define CONTENT_HOST "www.yahoo.com"
102 #define CONTENT_DATA "search.yahoo.com"
103 #define CONTENT_REQUEST  "GET / HTTP/1.0\r\n\r\n"
104