Changeset 674

Show
Ignore:
Timestamp:
10/23/06 03:31:53 (2 years ago)
Author:
common
Message:

nepenthes

  • submit-norman
    • submit to cwsandbox too, add a new config var urls, which is a list of urls to post to
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • nepenthes/trunk/modules/submit-norman/submit-norman.conf.dist

    r321 r674  
    33        // this is the adress where norman sandbox reports will be sent 
    44        email   "malware@mac.com"; 
     5        urls    ("http://sandbox.norman.no/live_4.html", 
     6                 "http://luigi.informatik.uni-mannheim.de/submit.php?action=verify"); 
     7 
    58}; 
  • nepenthes/trunk/modules/submit-norman/submit-norman.cpp

    r550 r674  
    108108        } 
    109109 
     110        StringList sList; 
     111         
    110112        try 
    111113        { 
    112114                m_Email = m_Config->getValString("submit-norman.email"); 
     115                sList = *m_Config->getValStringList("submit-norman.urls"); 
     116 
    113117    } catch ( ... ) 
    114118        { 
     
    116120                return false; 
    117121        } 
     122 
     123        uint8_t i = 0; 
     124        while ( i < sList.size() ) 
     125        { 
     126                logInfo("Submitting via http post to %s\n",sList[i]); 
     127                m_UrlList.push_back(string(sList[i])); 
     128                i++; 
     129        } 
     130 
    118131 
    119132        m_ModuleManager = m_Nepenthes->getModuleMgr(); 
     
    160173        if(m_Events.test(EV_TIMEOUT) == false) 
    161174        m_Events.set(EV_TIMEOUT); 
    162         CURL *curl; 
    163  
    164         NormanContext *norm = new NormanContext((char *)m_Email.c_str(),down->getDownloadUrl()->getFile(),down->getDownloadBuffer()->getSize(), 
    165                                                                                    down->getDownloadBuffer()->getData(), (char *)down->getMD5Sum().c_str()); 
    166         curl = curl_easy_init(); 
    167         if ( curl ) 
    168         { 
    169                 /* what URL that receives this POST */ 
    170         curl_easy_setopt(curl, CURLOPT_HTTPHEADER, norm->m_HeaderList); 
    171                 curl_easy_setopt(curl, CURLOPT_HTTPPOST, norm->m_FormPost); 
    172                 curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, false); 
    173                 curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, false); 
    174                 curl_easy_setopt(curl, CURLOPT_URL           , "http://sandbox.norman.no/live_4.html");//"http://localhost:8888/examplepost.cgi");// 
    175                 curl_easy_setopt(curl, CURLOPT_USERAGENT     , "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)"); 
    176                 curl_easy_setopt(curl, CURLOPT_PRIVATE           , (char *) norm); 
    177                 curl_easy_setopt(curl, CURLOPT_WRITEDATA                , norm); 
    178                 curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION    , SubmitNorman::WriteCallback); 
    179  
    180         curl_multi_add_handle(m_CurlStack, curl); 
    181                 m_Queued++; 
     175 
     176        list <string>::iterator it; 
     177 
     178        for ( it = m_UrlList.begin(); it != m_UrlList.end(); it++ ) 
     179        { 
     180                CURL *curl; 
     181 
     182                NormanContext *norm = new NormanContext((char *)m_Email.c_str(), 
     183                                                                                                down->getDownloadUrl()->getFile(), 
     184                                                                                                down->getDownloadBuffer()->getSize(), 
     185                                                                                                down->getDownloadBuffer()->getData(),  
     186                                                                                                (char *)down->getMD5Sum().c_str()); 
     187                curl = curl_easy_init(); 
     188                if ( curl ) 
     189                { 
     190                        /* what URL that receives this POST */ 
     191                        curl_easy_setopt(curl, CURLOPT_HTTPHEADER               , norm->m_HeaderList); 
     192                        curl_easy_setopt(curl, CURLOPT_HTTPPOST                 , norm->m_FormPost); 
     193                        curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST   , false); 
     194                        curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER   , false); 
     195                        curl_easy_setopt(curl, CURLOPT_URL                              , it->c_str()); 
     196                        curl_easy_setopt(curl, CURLOPT_USERAGENT                , "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)"); 
     197                        curl_easy_setopt(curl, CURLOPT_PRIVATE                  , (char *) norm); 
     198                        curl_easy_setopt(curl, CURLOPT_WRITEDATA                , norm); 
     199                        curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION    , SubmitNorman::WriteCallback); 
     200 
     201                        curl_multi_add_handle(m_CurlStack, curl); 
     202                        m_Queued++; 
     203                } 
    182204        } 
    183205 
     
    188210{ 
    189211        int32_t iSize = size * nitems; 
     212//      printf("%.*s\n",iSize,buffer); 
    190213        return iSize; 
    191214} 
     
    238261                                { 
    239262                                        curl_easy_getinfo(pMessage->easy_handle, CURLINFO_EFFECTIVE_URL, &szUrl); 
    240                                         logInfo("Submitted file %s to sandbox \n",norm->getMD5Sum()); 
     263                                        logInfo("Submitted file %s to sandbox %s\n",norm->getMD5Sum(),szUrl); 
    241264                                } 
    242265                                CURL *curl = pMessage->easy_handle; 
  • nepenthes/trunk/modules/submit-norman/submit-norman.hpp

    r321 r674  
    145145                int32_t         m_Queued; 
    146146                string m_Email; 
     147 
     148                list <string> m_UrlList; 
    147149        }; 
    148150}