Alter the socks5 bind request handling

GSoC/Meterpreter_Web_Console
Spencer McIntyre 2018-05-26 19:51:14 -04:00
parent c85cc9ad9e
commit da2666581b
2 changed files with 13 additions and 2 deletions

View File

@ -202,8 +202,8 @@ module Socks5
def handle_command_bind(request)
# create a server socket for this request
params = {
'LocalHost' => request.address,
'LocalPort' => request.port
'LocalHost' => request.address_type == Address::ADDRESS_TYPE_IPV6 ? '::' : '0.0.0.0',
'LocalPort' => 0,
}
params['Context'] = @server.opts['Context'] if @server.opts.has_key?('Context')
bsock = Rex::Socket::TcpServer.create(params)

View File

@ -64,6 +64,17 @@ RSpec.describe Rex::Proto::Proxy::Socks5::Packet do
end
end
describe "#read" do
it "should parse all fields" do
packet = Socks5::Packet.read("\x05\x01\x00\x01\x7f\x00\x00\x01\x00\x50")
expect(packet.version).to eq(Socks5::SOCKS_VERSION)
expect(packet.command).to eq(Socks5::ServerClient::COMMAND_CONNECT)
expect(packet.address_type).to eq(Socks5::Address::ADDRESS_TYPE_IPV4)
expect(packet.address).to eq('127.0.0.1')
expect(packet.port).to eq(80)
end
end
describe "#to_binary_s" do
it "should pack the data to a binary string" do
packet = Socks5::Packet.new