forked from gigablast/open-source-search-engine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Blaster.h
91 lines (74 loc) · 1.57 KB
/
Blaster.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#include "Conf.h"
#include "Dns.h"
#include "HttpServer.h"
#include "HashTableT.h"
#include "Loop.h"
//#include "Links.h"
#include "iana_charset.h"
#include <sys/resource.h> // setrlimit
struct StateBD {
//Url m_u1,m_u2;
//Url *m_u;
char *m_u1,*m_u2;
char *m_u;
char *m_buf1;
int32_t m_buf1Len;
int32_t m_buf1MaxLen;
int32_t m_numUrlDocsSent;
int32_t m_numUrlDocsReceived;
SafeBuf m_injectUrl;
};
struct StateBD2 {
StateBD *m_st;
int32_t m_numRedirects;
//Url m_url;
char *m_url;
};
class Blaster {
public:
Blaster();
~Blaster();
void reset();
bool init();
void runBlaster(char *file1,char *file2,
int32_t maxNumThreads, int32_t wait,
bool isLogFile,
bool verbose,bool justDisplay,
bool useProxy,
bool injectUrlWithLinks = false ,
bool injectUrl = false );
void startBlastering();
void freeStateBD(StateBD *st);
void gotDoc1(void *state,TcpSocket *s);
void gotDoc2(void *state,TcpSocket *s);
void gotDoc3 ( void *state, TcpSocket *s);
void gotDoc4 ( void *state, TcpSocket *s);
void processLogFile(void *state);
bool m_doInjection;
bool m_doInjectionWithLinks;
protected:
int32_t m_maxNumThreads;
int32_t m_launched;
char *m_buf1;
int32_t m_bufSize1;
char *m_buf2;
int32_t m_bufSize2;
char *m_p1;
char *m_p1end;
char *m_p2;
char *m_p2end;
int32_t m_totalUrls;
int32_t m_totalDone;
bool m_portSwitch;
int32_t m_wait;
bool m_justDisplay;
bool m_useProxy;
bool m_verbose;
bool m_isLogFile;
int64_t m_startTime;
int32_t m_numUrls;
char **m_lineStart;
bool m_blasterDiff;
bool m_print;
};
extern Blaster g_blaster;