@@ -430,8 +430,11 @@ def create_tempfile(content)
430430 # Perform DNS resolution by default
431431 { 'RHOSTS' => 'https://user:pass@multiple_ips.example.com:9000/foo' , 'PROXIES' => 'http:198.51.100.1:1080' , 'expected' => 1 } ,
432432
433+ # Perform DNS resolution when socks5 proxy present
434+ { 'RHOSTS' => 'https://user:pass@multiple_ips.example.com:9000/foo' , 'PROXIES' => 'socks5:198.51.100.1:1080' , 'expected' => 2 } ,
435+
433436 # Skip DNS resolution when socks5 proxy present
434- { 'RHOSTS' => 'https://user:pass@multiple_ips.example.com:9000/foo' , 'PROXIES' => 'socks5 :198.51.100.1:1080' , 'expected' => 1 } ,
437+ { 'RHOSTS' => 'https://user:pass@multiple_ips.example.com:9000/foo' , 'PROXIES' => 'socks5h :198.51.100.1:1080' , 'expected' => 1 } ,
435438
436439 # Skip DNS resolution when http proxy present
437440 { 'RHOSTS' => 'https://user:pass@multiple_ips.example.com:9000/foo' , 'PROXIES' => 'http:198.51.100.1:1080' , 'expected' => 1 } ,
@@ -570,9 +573,20 @@ def create_tempfile(content)
570573 expect ( each_error_for ( http_mod ) ) . to be_empty
571574 end
572575
573- it 'enumerates a single host without performing DNS resolution if a socks5 proxy is registered' do
576+ it 'enumerates resolving a single http value to multiple ip addresses if a socks5 proxy is registered' do
574577 http_mod . datastore [ 'RHOSTS' ] = 'http://multiple_ips.example.com/foo'
575578 http_mod . datastore [ 'PROXIES' ] = 'socks5:198.51.100.1:1080'
579+ expected = [
580+ { 'RHOSTNAME' => 'multiple_ips.example.com' , 'RHOSTS' => '198.51.100.1' , 'RPORT' => 80 , 'VHOST' => 'multiple_ips.example.com' , 'SSL' => false , 'HttpUsername' => '' , 'HttpPassword' => '' , 'TARGETURI' => '/foo' } ,
581+ { 'RHOSTNAME' => 'multiple_ips.example.com' , 'RHOSTS' => '203.0.113.1' , 'RPORT' => 80 , 'VHOST' => 'multiple_ips.example.com' , 'SSL' => false , 'HttpUsername' => '' , 'HttpPassword' => '' , 'TARGETURI' => '/foo' }
582+ ]
583+ expect ( each_host_for ( http_mod ) ) . to have_datastore_values ( expected )
584+ expect ( each_error_for ( http_mod ) ) . to be_empty
585+ end
586+
587+ it 'enumerates a single host without performing DNS resolution if a socks5h proxy is registered' do
588+ http_mod . datastore [ 'RHOSTS' ] = 'http://multiple_ips.example.com/foo'
589+ http_mod . datastore [ 'PROXIES' ] = 'socks5h:198.51.100.1:1080'
576590 expected = [
577591 { 'RHOSTNAME' => 'multiple_ips.example.com' , 'RHOSTS' => 'multiple_ips.example.com' , 'RPORT' => 80 , 'VHOST' => 'multiple_ips.example.com' , 'SSL' => false , 'HttpUsername' => '' , 'HttpPassword' => '' , 'TARGETURI' => '/foo' } ,
578592 ]
@@ -722,10 +736,10 @@ def create_tempfile(content)
722736 expect ( each_error_for ( kerberos_mod ) ) . to be_empty
723737 end
724738
725- it 'preserves a RHOSTNAME even if RHOSTS is set and a socks5 proxy is registered' do
739+ it 'preserves a RHOSTNAME even if RHOSTS is set and a socks5h proxy is registered' do
726740 kerberos_mod . datastore [ 'RHOSTS' ] = 'multiple_ips.example.com'
727741 kerberos_mod . datastore [ 'RHOSTNAME' ] = 'example.com'
728- kerberos_mod . datastore [ 'PROXIES' ] = 'socks5 :198.51.100.1:1080'
742+ kerberos_mod . datastore [ 'PROXIES' ] = 'socks5h :198.51.100.1:1080'
729743
730744 expected = [
731745 { "RHOSTNAME" => "example.com" , "RHOSTS" => "multiple_ips.example.com" } ,
@@ -966,9 +980,9 @@ def create_tempfile(content)
966980 expect ( each_host_for ( postgres_mod ) ) . to have_datastore_values ( expected )
967981 end
968982
969- it 'enumerates postgres schemes and avoids DNS resolution if a socks5 proxy is registered' do
983+ it 'enumerates postgres schemes and avoids DNS resolution if a socks5h proxy is registered' do
970984 postgres_mod . datastore [ 'RHOSTS' ] = 'postgres://postgres:@example.com "postgres://user:a b [email protected] /" "postgres://user:a b [email protected] :9001/database_name"' 971- postgres_mod . datastore [ 'PROXIES' ] = 'socks5 :198.51.100.1:1080'
985+ postgres_mod . datastore [ 'PROXIES' ] = 'socks5h :198.51.100.1:1080'
972986 expected = [
973987 { 'RHOSTNAME' => 'example.com' , 'RHOSTS' => 'example.com' , 'RPORT' => 5432 , 'USERNAME' => 'postgres' , 'PASSWORD' => '' , 'DATABASE' => 'template1' } ,
974988 { 'RHOSTNAME' => 'example.com' , 'RHOSTS' => 'example.com' , 'RPORT' => 5432 , 'USERNAME' => 'user' , 'PASSWORD' => 'a b c' , 'DATABASE' => 'template1' } ,
0 commit comments