Changeset 1569
- Timestamp:
- 02/25/08 09:23:26 (6 months ago)
- Files:
-
- honeytrap/trunk/src/modules/htm_submitNebula.c (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
honeytrap/trunk/src/modules/htm_submitNebula.c
r1567 r1569 182 182 unsigned long cbuf_len; 183 183 u_char *cbuf, response[9]; 184 u_int32_t nonce ;185 u_int16_t hmac_len ;184 u_int32_t nonce, len; 185 u_int16_t hmac_len, hmac_port; 186 186 struct sockaddr_in sock; 187 187 int sock_fd, bytes_read, total_bytes; … … 268 268 return(-1); 269 269 } 270 nonce = ntohl(nonce); 270 271 logmsg(LOG_DEBUG, 1, "SubmitNebula - Nonce received.\n"); 271 272 } … … 286 287 return(-1); 287 288 } 289 free(cbuf); 288 290 289 291 // send hashed secret … … 327 329 } 328 330 329 // send port (in host byte order) 330 if (write(sock_fd, &(attack->a_conn.l_port), 2) == -1) { 331 // send port 332 hmac_port = htons(attack->a_conn.l_port); 333 if (write(sock_fd, &(hmac_port), 2) == -1) { 331 334 logmsg(LOG_ERR, 1, "SubmitNebula Error - Writing to socket failed: %m.\n"); 332 335 close(sock_fd); … … 335 338 336 339 // send length of uncompressed attack 337 if (write(sock_fd, &(attack->a_conn.payload.size), 4) == -1) { 340 len = htonl(attack->a_conn.payload.size); 341 if (write(sock_fd, &(len), 4) == -1) { 338 342 logmsg(LOG_ERR, 1, "SubmitNebula Error - Writing to socket failed: %m.\n"); 339 343 close(sock_fd); … … 364 368 365 369 // send length of compressed attack 366 if (write(sock_fd, &cbuf_len, 4) == -1) { 370 len = htonl(cbuf_len); 371 if (write(sock_fd, &len, 4) == -1) { 367 372 logmsg(LOG_ERR, 1, "SubmitNebula Error - Writing to socket failed: %m.\n"); 368 373 close(sock_fd); … … 384 389 } 385 390 memcpy(cbuf+cbuf_len, &attack->a_conn.protocol, 1); 386 memcpy(cbuf+cbuf_len+1, & attack->a_conn.l_port, 2);391 memcpy(cbuf+cbuf_len+1, &hmac_port, 2); 387 392 388 393 if ((sha512sum = hmac(&cbuf, cbuf_len+3)) == NULL) { … … 394 399 395 400 // send length of HMAC 396 hmac_len = strlen(sha512sum);401 hmac_len = ntohs(strlen(sha512sum)); 397 402 if (write(sock_fd, &hmac_len, sizeof(hmac_len)) == -1) { 398 403 logmsg(LOG_ERR, 1, "SubmitNebula Error - Writing to socket failed: %m.\n");
