Update Resolver's use of Rex Sockets
Compose configuration hashes for the Rex Sockets used in requests based on the Resolver's own configuration, including passing the Framework context, and CHOST/CPORT options in from Msf namespaces.MS-2855/keylogger-mettle-extension
parent
a8c3adf19c
commit
e3c372834e
|
@ -186,11 +186,19 @@ module DNS
|
||||||
@config[:tcp_timeout].timeout do
|
@config[:tcp_timeout].timeout do
|
||||||
catch(:next_ns) do
|
catch(:next_ns) do
|
||||||
begin
|
begin
|
||||||
socket = Rex::Socket::Tcp.create(
|
config = {
|
||||||
'PeerHost' => ns.to_s,
|
'PeerHost' => ns.to_s,
|
||||||
'PeerPort' => @config[:port].to_i,
|
'PeerPort' => @config[:port].to_i,
|
||||||
'Proxies' => prox
|
'Proxies' => prox,
|
||||||
)
|
'Context' => @config[:context]
|
||||||
|
}
|
||||||
|
if @config[:source_port] > 0
|
||||||
|
config['LocalPort'] = @config[:source_port]
|
||||||
|
end
|
||||||
|
if @config[:source_host].to_s != '0.0.0.0'
|
||||||
|
config['LocalHost'] = @config[:source_host] unless @config[:source_host].nil?
|
||||||
|
end
|
||||||
|
socket = Rex::Socket::Tcp.create(config)
|
||||||
rescue
|
rescue
|
||||||
@logger.warn "TCP Socket could not be established to #{ns}:#{@config[:port]} #{@config[:proxies]}"
|
@logger.warn "TCP Socket could not be established to #{ns}:#{@config[:port]} #{@config[:proxies]}"
|
||||||
throw :next_ns
|
throw :next_ns
|
||||||
|
@ -261,10 +269,18 @@ module DNS
|
||||||
begin
|
begin
|
||||||
@config[:udp_timeout].timeout do
|
@config[:udp_timeout].timeout do
|
||||||
begin
|
begin
|
||||||
socket = Rex::Socket::Udp.create(
|
config = {
|
||||||
'PeerHost' => ns.to_s,
|
'PeerHost' => ns.to_s,
|
||||||
'PeerPort' => @config[:port].to_i
|
'PeerPort' => @config[:port].to_i,
|
||||||
)
|
'Context' => @config[:context]
|
||||||
|
}
|
||||||
|
if @config[:source_port] > 0
|
||||||
|
config['LocalPort'] = @config[:source_port]
|
||||||
|
end
|
||||||
|
if @config[:source_host] != IPAddr.new('0.0.0.0')
|
||||||
|
config['LocalHost'] = @config[:source_host] unless @config[:source_host].nil?
|
||||||
|
end
|
||||||
|
socket = Rex::Socket::Udp.create(config)
|
||||||
rescue
|
rescue
|
||||||
@logger.warn "UDP Socket could not be established to #{ns}:#{@config[:port]}"
|
@logger.warn "UDP Socket could not be established to #{ns}:#{@config[:port]}"
|
||||||
return nil
|
return nil
|
||||||
|
|
Loading…
Reference in New Issue