Changeset 1555

Show
Ignore:
Timestamp:
02/17/08 13:25:24 (8 months ago)
Author:
till
Message:

honeytrap
- simple Nebula submission plugin

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • honeytrap/trunk/configure.in

    r1425 r1555  
    6868 
    6969bold () { 
    70         text=`echo -e "$1" | sed -e "s/%B/${term_bold}/g" -e "s/%b/${term_norm}/g" 2>/dev/null` 
    71         echo "$text" 
     70        text=`echo -ne "$1" | sed -e "s/%B/${term_bold}/g" -e "s/%b/${term_norm}/g" 2>/dev/null` 
     71        echo -n "$text" 
    7272} 
    7373 
     
    303303                        bold "   %BError%b - libpcap headers not found. Install them or use the following options:" 
    304304                        echo 
    305                         bold "   %B--with-libpcap-includes=%b\133location of libpcap header files\135" 
     305                        echo 
     306                        bold "   %B--with-libpcap-includes=%b" 
     307                        echo -e "\x5blocation of libpcap header files\x5d" 
    306308                        echo 
    307309                        exit 1 
     
    317319                        bold "   %BError%b - libpcap library not found. Install it or use the following options:" 
    318320                        echo 
    319                         bold "   %B--with-libpcap-libraries=%b\133location of libpcap shared library files\135" 
     321                        echo 
     322                        bold "   %B--with-libpcap-libraries=%b" 
     323                        echo -e "\5blocation of libpcap shared library files\x5d" 
    320324                        echo 
    321325                        exit 1 
     
    343347                        bold "   %BError%b - libnetfilter_queue headers not found. Install them or use the following options:" 
    344348                        echo 
    345                         bold "   %B--with-libnfq-includes=%b\133location of libnetfilter_queue header files\135" 
     349                        echo 
     350                        bold "   %B--with-libnfq-includes=%b" 
     351                        echo -e "\x5blocation of libnetfilter_queue header files\x5d" 
    346352                        echo 
    347353                        exit 
     
    357363                        bold "   %BError%b - libnetfilter_queue library not found. Install it or use the following options:" 
    358364                        echo 
    359                         bold "   %B--with-libnfq-libraries=%b\133location of libnetfilter_queue shared library files\135" 
     365                        echo 
     366                        bold "   %B--with-libnfq-libraries=%b" 
     367                        echo -e "\x5blocation of libnetfilter_queue shared library files\x5d" 
    360368                        echo 
    361369                        exit 
     
    382390                        bold "   %BError%b - libipq headers not found. Install them or use the following options:" 
    383391                        echo 
    384                         bold "   %B--with-libipq-includes=%b\133location of libipq header files\135" 
     392                        echo 
     393                        bold "   %B--with-libipq-includes=%b" 
     394                        echo -e "\x5blocation of libipq header files\x5d" 
    385395                        echo 
    386396                        exit 
     
    396406                        bold "   %BError%b - libipq library not found. Install it or use the following options:" 
    397407                        echo 
    398                         bold "   %B--with-libipq-libraries=%b\133location of libipq shared library files\135" 
     408                        echo 
     409                        bold "   %B--with-libipq-libraries=%b" 
     410                        echo -e "\x5blocation of libipq shared library files\x5d" 
    399411                        echo 
    400412                        exit 
     
    413425                bold "   %BError%b - No connection monitor selected. Please reconfigure with one of the following:" 
    414426                echo 
     427                echo 
    415428                bold "   %B--with-stream-mon=%bnfq    receive packets via netfilter's NFQUEUE target (Linux only, recommended)" 
     429                echo 
    416430                bold "   %B--with-stream-mon=%bipq    receive packets via netfilter's QUEUE target (Linux only)" 
     431                echo 
    417432                bold "   %B--with-stream-mon=%bpcap   receive packets using a built-in pcap sniffer" 
     433                echo 
    418434                echo 
    419435                exit 1 
     
    458474    bold "   %BError%b - libclamav headers not found. Install them or use the following options:" 
    459475    echo 
    460     bold "   %B--with-libclamav-includes=%b\133location of libclamav header filesi\135" 
     476    echo 
     477    bold "   %B--with-libclamav-includes=%b" 
     478    echo -e "\x5blocation of libclamav header files\x5d" 
    461479    echo 
    462480    exit 
     
    472490    bold "   %BError%b - libclamav library not found. Install it or use the following options:" 
    473491    echo 
    474     bold "   %B--with-libclamav-libraries=%b\133location of libclamav shared library files\135" 
     492    echo 
     493    bold "   %B--with-libclamav-libraries=%b" 
     494    echo -e "\x5blocation of libclamav shared library files\x5d" 
    475495    echo 
    476496    exit 
     
    490510    bold "   Use %B--enable-devmodules%b to build it anyway." 
    491511    echo 
     512    echo 
    492513    exit 
    493514  fi 
     
    511532    bold "   %BError%b - libemu headers not found. Install them or use the following options:" 
    512533    echo 
    513     bold "   %B--with-libemu-includes=%b\133location of libemu header files\135" 
     534    echo 
     535    bold "   %B--with-libemu-includes=%b" 
     536    echo -e "\x5blocation of libemu header files\x5d" 
    514537    echo 
    515538    exit 
     
    525548    bold "   %BError%b - libemu library not found. Install it or use the following options:" 
    526549    echo 
    527     bold "   %B--with-libemu-libraries=%b\133location of libemu shared library files\135" 
     550    echo 
     551    bold "   %B--with-libemu-libraries=%b" 
     552    echo -e "\x5blocation of libemu shared library files\x5d" 
    528553    echo 
    529554    exit 
     
    545570                bold "   Use %B--enable-devmodules%b to build it anyway." 
    546571                echo 
     572                echo 
    547573                exit 
    548574        fi 
     
    570596                bold "   %BError%b - libcurl headers not found. Install them or use the following options:" 
    571597                echo 
    572                 bold "   %B--with-libcurl-includes=%b\133location of libcurl header files\135" 
     598                echo 
     599                bold "   %B--with-libcurl-includes=%b" 
     600                echo -e "\x5blocation of libcurl header files\x5d" 
    573601                echo 
    574602                exit 
     
    584612                bold "   %BError%b - libcurl library not found. Install it or use the following options:" 
    585613                echo 
    586                 bold "   %B--with-libcurl-libraries=%b\133location of libcurl shared library files\135" 
     614                echo 
     615                bold "   %B--with-libcurl-libraries=%b" 
     616                echo -e "\x5blocation of libcurl shared library files\x5d" 
    587617                echo 
    588618                exit 
     
    590620else 
    591621        with_submit_mwserv=" " 
     622fi 
     623 
     624 
     625 
     626AC_ARG_WITH(submit-nebula, 
     627        [  --with-submit-nebula            submit attacks to a nebula server]) 
     628AM_CONDITIONAL(BUILD_SUBMIT_NEBULA_PLUGIN, test x$with_submit_nebula = xyes) 
     629if test "$with_submit_nebula" = "yes"; then 
     630        if test "$enable_devmodules" != "X"; then 
     631                echo 
     632                echo "   The submitNebula plugin is still unstable and should not be used in production setups." 
     633                bold "   Use %B--enable-devmodules%b to build it anyway." 
     634                echo 
     635                echo 
     636                exit 
     637        fi 
     638 
     639        with_submit_nebula="X" 
     640 
     641        AC_CHECK_FUNC(gethostbyname, , AC_CHECK_LIB(nsl, gethostbyname)) 
     642 
     643        AC_ARG_WITH(zlib_includes, 
     644        [  --with-zlib-includes=DIR        zlib include directory], 
     645        [with_zlib_includes="$withval"],[with_zlib_includes=no]) 
     646 
     647        AC_ARG_WITH(zlib_libraries, 
     648        [  --with-zlib-libraries=DIR       zlib library directory], 
     649        [with_zlib_libraries="$withval"],[with_zlib_libraries=no]) 
     650 
     651        if test "$with_zlib_includes" != "no"; then 
     652                CFLAGS="${CFLAGS} -I${with_zlib_includes}" 
     653        fi 
     654        HZ="yes" 
     655        AC_CHECK_HEADER(zlib.h,, HZ="no") 
     656        if test "$HZ" = "no"; then 
     657                echo 
     658                bold "   %BError%b - zlib headers not found. Install them or use the following options:" 
     659                echo 
     660                echo 
     661                bold "   %B--with-zlib-includes=%b" 
     662                echo -e "\x5blocation of zlib header files\x5d" 
     663                echo 
     664                exit 
     665        fi 
     666 
     667        if test "$with_zlib_libraries" != "no"; then 
     668                LDFLAGS="${LDFLAGS}  -L${with_zlib_libraries}" 
     669        fi 
     670        LZ="yes" 
     671        AC_CHECK_LIB(z, compress, LZ="yes", LZ="no") 
     672        if test "$LZ" = "no"; then 
     673                echo 
     674                bold "   %BError%b - zlib library not found. Install it or use the following options:" 
     675                echo 
     676                echo 
     677                bold "   %B--with-zlib-libraries=%b" 
     678                echo -e "\x5blocation of zlib shared library files\x5d" 
     679                echo 
     680                exit 
     681        fi 
     682else 
     683        with_submit_nebula=" " 
    592684fi 
    593685 
     
    782874bold "  ----- %Bhoneytrap configuration%b -----" 
    783875echo 
     876echo 
    784877echo "  General options" 
    785878bold "    (%B$enable_debug%b)  Debugging" 
     879echo 
    786880bold "    (%B$enable_profile%b)  Profiling" 
     881echo 
    787882bold "    (%B$enable_devmodules%b)  Unstable Modules" 
     883echo 
    788884bold "    (%B$with_efence%b)  Electric Fence" 
     885echo 
    789886echo 
    790887echo "  Connection monitor" 
    791888bold "    (%B$with_ipq_mon%b)  Linux ip_queue (ipq)" 
     889echo 
    792890bold "    (%B$with_ipfw_mon%b)  FreeBSD ipfw (ipfw)" 
     891echo 
    793892bold "    (%B$with_nfq_mon%b)  Linux libnetfilter_queue (nfq)" 
     893echo 
    794894bold "    (%B$with_pcap_mon%b)  Libpcap (pcap)" 
     895echo 
    795896echo 
    796897echo "  Optional plugins" 
    797898bold "    (%B$with_clamav%b)  ClamAV" 
     899echo 
    798900bold "    (%B$with_cpuemu%b)  cpuEmu" 
     901echo 
    799902bold "    (%B$with_cspm%b)  CSPM" 
     903echo 
    800904bold "    (%B$with_postgres%b)  PostgeSQL" 
     905echo 
    801906bold "    (%B$with_spamsum%b)  SpamSum" 
     907echo 
    802908bold "    (%B$with_submit_mwserv%b)  submitMwserv" 
     909echo 
     910bold "    (%B$with_submit_nebula%b)  submitNebula" 
     911echo 
  • honeytrap/trunk/src/modules/Makefile.am

    r1489 r1555  
    3535if BUILD_SUBMIT_MWSERV_PLUGIN 
    3636lib_LTLIBRARIES += htm_submitMWserv.la 
     37endif 
     38 
     39if BUILD_SUBMIT_NEBULA_PLUGIN 
     40lib_LTLIBRARIES += htm_submitNebula.la 
    3741endif 
    3842 
     
    8084endif 
    8185 
     86if BUILD_SUBMIT_NEBULA_PLUGIN 
     87htm_submitNebula_la = htm_submitNebula.c htm_submitNebula.h 
     88htm_submitNebula_la_LDFLAGS = -module -no-undefined -avoid-version -lz 
     89endif 
     90 
    8291 
    8392if BUILD_CSPM_PLUGIN 
  • honeytrap/trunk/src/modules/htm_submitMWserv.c

    r1506 r1555  
    175175 
    176176int check_response(const bstr *response) { 
     177printf("--> response is '%s'\n", response->data); 
    177178        switch(response_code(response)) { 
    178179        case TSS_OK: 
     
    186187                return(TSS_ERROR); 
    187188        case TSS_UNKNOWN: 
     189        default: 
    188190                logmsg(LOG_ERR, 1, "SubmitMWServ - Server returned status UNKNOWN.\n"); 
    189191                return(TSS_UNKNOWN); 
    190         default: 
    191                 return(0); 
    192192        } 
    193193 
     
    205205                FD_ZERO(&wfds); 
    206206                FD_ZERO(&efds); 
     207printf("--> selecting...\n"); 
    207208                 
    208209                max_fd = 0; 
     
    232233                        break; 
    233234                default: 
    234                         if (FD_ISSET(sigpipe[0], &rfds) && (check_sigpipe() == -1)) exit(EXIT_FAILURE); 
     235printf("--> got data.\n"); 
     236                        if (FD_ISSET(sigpipe[0], &rfds) && (check_sigpipe() == -1)) { 
     237                                fprintf(stderr, "SubmitMWServ Error - Select failed.\n"); 
     238                                exit(EXIT_FAILURE); 
     239                        } 
    235240 
    236241                        handles = 0; 
     
    238243                        while(curl_multi_perform(mhandle, &handles) == CURLM_CALL_MULTI_PERFORM && handles); 
    239244 
    240                         if ((resp = check_response(response)) == -1) return(-1); 
    241                         else if (resp == 1) return(1); 
     245printf("--> checking response.\n"); 
     246                        switch (resp = check_response(response)) { 
     247        printf("response is %u\n", resp); 
     248                        case TSS_UNKNOWN: 
     249                                break; 
     250                        case TSS_OK: 
     251                                return(1); 
     252                        default: 
     253                                return(-1); 
     254                        } 
    242255                } 
    243256        } 
     
    265278        logmsg(LOG_NOISY, 1, "SubmitMWServ - Constructing HTTP form for request type %d.\n", type); 
    266279         
     280printf("--> adding guid\n"); 
    267281        curl_formadd(&pinfo, &pinfo_last, CURLFORM_PTRNAME, "guid", CURLFORM_PTRCONTENTS, guid, CURLFORM_END); 
     282printf("--> adding maintainer\n"); 
    268283        curl_formadd(&pinfo, &pinfo_last, CURLFORM_PTRNAME, "maintainer", CURLFORM_PTRCONTENTS, maintainer, CURLFORM_END); 
     284printf("--> adding secret\n"); 
    269285        curl_formadd(&pinfo, &pinfo_last, CURLFORM_PTRNAME, "secret", CURLFORM_PTRCONTENTS, secret, CURLFORM_END);  
    270286 
     287        if (uri) { 
     288printf("--> adding uri\n"); 
    271289        curl_formadd(&pinfo, &pinfo_last, CURLFORM_PTRNAME, "uri", 
    272290                CURLFORM_PTRCONTENTS, uri, CURLFORM_CONTENTSLENGTH, strlen(uri), CURLFORM_END); 
     291        } 
    273292         
     293printf("--> adding data\n"); 
    274294        curl_formadd(&pinfo, &pinfo_last, CURLFORM_PTRNAME, "data", 
    275295                CURLFORM_PTRCONTENTS, data, 
     
    326346                memset(&response, 0, sizeof(bstr)); 
    327347                 
     348printf("--> uri is %s\n", uri); 
    328349                if ((pinfo = init_handle(&multihandle, &curlhandle, 
    329350                                attack->download[i].dl_payload.data, attack->download[i].dl_payload.size, 
     
    332353                        return(0); 
    333354                } 
     355printf("--> handle initialized\n"); 
    334356 
    335357                if (transfer_data(multihandle, &response) == TSS_OK) 
    336358                        logmsg(LOG_NOTICE, 1, "SubmitMWServ - Sample is already present at %s, skipping submission.\n", mwserv_url); 
    337                 elseif ( 
    338359                else 
    339360                        logmsg(LOG_ERR, 1, "SubmitMWServ Error - Hash test failed.\n"); 
  • honeytrap/trunk/src/sock.c

    r1489 r1555  
    6262        if ((bind(fd, (struct sockaddr *) server_addr, sizeof(struct sockaddr_in))) != 0) { 
    6363            /* we already got one server process */ 
    64             logmsg(LOG_DEBUG, 1, "Unable to bind to port %u/tcp: %m.\n", port); 
     64            logmsg(LOG_DEBUG, 1, "Unable to bind to port %u/tcp: %m.\n", ntohs(port)); 
    6565#ifdef USE_IPQ_MON 
    6666            /* hand packet processing back to the kernel */ 
     
    9191            /* if bind() did not fail for 'port already in use' but for some other reason, 
    9292             *  we're in troubles and want a verbose error message */ 
    93             if (errno != 98) logmsg(LOG_NOISY, 1, "Warning - Could not bind to port %u/tcp: %m.\n", port); 
     93            if (errno != 98) logmsg(LOG_NOISY, 1, "Warning - Could not bind to port %u/tcp: %m.\n", ntohs(port)); 
    9494            exit(EXIT_FAILURE); 
    9595#endif 
  • honeytrap/trunk/tools/htprox.c

    r1118 r1555  
    1818 */ 
    1919 
     20#include <arpa/inet.h> 
     21#include <errno.h> 
     22#include <netdb.h> 
     23#include <signal.h> 
    2024#include <stdio.h> 
    2125#include <stdlib.h> 
    2226#include <string.h> 
    2327#include <strings.h> 
    24 #include <netdb.h> 
    25 #include <signal.h> 
    2628#include <sys/socket.h> 
    27 #include <arpa/inet.h> 
    2829#include <unistd.h> 
    29  
    30 extern int h_errno; 
    31 extern int errno; 
    3230 
    3331