Changeset 574

Show
Ignore:
Timestamp:
06/25/06 00:34:08 (3 years ago)
Author:
common
Message:

nepenthes
- module-honeytrap

  • minor cleanups, formatting, indenting
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • nepenthes/trunk/modules/module-honeytrap/module-honeytrap.cpp

    r573 r574  
    249249{ 
    250250#ifdef HAVE_IPFW 
    251     if ((m_DivertSocket = socket(PF_INET, SOCK_RAW, IPPROTO_DIVERT)) == -1)  
     251    if ((m_DivertSocket = socket(PF_INET, SOCK_RAW, IPPROTO_IPFW)) == -1)  
    252252    { 
    253253        logCrit("Could not create divert socket for ipfw %s\n",strerror(errno)); 
     
    291291        } 
    292292 
    293         string bpf_filter_string = "tcp[tcpflags] & tcp-rst != 0 "; 
     293        string bpf_filter_string = "tcp[tcpflags] & tcp-rst != 0 and tcp[4:4] = 0 "; 
    294294 
    295295        pcap_if_t *alldevsp = NULL; 
     
    334334                                        logSpam("\t\t\tdstaddr %s\n",inet_ntoa(*(struct in_addr*) &(((struct sockaddr_in *)addr->dstaddr)->sin_addr))); 
    335335 
    336                                 if (bpf_filter_string_addition == ""
     336                                if ( bpf_filter_string_addition == ""
    337337                                { 
    338                                                 bpf_filter_string_addition +=   string("src host ") +  
    339                                                                                 string(inet_ntoa(*(struct in_addr*) &(((struct sockaddr_in *)addr->addr)->sin_addr))) +  
    340                                                                                 string(" "); 
    341                                 }else 
     338                                        bpf_filter_string_addition +=   string("src host ") +  
     339                                                                                                        string(inet_ntoa(*(struct in_addr*) &(((struct sockaddr_in *)addr->addr)->sin_addr))) +  
     340                                                                                                        string(" "); 
     341                                } 
     342                                else 
    342343                                { 
    343                                         bpf_filter_string_addition += string("or src host ") +  
    344                                                         string(inet_ntoa(*(struct in_addr*) &(((struct sockaddr_in *)addr->addr)->sin_addr))) +  
    345                                                         string(" "); 
     344                                        bpf_filter_string_addition +=   string("or src host ") +  
     345                                                                                                       string(inet_ntoa(*(struct in_addr*) &(((struct sockaddr_in *)addr->addr)->sin_addr))) +  
     346                                                                                                       string(" "); 
    346347                                } 
    347348                                 
     
    391392        if (bpf_filter_string_addition != "") 
    392393        { 
    393                 bpf_filter_string += "and (" + bpf_filter_string_addition + ")"; 
     394                bpf_filter_string += "and ( " + bpf_filter_string_addition + ")"; 
    394395        } 
    395396 
     
    593594                if ( ntohl(tcp->th_seq) != 0 ) 
    594595                        return 0; 
     596 
    595597                logInfo("Got RST packet from localhost:%i %i\n",ntohs(tcp->th_sport),tcp->th_sport); 
     598                printIPpacket((unsigned char *)ip,ip->ip_len); 
    596599 
    597600                Socket *sock = g_Nepenthes->getSocketMgr()->bindTCPSocket(INADDR_ANY,ntohs(tcp->th_sport),600,60); 
     
    832835                        ntohs(ip->ip_len) ); 
    833836 
    834         logSpam("  | %s --> " ,  
     837        logSpam("  |- Source       %s \n" ,  
    835838                        inet_ntoa(ip->ip_src) ); 
    836839 
    837         logSpam("%s \n" ,  
     840        logSpam("  |- Destionation %s \n" ,  
    838841                        inet_ntoa(ip->ip_dst) ); 
    839842