Changeset 691

Show
Ignore:
Timestamp:
10/30/06 20:05:21 (2 years ago)
Author:
common
Message:

nepenthes

  • Makefile.am, create new dirs for postgres spooling and honeytrap pcap files
  • module-honeytrap
    • moved some vars to config
  • submit-postgres
    • use te created dir
  • Config.hpp
    • fix header
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • nepenthes/trunk/Makefile.am

    r527 r691  
    4949        $(mkinstalldirs) $(DESTDIR)$(localstatedir)/cache 
    5050        $(mkinstalldirs) $(DESTDIR)$(localstatedir)/cache/nepenthes 
    51         $(mkinstalldirs) $(DESTDIR)$(localstatedir)/cache/nepenthes/geolocation 
     51        $(mkinstalldirs) $(DESTDIR)$(localstatedir)/cache/nepenthes/pcap 
    5252        $(mkinstalldirs) $(DESTDIR)$(localstatedir)/cache/nepenthes/signatures 
    5353 
     
    5757        $(mkinstalldirs) $(DESTDIR)$(localstatedir)/spool/nepenthes 
    5858        $(mkinstalldirs) $(DESTDIR)$(localstatedir)/spool/nepenthes/gotek 
     59        $(mkinstalldirs) $(DESTDIR)$(localstatedir)/spool/nepenthes/submitpostgres 
    5960        $(mkinstalldirs) $(DESTDIR)$(localstatedir)/log 
     61        $(mkinstalldirs) $(DESTDIR)$(localstatedir)/log/pcap 
    6062        $(mkinstalldirs) $(DESTDIR)$(localstatedir)/binaries 
    6163        $(mkinstalldirs) $(DESTDIR)$(localstatedir)/hexdumps 
  • nepenthes/trunk/modules/module-honeytrap/PCAPSocket.cpp

    r689 r691  
    7676                 [SYN] ACK SYN|ACK (RST|FIN) */ 
    7777 
    78         if ( m_PacketCount <= 3
     78        if ( m_PacketCount < g_ModuleHoneytrap->getPcapMinPackets()
    7979                drop_file = true; 
    8080 
     
    220220        char *pcap_file_path; 
    221221 
    222         asprintf(&pcap_file_path,"var/log/nepenthes/pcap/%i_%s-%i_%s-%i.pcap", 
     222        asprintf(&pcap_file_path,"%s/%i_%s-%i_%s-%i.pcap", 
     223                         g_ModuleHoneytrap->getPcapPath().c_str(), 
    223224                         (int)time(NULL), 
    224225                         rhost.c_str(),getRemotePort(), 
  • nepenthes/trunk/modules/module-honeytrap/TrapSocket.cpp

    r690 r691  
    801801                } 
    802802#ifdef HAVE_PCAP 
    803                 if ( m_HTType != HT_PCAP ) 
     803                if ( g_ModuleHoneytrap->getPcapDumpFiles() &&  m_HTType != HT_PCAP ) 
    804804                { 
    805805                        if ( g_ModuleHoneytrap->socketExists((uint32_t)ip->ip_src.s_addr, ntohs(tcp->th_sport), 
  • nepenthes/trunk/modules/module-honeytrap/module-honeytrap.conf.dist

    r573 r691  
    11module-honeytrap 
    22{ 
    3         listen_mode     "ipq";  // valid values are ipq pcap and divert 
     3        listen_mode     "ipq";  // valid values are ipq pcap and ipfw 
    44 
    55 
     
    99        }; 
    1010         
    11         divert 
     11        ipfw 
    1212        { 
    13                 port  "4711"; 
     13                divert_port   "4711"; 
    1414        }; 
     15 
    1516         
     17        write_pcap_files        "1";    /* creates a single pcap file per accepted connection 
     18                                           only supported in ipq and ipfw mode */ 
     19 
     20        pcap_dump_options 
     21        {        
     22                min_packets "3";                        // minimum of packets, else the dump gets removed 
     23                path    "var/log/pcap/";                // path for pcap files relative to basedir 
     24        };       
    1625         
    1726}; 
  • nepenthes/trunk/modules/module-honeytrap/module-honeytrap.cpp

    r679 r691  
    112112        g_ModuleHoneytrap = this; 
    113113 
     114        m_PcapDumpFiles = false; 
     115        m_PcapDumpFilePath      = "var/log/pcap/"; 
     116        m_PcapMinPackets        = 3; 
     117 
     118 
    114119} 
    115120 
     
    144149 
    145150                mode = m_Config->getValString("module-honeytrap.listen_mode"); 
     151 
     152                m_PcapDumpFiles         = (bool)m_Config->getValInt("module-honeytrap.write_pcap_files"); 
     153                m_PcapDumpFilePath      = m_Config->getValString("module-honeytrap.pcap_dump_options.path");; 
     154                m_PcapMinPackets        = m_Config->getValInt("module-honeytrap.pcap_dump_options.min_packets");; 
     155 
    146156        } catch ( ... ) 
    147157        { 
     
    153163                        TrapSocket::getSupportedModes().c_str(), 
    154164                        mode.c_str()); 
     165 
     166 
     167        if (m_PcapDumpFiles == true) 
     168        { 
     169#ifdef HAVE_PCAP 
     170                logInfo("Dumping accepted connection pcap files to %s if they have the minimum of %i packets\n", 
     171                                m_PcapDumpFilePath.c_str(), 
     172                                m_PcapMinPackets); 
     173#else 
     174                logWarn("Not dumping to pcap files (not supported)\n"); 
     175                m_PcapDumpFiles = false; 
     176#endif 
     177 
     178        }else 
     179        { 
     180                logInfo("Not dumping to pcap files\n"); 
     181        } 
     182 
    155183 
    156184        Socket *s = NULL; 
     
    187215                try 
    188216                { 
    189                         port = m_Config->getValInt("module-honeytrap.divert.port"); 
     217                        port = m_Config->getValInt("module-honeytrap.ipfw.divert_port"); 
    190218                } catch (...) 
    191219                { 
     
    349377} 
    350378 
     379bool        ModuleHoneyTrap::getPcapDumpFiles() 
     380{ 
     381        return m_PcapDumpFiles; 
     382} 
     383 
     384 
     385string      ModuleHoneyTrap::getPcapPath() 
     386{ 
     387 
     388        return m_PcapDumpFilePath; 
     389} 
     390 
     391uint32_t    ModuleHoneyTrap::getPcapMinPackets() 
     392{ 
     393        return m_PcapMinPackets; 
     394} 
     395 
    351396 
    352397extern "C" int32_t module_init(int32_t version, Module **module, Nepenthes *nepenthes) 
  • nepenthes/trunk/modules/module-honeytrap/module-honeytrap.hpp

    r679 r691  
    119119        bool socketExists(uint32_t remotehost, uint16_t remoteport, uint32_t localhost, uint16_t localport); 
    120120 
     121                bool            getPcapDumpFiles(); 
     122                string          getPcapPath(); 
     123                uint32_t        getPcapMinPackets(); 
     124 
     125 
    121126        protected: 
    122127                map<connection_t ,Socket *,cmp_connection_t> m_Sockets; 
     
    125130 
    126131                string m_DialogueFactory; 
     132 
     133                bool            m_PcapDumpFiles; 
     134                string          m_PcapDumpFilePath; 
     135                uint32_t        m_PcapMinPackets; 
    127136        }; 
    128137 
  • nepenthes/trunk/modules/submit-postgres/submit-postgres.conf.dist

    r667 r691  
    77        options "";             // not sure if options already work (ssl is an option) 
    88         
    9         spooldir "var/spool/submitpostgres/"; 
     9        spooldir "var/spool/nepenthes/submitpostgres/"; 
    1010}; 
    1111         
  • nepenthes/trunk/nepenthes-core/include/Config.hpp

    r321 r691  
    2828/* $Id$ */ 
    2929 
    30 #ifndef CONFIG_H 
    31 #define CONIFG_H 
     30#ifndef HAVE_CONFIG_HPP 
     31#define HAVE_CONFIG_HPP 
    3232 
    3333#include <vector>