Edit File by line
/home/barbar84/public_h.../wp-conte.../plugins/sujqvwi/AnonR/anonr.TX.../opt/alt/ruby18/lib64/ruby/1.8
File: resolv-replace.rb
require 'socket'
[0] Fix | Delete
require 'resolv'
[1] Fix | Delete
[2] Fix | Delete
class << IPSocket
[3] Fix | Delete
alias original_resolv_getaddress getaddress
[4] Fix | Delete
def getaddress(host)
[5] Fix | Delete
begin
[6] Fix | Delete
return Resolv.getaddress(host).to_s
[7] Fix | Delete
rescue Resolv::ResolvError
[8] Fix | Delete
raise SocketError, "Hostname not known: #{host}"
[9] Fix | Delete
end
[10] Fix | Delete
end
[11] Fix | Delete
end
[12] Fix | Delete
[13] Fix | Delete
class TCPSocket
[14] Fix | Delete
alias original_resolv_initialize initialize
[15] Fix | Delete
def initialize(host, serv, *rest)
[16] Fix | Delete
rest[0] = IPSocket.getaddress(rest[0]) unless rest.empty?
[17] Fix | Delete
original_resolv_initialize(IPSocket.getaddress(host), serv, *rest)
[18] Fix | Delete
end
[19] Fix | Delete
end
[20] Fix | Delete
[21] Fix | Delete
class UDPSocket
[22] Fix | Delete
alias original_resolv_bind bind
[23] Fix | Delete
def bind(host, port)
[24] Fix | Delete
host = IPSocket.getaddress(host) if host != ""
[25] Fix | Delete
original_resolv_bind(host, port)
[26] Fix | Delete
end
[27] Fix | Delete
[28] Fix | Delete
alias original_resolv_connect connect
[29] Fix | Delete
def connect(host, port)
[30] Fix | Delete
original_resolv_connect(IPSocket.getaddress(host), port)
[31] Fix | Delete
end
[32] Fix | Delete
[33] Fix | Delete
alias original_resolv_send send
[34] Fix | Delete
def send(mesg, flags, *rest)
[35] Fix | Delete
if rest.length == 2
[36] Fix | Delete
host, port = rest
[37] Fix | Delete
begin
[38] Fix | Delete
addrs = Resolv.getaddresses(host)
[39] Fix | Delete
rescue Resolv::ResolvError
[40] Fix | Delete
raise SocketError, "Hostname not known: #{host}"
[41] Fix | Delete
end
[42] Fix | Delete
err = nil
[43] Fix | Delete
addrs[0...-1].each {|addr|
[44] Fix | Delete
begin
[45] Fix | Delete
return original_resolv_send(mesg, flags, addr, port)
[46] Fix | Delete
rescue SystemCallError
[47] Fix | Delete
end
[48] Fix | Delete
}
[49] Fix | Delete
original_resolv_send(mesg, flags, addrs[-1], port)
[50] Fix | Delete
else
[51] Fix | Delete
original_resolv_send(mesg, flags, *rest)
[52] Fix | Delete
end
[53] Fix | Delete
end
[54] Fix | Delete
end
[55] Fix | Delete
[56] Fix | Delete
class SOCKSSocket
[57] Fix | Delete
alias original_resolv_initialize initialize
[58] Fix | Delete
def initialize(host, serv)
[59] Fix | Delete
original_resolv_initialize(IPSocket.getaddress(host), port)
[60] Fix | Delete
end
[61] Fix | Delete
end if defined? SOCKSSocket
[62] Fix | Delete
[63] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function