00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef backdoor_h
00023 #define backdoor_h
00024
00025 #include "TCP.h"
00026 #include "Timer.h"
00027 #include "NetVar.h"
00028 #include "Login.h"
00029
00030 class BackDoorEndpoint : public TCP_EndpointAnalyzer {
00031 public:
00032 BackDoorEndpoint(TCP_Endpoint* e);
00033
00034 int DataSent(double t, int seq, int len, int caplen, const u_char* data,
00035 const IP_Hdr* ip, const struct tcphdr* tp);
00036
00037 RecordVal* BuildStats();
00038
00039 void FinalCheckForRlogin();
00040
00041 protected:
00042 void CheckForRlogin(int seq, int len, const u_char* data);
00043 void RloginSignatureFound(int len);
00044
00045 void CheckForTelnet(int seq, int len, const u_char* data);
00046 void TelnetSignatureFound(int len);
00047
00048 void CheckForSSH(int seq, int len, const u_char* data);
00049 void CheckForFTP(int seq, int len, const u_char* data);
00050 void CheckForRootBackdoor(int seq, int len, const u_char* data);
00051 void CheckForNapster(int seq, int len, const u_char* data);
00052 void CheckForGnutella(int seq, int len, const u_char* data);
00053 void CheckForKazaa(int seq, int len, const u_char* data);
00054 void CheckForHTTP(int seq, int len, const u_char* data);
00055 void CheckForHTTPProxy(int seq, int len, const u_char* data);
00056 void CheckForSMTP(int seq, int len, const u_char* data);
00057 void CheckForIRC(int seq, int len, const u_char* data);
00058 void CheckForGaoBot(int seq, int len, const u_char* data);
00059
00060 void SignatureFound(EventHandlerPtr e, int do_orig = 0);
00061
00062 int CheckForStrings(const char** strs, const u_char* data, int len);
00063 int CheckForString(const char* str, const u_char* data, int len);
00064
00065 int is_partial;
00066 int max_top_seq;
00067
00068 int rlogin_checking_done;
00069 int rlogin_num_null;
00070 int rlogin_string_separator_pos;
00071 int rlogin_slash_seen;
00072
00073 uint32 num_pkts;
00074 uint32 num_8k4_pkts;
00075 uint32 num_8k0_pkts;
00076 uint32 num_lines;
00077 uint32 num_normal_lines;
00078 uint32 num_bytes;
00079 uint32 num_7bit_ascii;
00080 };
00081
00082 class BackDoorAnalyzer : public TCP_Analyzer {
00083 public:
00084 BackDoorAnalyzer(TCP_Connection* c);
00085 ~BackDoorAnalyzer();
00086
00087 void Done();
00088 void StatTimer(double t, int is_expire);
00089
00090 protected:
00091 void StatEvent();
00092 void RemoveEvent();
00093
00094 BackDoorEndpoint* orig_endp;
00095 BackDoorEndpoint* resp_endp;
00096 double timeout;
00097 double backoff;
00098 };
00099
00100 class BackDoorTimer : public Timer {
00101 public:
00102 BackDoorTimer(double t, BackDoorAnalyzer* a);
00103 ~BackDoorTimer();
00104
00105 void Dispatch(double t, int is_expire);
00106
00107 protected:
00108 BackDoorAnalyzer* analyzer;
00109 };
00110
00111 #endif