dsniff
2.4b2
About: A collection of tools for network auditing Fossies Dox: dsniff-2.4b2.tar.gz ("inofficial" and yet experimental doxygen-generated source code documentation) 
|
Go to the documentation of this file. 13 #include <sys/types.h> 26 #define USER_REGEX ".*account.*|.*acct.*|.*domain.*|.*login.*|" \ 27 ".*member.*|.*user.*|.*name|.*email|.*_id|" \ 28 "id|uid|mn|mailaddress" 30 #define PASS_REGEX ".*pass.*|.*pw|pw.*|additional_info" 32 #define REGEX_FLAGS (REG_EXTENDED | REG_ICASE | REG_NOSUB) 44 if ((tmp = strdup(
buf)) == NULL)
47 for (p = strtok(tmp,
"&"); p != NULL; p = strtok(NULL,
"&")) {
48 if ((q = strchr(p,
'=')) == NULL)
62 if (user && pass)
break;
66 return (user && pass);
74 if ((uri = strchr(req,
' ')) == NULL)
77 if ((vers = strrchr(uri,
' ')) == uri) {
80 else if (vers[-1] ==
'/') {
98 struct buf *msg, inbuf, outbuf;
99 char *p, *req, *auth, *pauth, *query, *
host;
112 errx(1,
"regcomp failed");
114 while ((i =
buf_index(&inbuf,
"\r\n\r\n", 4)) >= 0) {
115 msg =
buf_tok(&inbuf, NULL, i);
119 if ((req = strtok(
buf_ptr(msg),
"\r\n")) == NULL)
122 if (strncmp(req,
"GET ", 4) != 0 &&
123 strncmp(req,
"POST ", 5) != 0 &&
124 strncmp(req,
"CONNECT ", 8) != 0)
127 auth = pauth = query =
host = NULL;
129 if ((query = strchr(req,
'?')) != NULL)
132 while ((p = strtok(NULL,
"\r\n")) != NULL) {
133 if (strncasecmp(p,
"Authorization: Basic ", 21) == 0) {
136 else if (strncasecmp(p,
"Proxy-authorization: " 137 "Basic ", 27) == 0) {
140 else if (strncasecmp(p,
"Host: ", 6) == 0) {
143 else if (req[0] ==
'P') {
144 if (strncmp(p,
"Content-type: ", 14) == 0) {
145 if (strncmp(p + 14,
"application/" 146 "x-www-form-urlencoded",
151 else if (strncmp(p,
"Content-length: ", 16) == 0) {
154 if ((msg =
buf_tok(&inbuf, NULL, i)) == NULL)
165 if (req[0] ==
'G' && auth)
187 else if (req[0] ==
'P' && query) {
189 "Content-type: application/" 190 "x-www-form-urlencoded\n" 191 "Content-length: %d\n%s\n",
192 strlen(query), query);
static regex_t * pass_regex
int buf_putf(buf_t buf, const char *fmt,...)
void buf_init(buf_t buf, u_char *data, int len)
static regex_t * user_regex
int decode_http(u_char *buf, int len, u_char *obuf, int olen)
void err(int eval, const char *fmt,...)
buf_t buf_tok(buf_t buf, void *sep, int len)
void errx(int eval, const char *fmt,...)
char * dirname(char *path) const
int base64_pton(char const *src, u_char *target, size_t targsize)
static char * http_req_dirname(char *req)
static int grep_query_auth(char *buf)
int buf_index(buf_t buf, void *ptr, int len)